diff mbox series

[08/11] block: set BIO_NO_PAGE_REF in bio_iov_bvec_set

Message ID 20210202171929.1504939-9-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/11] block: reuse BIO_INLINE_VECS for integrity bvecs | expand

Commit Message

Christoph Hellwig Feb. 2, 2021, 5:19 p.m. UTC
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>
---
 block/bio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index dd3b2a01c9bfaa..f753201238273b 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 {