summaryrefslogtreecommitdiffstats
path: root/block/blk-map.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2022-06-09 16:37:57 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2022-08-09 04:37:22 +0200
commit480cb846c27bda4e14d98a45a9f50c250f38f266 (patch)
tree398860bb9ba854be258b9eaee246a46021077be0 /block/blk-map.c
parentiov_iter: advancing variants of iov_iter_get_pages{,_alloc}() (diff)
downloadlinux-480cb846c27bda4e14d98a45a9f50c250f38f266.tar.xz
linux-480cb846c27bda4e14d98a45a9f50c250f38f266.zip
block: convert to advancing variants of iov_iter_get_pages{,_alloc}()
... doing revert if we end up not using some pages Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/blk-map.c')
-rw-r--r--block/blk-map.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/block/blk-map.c b/block/blk-map.c
index df8b066cd548..7196a6b64c80 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -254,7 +254,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
size_t offs, added = 0;
int npages;
- bytes = iov_iter_get_pages_alloc(iter, &pages, LONG_MAX, &offs);
+ bytes = iov_iter_get_pages_alloc2(iter, &pages, LONG_MAX, &offs);
if (unlikely(bytes <= 0)) {
ret = bytes ? bytes : -EFAULT;
goto out_unmap;
@@ -284,7 +284,6 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
bytes -= n;
offs = 0;
}
- iov_iter_advance(iter, added);
}
/*
* release the pages we didn't map into the bio, if any
@@ -293,8 +292,10 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
put_page(pages[j++]);
kvfree(pages);
/* couldn't stuff something into bio? */
- if (bytes)
+ if (bytes) {
+ iov_iter_revert(iter, bytes);
break;
+ }
}
ret = blk_rq_append_bio(rq, bio);