Skip to content

RFC block-layer interposer

Hannes Reinecke dm-devel linux-block 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest2 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2blk_interposer - Block Layer Interposerblock/blk-core.c block/genhd.c include/linux/blk_types.h +1 more+112 -20 replies
2/2dm_interposer - blk_interposer for device-mapperdrivers/md/dm-table.c drivers/md/dm.c drivers/md/dm.h+191 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC PATCHv2 0/2] block-layer interposer

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(-)
Signature · 1 line
2.16.4