summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-02-02 20:19:26 +0300
committerJens Axboe <axboe@kernel.dk>2021-02-08 18:33:16 +0300
commited97ce5e1daf26d456760443fc89dc14d2b677e5 (patch)
treec7a6518ccc5f43cb87a64bf187e1e1e094926d33 /block
parent86004515ed80c01d59ab54b5d048164750af3c4b (diff)
downloadlinux-ed97ce5e1daf26d456760443fc89dc14d2b677e5.tar.xz
block: set BIO_NO_PAGE_REF in bio_iov_bvec_set
bio_iov_bvec_set assigns the foreign bvec, so setting the NO_PAGE_REF directly there seems like the best fit. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/bio.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/bio.c b/block/bio.c
index dd3b2a01c9bf..f75320123827 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -941,6 +941,7 @@ static int bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter)
bio->bi_io_vec = (struct bio_vec *)iter->bvec;
bio->bi_iter.bi_bvec_done = iter->iov_offset;
bio->bi_iter.bi_size = iter->count;
+ bio_set_flag(bio, BIO_NO_PAGE_REF);
iov_iter_advance(iter, iter->count);
return 0;
@@ -1078,9 +1079,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
if (iov_iter_is_bvec(iter)) {
if (WARN_ON_ONCE(bio_op(bio) == REQ_OP_ZONE_APPEND))
return -EINVAL;
- bio_iov_bvec_set(bio, iter);
- bio_set_flag(bio, BIO_NO_PAGE_REF);
- return 0;
+ return bio_iov_bvec_set(bio, iter);
}
do {