[Devel] [PATCH rh7] ploop: dio_fastmap() must refresh bvec_merge_data
Maxim Patlasov
MPatlasov at openvz.org
Thu Jul 23 18:29:23 PDT 2015
q->merge_bvec_fn() may override some fileds of bvec_merge_data.
For example, raid0_mergeable_bvec() does so. The blessed way is
to initialize it from scratch before use -- see how __bio_add_page()
prepares bvm for calling q->merge_bvec_fn().
---
drivers/block/ploop/io_direct.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
-------------- next part --------------
q->merge_bvec_fn() may override some fileds of bvec_merge_data.
For example, raid0_mergeable_bvec() does so. The blessed way is
to initialize it from scratch before use -- see how __bio_add_page()
prepares bvm for calling q->merge_bvec_fn().
---
drivers/block/ploop/io_direct.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 793bcc5..0183b0f 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -1487,7 +1487,6 @@ dio_fastmap(struct ploop_io * io, struct bio * orig_bio,
struct request_queue * q;
struct extent_map * em;
int i;
- struct bvec_merge_data bm_data;
if (orig_bio->bi_size == 0) {
bio->bi_vcnt = 0;
@@ -1535,19 +1534,19 @@ dio_fastmap(struct ploop_io * io, struct bio * orig_bio,
bio->bi_size = 0;
bio->bi_vcnt = 0;
- bm_data.bi_bdev = bio->bi_bdev;
- bm_data.bi_sector = bio->bi_sector;
- bm_data.bi_size = 0;
- bm_data.bi_rw = bio->bi_rw;
-
for (i = 0; i < orig_bio->bi_vcnt; i++) {
struct bio_vec * bv = &bio->bi_io_vec[i];
+ struct bvec_merge_data bm_data = {
+ .bi_bdev = bio->bi_bdev,
+ .bi_sector = bio->bi_sector,
+ .bi_size = bio->bi_size,
+ .bi_rw = bio->bi_rw,
+ };
if (q->merge_bvec_fn(q, &bm_data, bv) < bv->bv_len) {
io->plo->st.fast_neg_backing++;
return 1;
}
bio->bi_size += bv->bv_len;
- bm_data.bi_size = bio->bi_size;
bio->bi_vcnt++;
}
return 0;
More information about the Devel
mailing list