Skip to content

Commit 2a48f3a

Browse files
committed
NFSD: Use rqstp->rq_bvec in nfsd_iter_read()
If we can get rid of all uses of rq_vec, then it can be removed. Replace one use of rqstp::rq_vec with rqstp::rq_bvec. Suggested-by: Christoph Hellwig <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 59cf734 commit 2a48f3a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/nfsd/vfs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,23 +1085,23 @@ __be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
10851085
unsigned long v, total;
10861086
struct iov_iter iter;
10871087
loff_t ppos = offset;
1088-
struct page *page;
10891088
ssize_t host_err;
1089+
size_t len;
10901090

10911091
v = 0;
10921092
total = *count;
10931093
while (total) {
1094-
page = *(rqstp->rq_next_page++);
1095-
rqstp->rq_vec[v].iov_base = page_address(page) + base;
1096-
rqstp->rq_vec[v].iov_len = min_t(size_t, total, PAGE_SIZE - base);
1097-
total -= rqstp->rq_vec[v].iov_len;
1094+
len = min_t(size_t, total, PAGE_SIZE - base);
1095+
bvec_set_page(&rqstp->rq_bvec[v], *(rqstp->rq_next_page++),
1096+
len, base);
1097+
total -= len;
10981098
++v;
10991099
base = 0;
11001100
}
1101-
WARN_ON_ONCE(v > ARRAY_SIZE(rqstp->rq_vec));
1101+
WARN_ON_ONCE(v > rqstp->rq_maxpages);
11021102

11031103
trace_nfsd_read_vector(rqstp, fhp, offset, *count);
1104-
iov_iter_kvec(&iter, ITER_DEST, rqstp->rq_vec, v, *count);
1104+
iov_iter_bvec(&iter, ITER_DEST, rqstp->rq_bvec, v, *count);
11051105
host_err = vfs_iter_read(file, &iter, &ppos, 0);
11061106
return nfsd_finish_read(rqstp, fhp, file, offset, count, eof, host_err);
11071107
}

0 commit comments

Comments
 (0)