[dm-devel] [PATCH] kpartx: Add -P option for partition scanning

2022-02-11 Thread Ritika Srivastava
Add -P, partition scanning option to kpartx which would set LO_FLAGS_PARTSCAN flag during loop device creation. This option is same as losetup -P option. Signed-off-by: Ritika Srivastava --- kpartx/kpartx.c | 17 + kpartx/lopart.c | 5 - kpartx/lopart.h | 2 +- 3 files chan

[dm-devel] [PATCH] kpartx: Add -P option for partition scanning

2022-02-11 Thread Ritika Srivastava
Add -P, partition scanning option to kpartx which would set LO_FLAGS_PARTSCAN flag during loop device creation. This option is same as losetup -P option. Signed-off-by: Ritika Srivastava --- kpartx/kpartx.c | 17 + kpartx/lopart.c | 5 - kpartx/lopart.h | 2 +- 3 files chan

[dm-devel] [PATCH v2 02/14] dm: fold __clone_and_map_data_bio into __split_and_process_bio

2022-02-11 Thread Mike Snitzer
Fold __clone_and_map_data_bio into its only caller. Reviewed-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 30 -- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 2cecb8832936..2f1942b61d

[dm-devel] [PATCH v2 01/14] dm: rename split functions

2022-02-11 Thread Mike Snitzer
Rename __split_and_process_bio to dm_split_and_process_bio. Rename __split_and_process_non_flush to __split_and_process_bio. Also fix a stale comment and whitespace. Reviewed-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 22 +++--- 1 file changed, 11 i

[dm-devel] [PATCH v2 13/14] dm delay: use dm_submit_bio_remap

2022-02-11 Thread Mike Snitzer
Signed-off-by: Mike Snitzer --- drivers/md/dm-delay.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c index 59e51d285b0e..9a51bf51a859 100644 --- a/drivers/md/dm-delay.c +++ b/drivers/md/dm-delay.c @@ -72,7 +72,7 @@ static voi

[dm-devel] [PATCH v2 14/14] dm: move duplicate code in callers of alloc_tio into alloc_tio

2022-02-11 Thread Mike Snitzer
Suggested-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 2461df65e2fe..20c7b1b4d1f7 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c

[dm-devel] [PATCH v2 11/14] dm: add dm_submit_bio_remap interface

2022-02-11 Thread Mike Snitzer
Switch from early bio-based IO accounting (at the time DM clones each incoming bio) to late IO accounting just before each remapped bio is issued to underlying device via submit_bio_noacct(). Allows more precise bio-based IO accounting for DM targets that use their own workqueues to perform additi

[dm-devel] [PATCH v2 07/14] dm: remove code only needed before submit_bio recursion

2022-02-11 Thread Mike Snitzer
Commit 8615cb65bd63 ("dm: remove useless loop in __split_and_process_bio") showcased that we no longer loop. Remove the bio_advance() in __split_and_process_bio() that was only needed when looping was possible. Similarly there is no need to advance the bio, using ci->sector cursor, in __send_dupl

[dm-devel] [PATCH v2 06/14] dm: remove unused mapped_device argument from free_tio

2022-02-11 Thread Mike Snitzer
Reviewed-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index bd07ccadbf01..137e578785f6 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -539,7 +539,7 @@ static

[dm-devel] [PATCH v2 04/14] dm: reduce code duplication in __map_bio

2022-02-11 Thread Mike Snitzer
Error path code (for handling DM_MAPIO_REQUEUE and DM_MAPIO_KILL) is effectively identical. Reviewed-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c in

[dm-devel] [PATCH v2 00/14] dm: improve bio-based IO accounting

2022-02-11 Thread Mike Snitzer
Hi, All the changes from this patchset are available here: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/log/?h=dm-5.18 This work is based on Jens' for-5.18/block Please see v1's 0th header for context on motivation behind this patchset: https://listman.redhat.com/ar

[dm-devel] [PATCH v2 12/14] dm crypt: use dm_submit_bio_remap

2022-02-11 Thread Mike Snitzer
Signed-off-by: Mike Snitzer --- drivers/md/dm-crypt.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index a5006cb6ee8a..337517cb4e90 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1855,7 +1855,7 @@ st

[dm-devel] [PATCH v2 09/14] dm: move kicking of suspend queue to dm_io_dec_pending

2022-02-11 Thread Mike Snitzer
Move kicking of the suspend queue to dm_io_dec_pending (the only caller) since end_io_acct will soon only be called if IO accounting was started. Also, some comment tweaks and removal of local variables. No functional change. Reviewed-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drive

[dm-devel] [PATCH v2 05/14] dm: remove impossible BUG_ON in __send_empty_flush

2022-02-11 Thread Mike Snitzer
The flush_bio in question was just initialized to be empty, so there is no way bio_has_data() will return true. So remove stale BUG_ON(). Reviewed-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/dm.c b/drivers/

[dm-devel] [PATCH v2 10/14] block: add bio_start_io_acct_remapped for the benefit of DM

2022-02-11 Thread Mike Snitzer
DM needs the ability to account a clone bio's IO to the original block_device. So add @orig_bdev argument to bio_start_io_acct_time. Rename bio_start_io_acct_time to bio_start_io_acct_remapped. Also, follow bio_end_io_acct and bio_end_io_acct_remapped pattern by moving bio_start_io_acct to blkdev

[dm-devel] [PATCH v2 08/14] dm: record old_sector in dm_target_io before calling map function

2022-02-11 Thread Mike Snitzer
Prep for being able to defer trace_block_bio_remap() until when the bio is remapped and submitted by the DM target. Reviewed-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/md/dm-core.h | 1 + drivers/md/dm.c | 7 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff

[dm-devel] [PATCH v2 03/14] dm: refactor dm_split_and_process_bio a bit

2022-02-11 Thread Mike Snitzer
Remove needless branching and indentation. Leaves code to catch malformed op_is_zone_mgmt bios (they shouldn't have a payload). Reviewed-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 54 -- 1 file changed, 28 insertio

Re: [dm-devel] dm: fix dm_stats accounting

2022-02-11 Thread Mike Snitzer
On Fri, Feb 11 2022 at 10:01P -0500, Mikulas Patocka wrote: > Exactly the same sector number and length must be passed to both calls of > dm_stats_account_io, otherwise its per-zone in_flight counters go out of > sync. This patch fixes it. > > Signed-off-by: Mikulas Patocka > > --- > drivers/

Re: [dm-devel] dm: account statistics correctly in case of bio split

2022-02-11 Thread Mike Snitzer
On Fri, Feb 11 2022 at 10:03P -0500, Mikulas Patocka wrote: > If a bio was split to multiple targets, only one target's sub-range was > counted. This patch changes it so that all the targets' ranges are > counted. > > Note that calls to bio_start_io_acct_remapped and bio_end_io_acct must > match

[dm-devel] [PATCH] dm: account statistics correctly in case of bio split

2022-02-11 Thread Mikulas Patocka
If a bio was split to multiple targets, only one target's sub-range was counted. This patch changes it so that all the targets' ranges are counted. Note that calls to bio_start_io_acct_remapped and bio_end_io_acct must match, so we maintain a counter how many times we have called bio_start_io_acct

[dm-devel] [PATCH] dm: fix dm_stats accounting

2022-02-11 Thread Mikulas Patocka
Exactly the same sector number and length must be passed to both calls of dm_stats_account_io, otherwise its per-zone in_flight counters go out of sync. This patch fixes it. Signed-off-by: Mikulas Patocka --- drivers/md/dm.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) In