Re: [PATCH v3 10/14] device-dax: use ALIGN() for determining pgoff

From
Dan Williams <hidden>
Date
2021-07-28 07:29:56
Also in
linux-mm, nvdimm
Reply to
Joao Martins, 2021-07-14
On Wed, Jul 14, 2021 at 12:36 PM Joao Martins [off-list ref] wrote:
Rather than calculating @pgoff manually, switch to ALIGN() instead.
Looks good,

Reviewed-by: Dan Williams <redacted>
quoted hunk ↗ jump to hunk
Suggested-by: Dan Williams <redacted>
Signed-off-by: Joao Martins <redacted>
---
 drivers/dax/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index dd8222a42808..0b82159b3564 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -234,8 +234,8 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf,
                 * mapped. No need to consider the zero page, or racing
                 * conflicting mappings.
                 */
-               pgoff = linear_page_index(vmf->vma, vmf->address
-                               & ~(fault_size - 1));
+               pgoff = linear_page_index(vmf->vma,
+                               ALIGN(vmf->address, fault_size));
                for (i = 0; i < fault_size / PAGE_SIZE; i++) {
                        struct page *page;

--
2.17.1
Thread (78 messages) 78 messages, 7 authors, last reply 2021-08-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help