Thread (15 messages) 15 messages, 6 authors, 2018-06-30

Re: [PATCH] block: Make __bio_clone_fast() copy bi_vcnt

From: Ming Lei <hidden>
Date: 2018-06-27 23:50:06

On Wed, Jun 27, 2018 at 01:12:31PM -0700, Bart Van Assche wrote:
quoted hunk ↗ jump to hunk
Although __bio_clone_fast() copies bi_io_vec, it does not copy bi_vcnt,
the number of elements in bi_io_vec[] that contains data. Copy bi_vcnt
such that code that needs this member behaves identically for original
and for cloned requests.

Signed-off-by: Bart Van Assche <redacted>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Snitzer <redacted>
Cc: Ming Lei <redacted>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <redacted>
---
 block/bio.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/block/bio.c b/block/bio.c
index f7e3d88bd0b6..55f8e0dedd69 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -605,6 +605,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
 	bio->bi_opf = bio_src->bi_opf;
 	bio->bi_write_hint = bio_src->bi_write_hint;
 	bio->bi_iter = bio_src->bi_iter;
+	bio->bi_vcnt = bio_src->bi_vcnt;
 	bio->bi_io_vec = bio_src->bi_io_vec;
No, don't do that.

For a cloned bio, both .bi_vcnt and .bi_io_vec can't be used directly,
and we have done huge such cleanup for supporting multipage bvec, that is
the great idea of immutable bvecs invented by Kent.

Thanks,
Ming
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help