Skip to content

Commit

Permalink
block: set BIO_NO_PAGE_REF in bio_iov_bvec_set
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Feb 8, 2021
1 parent 8600451 commit ed97ce5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ed97ce5

Please sign in to comment.