[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] Holding both virtual and physical blocks prison when processing discard in dm-thin

Hi folks,

I recently traced the code of how dm-thin handles DISCARD requests and
found something interesting.
In thin_bio_map(), thin device will acquire the virtual and physical
bio_prison in sequence when it tries to remap bio based on a private
I know it is necessary to hold these prisons to avoid a possible
deadlock when there are parallel discard and non-discard requests to
the very same block.
However, I am curious about why we need to acquire the virtual
bio_prison first instead of trying to acquire only the physical
Since all bios from the same thin device (protected by virtual
bio_prison) will eventually be passed to physical blocks which are
protected by physical bio_prison,
it seems that holding only the physical bio_prison is sufficient to
prevent discard bios being processed in parallel with any other bios
targeting the same block.

Any help would be greatly appreciated.

Best Regards,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]