[dm-devel] Re-using bio
enokhroot at yahoo.com
Thu May 22 08:07:25 UTC 2014
Forgot, to put it into a context, I'm working on an experimental device mapper target, so this is happening inside a target, after I've received a bio and sent out DM_MAPIO_SUBMITTED...
----- Original Message -----
From: Enoch Root <enokhroot at yahoo.com>
To: "dm-devel at redhat.com" <dm-devel at redhat.com>
Sent: Thursday, May 22, 2014 3:49 AM
Subject: Re-using bio
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