[dm-devel] [RFC PATCHv2 0/2] block-layer interposer
Hannes Reinecke
hare at suse.de
Thu Nov 19 16:49:22 UTC 2020
Hi all,
here's a combined version of the earlier patchset from Sergei, fixing
some issues I've found during testing and including (some) feedback
from Mike. So with this patchset I could do a
echo "0 33554432 linear /dev/sda 0" | dmsetup create sda-cloned
on a system with root-fs on /dev/sda2, and things would continue to
run just like normal.
There are some things which might need to be improved:
- I've tried to remove the stub bio clone for the dm interposer as
suggested by Mike, but that resulted in an endless recursion in
submit_bio_noacct(). That needs more debugging, but I'm also not
sure if we _can_ do it; the end_io callback might refer to
bi_disk->driver_private, and then will get confused as we've
reassigned the 'bi_disk' setting. Not sure if there are fixed rules
for it, so for now I'll probably leave it.
- The interposer is 'magically' hooked to the first block device
in the device-mapper table. What I really want is to have an explicit
listing of the interposer in the output of things like 'dmsetup table'
like
0 33554432 interposer /dev/dm-0
0 33554432 linear /dev/sda 0
and the first entry having the device number of /dev/sda.
Plan was to have that automatically registered once you set up
the original table, but then I'm not sure if that's the right
way to go. Mike?
- The removal of blkdev_get() as an exported API made things
awkward, as we now have to do a blkdev_get_by_dev(); if not we
end up with an uninitalized blkcg and a resulting crash.
We might be able to fix this up by moving bdget() into dm_blk_open(),
and have md->bdev uninitalized otherwise. But again I'm not
sure if that's the right way to go.
Anyway, comments and reviews are welcome.
Sergei Shtepa (2):
blk_interposer - Block Layer Interposer
dm_interposer - blk_interposer for device-mapper
block/blk-core.c | 34 +++++++++++
block/genhd.c | 55 ++++++++++++++++++
drivers/md/dm-table.c | 59 +++++++++++++++++++
drivers/md/dm.c | 140 ++++++++++++++++++++++++++++++++++++++++++----
drivers/md/dm.h | 4 +-
include/linux/blk_types.h | 6 +-
include/linux/genhd.h | 19 +++++++
7 files changed, 303 insertions(+), 14 deletions(-)
--
2.16.4
More information about the dm-devel
mailing list