Commit 8a595834 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Li Nan
Browse files

block: mark the bio as cloned in bio_iov_bvec_set

mainline inclusion
from mainline-v5.12-rc1
commit 977be012
bugzilla: https://gitee.com/openeuler/kernel/issues/IB7FJU

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=977be01273844626ddeef4a464b42b99418d76e6



--------------------------------

bio_iov_bvec_set clones the bio_vecs from the iter, and thus should be
treated like a cloned bio in every respect.  That also includes not
touching bi_max_vecs as that is a property of the bio allocation and not
its current payload.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>

Conflicts:
  block/bio.c
[Commit c42bca92 ("bio: don't copy bvec for direct IO") add
bio_iov_bvec_set to initialize bio.]
Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
parent 43bfec2f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1118,8 +1118,10 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
		}
	} while (!ret && iov_iter_count(iter) && !bio_full(bio, 0));

	if (is_bvec)
	if (is_bvec) {
		bio_set_flag(bio, BIO_NO_PAGE_REF);
		bio_set_flag(bio, BIO_CLONED);
	}

	/* don't account direct I/O as memory stall */
	bio_clear_flag(bio, BIO_WORKINGSET);