[dm-devel] Re-using bio

Enoch Root enokhroot at yahoo.com
Thu May 22 07:49:50 UTC 2014


Is it legal to re-use a bio that has been through a call to generic_make_request?

Assuming I want to perform read-modify-write, where modify part also comes from some other part of the disk, would it be legal to

1) alloc bio, add e.g. 4 pages to it, set the starting sector
2) call generic_make_request to read data
3) assuming I want to change page 3, clone the bio, change idx, to point to page 3, set the starting sector and the size
4) call generic_make_request to modify page 3 by reading data into it
5) change the direction of the original bio from read to write
6) call generic_make_request to write it back to disk

I have already attempted doing this, but I hit BUG_ON(bio->bi_next) in generic_make_request.  Am am doing something wrong or this is not how it should be done?  If so, please let me know how to do it properly. 


More information about the dm-devel mailing list