linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/4] block-layer interposer
@ 2021-03-03 12:30 Sergei Shtepa
  2021-03-03 12:30 ` [PATCH v6 1/4] block: add blk_mq_is_queue_frozen() Sergei Shtepa
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Sergei Shtepa @ 2021-03-03 12:30 UTC (permalink / raw)
  To: snitzer, agk, hare, song, axboe, dm-devel, linux-block,
	linux-kernel, linux-raid, linux-api
  Cc: sergei.shtepa, pavel.tide

Hi all.

I'm joyful to suggest the block-layer interposer (blk_interposer) v6.
blk_interposer allows to intercept bio requests, remap bio to another
devices or add new bios.

This series of patches adds the ability to use blk_interposer for
any dm-target using the DM_INTERPOSED_FLAG flag.

The first patch adds the function blk_mq_is_queue_frozen(). It allows to
assert a queue state.

The second patch is dedicated to blk_interposer itself, which provides
the ability to intercept bio.

The third one adds support for blk_interposer from the device mapper.

The fourth patch adds the DM_INTERPOSED_FLAG flag. When this flag is
applied with the ioctl DM_TABLE_LOAD_CMD, the underlying devices are
opened without the FMODE_EXCL flag and connected via blk_interposer.

Changes:
v6 - current patch set
  * designed for 5.12;
  * thanks to the new design of the bio structure in v5.12, it is
    possible to perform interception not for the entire disk, but
    for each block device;
  * instead of the new ioctl DM_DEV_REMAP_CMD and the 'noexcl' option,
    the DM_INTERPOSED_FLAG flag for the ioctl DM_TABLE_LOAD_CMD is
    applied.

v5 - https://patchwork.kernel.org/project/linux-block/cover/1612881028-7878-1-git-send-email-sergei.shtepa@veeam.com/
 * rebase for v5.11-rc7;
 * patch set organization;
 * fix defects in documentation;
 * add some comments;
 * change mutex names for better code readability;
 * remove calling bd_unlink_disk_holder() for targets with non-exclusive
   flag;
 * change type for struct dm_remap_param from uint8_t to __u8.

v4 - https://patchwork.kernel.org/project/linux-block/cover/1612367638-3794-1-git-send-email-sergei.shtepa@veeam.com/
Mostly changes were made, due to Damien's comments:
 * on the design of the code;
 * by the patch set organization;
 * bug with passing a wrong parameter to dm_get_device();
 * description of the 'noexcl' parameter in the linear.rst.
Also added remap_and_filter.rst.

v3 - https://patchwork.kernel.org/project/linux-block/cover/1611853955-32167-1-git-send-email-sergei.shtepa@veeam.com/
In this version, I already suggested blk_interposer to apply to dm-linear.
Problems were solved:
 * Interception of bio requests from a specific device on the disk, not
   from the entire disk. To do this, we added the dm_interposed_dev
   structure and an interval tree to store these structures.
 * Implemented ioctl DM_DEV_REMAP_CMD. A patch with changes in the lvm2
   project was sent to the team lvm-devel@redhat.com.
 * Added the 'noexcl' option for dm-linear, which allows you to open
   the underlying block-device without FMODE_EXCL mode.

v2 - https://patchwork.kernel.org/project/linux-block/cover/1607518911-30692-1-git-send-email-sergei.shtepa@veeam.com/
I tried to suggest blk_interposer without using it in device mapper,
but with the addition of a sample of its use. It was then that I learned
about the maintainers' attitudes towards the samples directory :).

v1 - https://lwn.net/ml/linux-block/20201119164924.74401-1-hare@suse.de/
This Hannes's patch can be considered as a starting point, since this is
where the interception mechanism and the term blk_interposer itself
appeared. It became clear that blk_interposer can be useful for
device mapper.

before v1 - https://patchwork.kernel.org/project/linux-block/cover/1603271049-20681-1-git-send-email-sergei.shtepa@veeam.com/
I tried to offer a rather cumbersome blk-filter and a monster-like
blk-snap module for creating snapshots.

Thank you to everyone who was able to take the time to review
the previous versions.
I hope that this time I achieved the required quality.

Thanks,
Sergei.

Sergei Shtepa (4):
  block: add blk_mq_is_queue_frozen()
  block: add blk_interposer
  dm: introduce dm-interposer
  dm: add DM_INTERPOSED_FLAG

 block/bio.c                   |   2 +
 block/blk-core.c              |  36 +++++
 block/blk-mq.c                |  12 ++
 block/genhd.c                 |  93 ++++++++++++
 drivers/md/Makefile           |   2 +-
 drivers/md/dm-core.h          |   6 +
 drivers/md/dm-interposer.c    | 258 ++++++++++++++++++++++++++++++++++
 drivers/md/dm-interposer.h    |  40 ++++++
 drivers/md/dm-ioctl.c         |   9 ++
 drivers/md/dm-table.c         | 115 +++++++++++++--
 drivers/md/dm.c               |  38 +++--
 include/linux/blk-mq.h        |   1 +
 include/linux/blk_types.h     |   4 +
 include/linux/blkdev.h        |  17 +++
 include/linux/device-mapper.h |   1 +
 include/uapi/linux/dm-ioctl.h |   6 +
 16 files changed, 618 insertions(+), 22 deletions(-)
 create mode 100644 drivers/md/dm-interposer.c
 create mode 100644 drivers/md/dm-interposer.h

-- 
2.20.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-03-11 10:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 12:30 [PATCH v6 0/4] block-layer interposer Sergei Shtepa
2021-03-03 12:30 ` [PATCH v6 1/4] block: add blk_mq_is_queue_frozen() Sergei Shtepa
2021-03-09 17:19   ` Christoph Hellwig
2021-03-03 12:30 ` [PATCH v6 2/4] block: add blk_interposer Sergei Shtepa
2021-03-09 17:27   ` Christoph Hellwig
2021-03-10  4:53     ` Sergei Shtepa
2021-03-10 10:04       ` Christoph Hellwig
2021-03-03 12:30 ` [PATCH v6 3/4] dm: introduce dm-interposer Sergei Shtepa
2021-03-03 12:30 ` [PATCH v6 4/4] dm: add DM_INTERPOSED_FLAG Sergei Shtepa
2021-03-09 17:35   ` Christoph Hellwig
2021-03-10  5:28     ` Sergei Shtepa
2021-03-10 12:34       ` Christoph Hellwig
2021-03-11 10:54         ` Sergei Shtepa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).