Fixes for clone_bio and __clone_and_map functions in dm.c
Hi Alasdair,
Quoted 1 line
Quoted 1 line
I found a small bug in the
clone_bio()function indm.c. The number of
bio
Quoted 1 line
Quoted 1 line
vectors in the cloned bio is incorrectly set to the index of the last
bio
Quoted 4 lines
Quoted 1 line
vector in its range. I have corrected it in the attached patch.
I don't see that yet - the code is not very transparent though. (Look at the places that call the function.)
I am a little confused about why is this not a problem. Isn't clone->bi_vcnt supposed to hold the number of bio vectors in the clone? Why does it hold idx+bv_count instead? Please clarify.
Thanks
Abhishek
Alasdair G Kergon
maintainerQuoted 4 lines
I am a little confused about why is this not a problem. Isn't
clone->bi_vcnt
supposed to hold the number of bio vectors in the clone? Why does it hold idx+bv_count instead? Please clarify.
idx is non-zero; bv_count variable is the number starting from idx. clone->bi_vcnt is the total number.
unsigned int bi_vcnt; /* how many bio_vec's */
unsigned int bi_idx; /* current index into bio_vec array */clone_bio(bio, ci->sector, ci->idx, bio->bi_vcnt - ci->idx, ci->sector_count);
leads to clone->bi_vcnt = ci->idx + bio->bi_vcnt - ci->idx = bio->bi_vcnt
Like I said, obfuscated.
Alasdair
Signature · 1 line
[email protected]