svcrdma: use offset_in_page() macro
authorChuck Lever <chuck.lever@oracle.com>
Fri, 23 Jun 2017 21:19:21 +0000 (17:19 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 12 Jul 2017 19:54:59 +0000 (15:54 -0400)
Clean up: Use offset_in_page() macro instead of open-coding.

Reported-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/xprtrdma/svc_rdma_rw.c

index 9d7a151b48856fb1021cff04391e52b2ae1aff03..9859736b331bca68d7e6efd620679b7a56293498 100644 (file)
@@ -372,8 +372,9 @@ static void svc_rdma_pagelist_to_sg(struct svc_rdma_write_info *info,
        struct scatterlist *sg;
        struct page **page;
 
-       page_off = (info->wi_next_off + xdr->page_base) & ~PAGE_MASK;
-       page_no = (info->wi_next_off + xdr->page_base) >> PAGE_SHIFT;
+       page_off = info->wi_next_off + xdr->page_base;
+       page_no = page_off >> PAGE_SHIFT;
+       page_off = offset_in_page(page_off);
        page = xdr->pages + page_no;
        info->wi_next_off += remaining;
        sg = ctxt->rw_sg_table.sgl;