sunrpc: use bvec_set_page to initialize bvecs
authorChristoph Hellwig <hch@lst.de>
Fri, 3 Feb 2023 15:06:32 +0000 (16:06 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Feb 2023 17:17:42 +0000 (10:17 -0700)
Use the bvec_set_page helper to initialize bvecs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Chuck Lever <chuck.lever@oracle.com>
Acked-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Link: https://lore.kernel.org/r/20230203150634.3199647-22-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
net/sunrpc/svcsock.c
net/sunrpc/xdr.c

index 815baf3..91252ad 100644 (file)
@@ -252,11 +252,8 @@ static ssize_t svc_tcp_read_msg(struct svc_rqst *rqstp, size_t buflen,
 
        clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
 
-       for (i = 0, t = 0; t < buflen; i++, t += PAGE_SIZE) {
-               bvec[i].bv_page = rqstp->rq_pages[i];
-               bvec[i].bv_len = PAGE_SIZE;
-               bvec[i].bv_offset = 0;
-       }
+       for (i = 0, t = 0; t < buflen; i++, t += PAGE_SIZE)
+               bvec_set_page(&bvec[i], rqstp->rq_pages[i], PAGE_SIZE, 0);
        rqstp->rq_respages = &rqstp->rq_pages[i];
        rqstp->rq_next_page = rqstp->rq_respages + 1;
 
index f7767bf..afe7ec0 100644 (file)
@@ -150,9 +150,8 @@ xdr_alloc_bvec(struct xdr_buf *buf, gfp_t gfp)
                if (!buf->bvec)
                        return -ENOMEM;
                for (i = 0; i < n; i++) {
-                       buf->bvec[i].bv_page = buf->pages[i];
-                       buf->bvec[i].bv_len = PAGE_SIZE;
-                       buf->bvec[i].bv_offset = 0;
+                       bvec_set_page(&buf->bvec[i], buf->pages[i], PAGE_SIZE,
+                                     0);
                }
        }
        return 0;