diff options
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 7db564d18dc6..7026014717bc 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -1310,7 +1310,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii, | |||
1310 | 1310 | ||
1311 | while (nbytes < *nbytesp && req->num_pages < req->max_pages) { | 1311 | while (nbytes < *nbytesp && req->num_pages < req->max_pages) { |
1312 | unsigned npages; | 1312 | unsigned npages; |
1313 | size_t start, end, frag_size; | 1313 | size_t start; |
1314 | unsigned n = req->max_pages - req->num_pages; | 1314 | unsigned n = req->max_pages - req->num_pages; |
1315 | ssize_t ret = iov_iter_get_pages(ii, | 1315 | ssize_t ret = iov_iter_get_pages(ii, |
1316 | &req->pages[req->num_pages], | 1316 | &req->pages[req->num_pages], |
@@ -1344,19 +1344,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii, | |||
1344 | 1344 | ||
1345 | static inline int fuse_iter_npages(const struct iov_iter *ii_p) | 1345 | static inline int fuse_iter_npages(const struct iov_iter *ii_p) |
1346 | { | 1346 | { |
1347 | struct iov_iter ii = *ii_p; | 1347 | return iov_iter_npages(ii_p, FUSE_MAX_PAGES_PER_REQ); |
1348 | int npages = 0; | ||
1349 | |||
1350 | while (iov_iter_count(&ii) && npages < FUSE_MAX_PAGES_PER_REQ) { | ||
1351 | unsigned long user_addr = fuse_get_user_addr(&ii); | ||
1352 | unsigned offset = user_addr & ~PAGE_MASK; | ||
1353 | size_t frag_size = iov_iter_single_seg_count(&ii); | ||
1354 | |||
1355 | npages += (frag_size + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
1356 | iov_iter_advance(&ii, frag_size); | ||
1357 | } | ||
1358 | |||
1359 | return min(npages, FUSE_MAX_PAGES_PER_REQ); | ||
1360 | } | 1348 | } |
1361 | 1349 | ||
1362 | ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, | 1350 | ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, |