Skip to content

Commit 9088151

Browse files
Christoph Hellwigaxboe
authored andcommitted
sunrpc: use bvec_set_page to initialize bvecs
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>
1 parent efde918 commit 9088151

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

net/sunrpc/svcsock.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,8 @@ static ssize_t svc_tcp_read_msg(struct svc_rqst *rqstp, size_t buflen,
252252

253253
clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
254254

255-
for (i = 0, t = 0; t < buflen; i++, t += PAGE_SIZE) {
256-
bvec[i].bv_page = rqstp->rq_pages[i];
257-
bvec[i].bv_len = PAGE_SIZE;
258-
bvec[i].bv_offset = 0;
259-
}
255+
for (i = 0, t = 0; t < buflen; i++, t += PAGE_SIZE)
256+
bvec_set_page(&bvec[i], rqstp->rq_pages[i], PAGE_SIZE, 0);
260257
rqstp->rq_respages = &rqstp->rq_pages[i];
261258
rqstp->rq_next_page = rqstp->rq_respages + 1;
262259

net/sunrpc/xdr.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,8 @@ xdr_alloc_bvec(struct xdr_buf *buf, gfp_t gfp)
150150
if (!buf->bvec)
151151
return -ENOMEM;
152152
for (i = 0; i < n; i++) {
153-
buf->bvec[i].bv_page = buf->pages[i];
154-
buf->bvec[i].bv_len = PAGE_SIZE;
155-
buf->bvec[i].bv_offset = 0;
153+
bvec_set_page(&buf->bvec[i], buf->pages[i], PAGE_SIZE,
154+
0);
156155
}
157156
}
158157
return 0;

0 commit comments

Comments
 (0)