Nikolay Borisov <n.borisov@xxxxxxxxxxxxxx> writes: > Hello, > > I've been looking at the block code related to bio completion and > there is one situation that I cannot explain to myself. Suppose that > we have an io which is submitted to an LVM device. The bio would start > its life in submit_bh-->submit_bh_wbc. Where its bi_end_io member is > going to be set to end_bio_bh_io_sync. So far so great, however as the > bio progresses through the block layer it would eventually be cloned > in dm_make_request->__split_and_process_bio-> > __split_and_process_non_flush->__clone_and_map_data_bio->clone_bio->__bio_clone_fast > > What bugs me is that this cloned bio would be sent to device mapper > for completion, so the question whose answer I'm seeking is when is > the original bio completed, since at some point it's just being cloned > and its clones are being sent off down the storage stack? I was just > using dm as an example but I'm curios as to the general mechanism of > completing cloned bios, since in this situation what has to happen is > for the cloned bio to be completed and then the original one, no? Correct. From my reading, __split_and_process_bio sets up a dm_io that points to the original bio. Upon completion of the dm_io, the original bio is also completed. See dec_pending. For usage outside of dm, you'll want to look at bio_chain. Cheers, Jeff -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html