Re: [PATCH 06/17] block: simplify bio_map_kern

2025-04-22 Thread Hannes Reinecke
On 4/22/25 16:26, Christoph Hellwig wrote: Split bio_map_kern into a simple version that can use bio_add_virt_nofail for kernel direct mapping addresses and a more complex bio_map_vmalloc with the logic to chunk up and map vmalloc ranges using the bio_add_vmalloc helper. Signed-off-by: Christoph

Re: [PATCH 05/17] block: pass the operation to bio_{map,copy}_kern

2025-04-22 Thread Hannes Reinecke
On 4/22/25 16:26, Christoph Hellwig wrote: That way the bio can be allocated with the right operation already set and there is no need to pass the separated 'reading' argument. Signed-off-by: Christoph Hellwig --- block/blk-map.c | 30 ++ 1 file changed, 14 insert

Re: [PATCH 04/17] block: remove the q argument from blk_rq_map_kern

2025-04-22 Thread Hannes Reinecke
On 4/22/25 16:26, Christoph Hellwig wrote: Remove the q argument from blk_rq_map_kern and the internal helpers called by it as the queue can trivially be derived from the request. Signed-off-by: Christoph Hellwig --- block/blk-map.c| 24 ++-- drivers/block/pkt

Re: [PATCH 03/17] block: add a bio_add_vmalloc helper

2025-04-22 Thread Hannes Reinecke
On 4/22/25 16:26, Christoph Hellwig wrote: Add a helper to add a vmalloc region to a bio, abstracting away the vmalloc addresses from the underlying pages. Also add a helper to calculate how many segments need to be allocated for a vmalloc region. Signed-off-by: Christoph Hellwig --- block/b

Re: [PATCH 02/17] block: add a bdev_rw_virt helper

2025-04-22 Thread Hannes Reinecke
On 4/22/25 16:26, Christoph Hellwig wrote: Add a helper to perform synchronous I/O on a kernel direct map range. Currently this is implemented in various places in usually not very efficient ways, so provide a generic helper instead. Signed-off-by: Christoph Hellwig --- block/bio.c |

Re: [PATCH 01/17] block: add a bio_add_virt_nofail helper

2025-04-22 Thread Hannes Reinecke
On 4/22/25 16:26, Christoph Hellwig wrote: Add a helper to add a directly mapped kernel virtual address to a bio so that callers don't have to convert to pages or folios. For now only the _nofail variant is provided as that is what all the obvious callers want. Signed-off-by: Christoph Hellwig

Re: [PATCH 0/4] dm-flakey fixes

2025-04-22 Thread Kent Overstreet
On Tue, Apr 22, 2025 at 08:15:20PM -0400, Benjamin Marzinski wrote: > On Tue, Apr 22, 2025 at 08:02:54PM -0400, Kent Overstreet wrote: > > On Tue, Apr 22, 2025 at 07:47:34PM -0400, Benjamin Marzinski wrote: > > > This patchset handles some dm-flakey issues reported by Kent Overstreet. > > > It fixe

Re: [PATCH 0/4] dm-flakey fixes

2025-04-22 Thread Benjamin Marzinski
On Tue, Apr 22, 2025 at 08:02:54PM -0400, Kent Overstreet wrote: > On Tue, Apr 22, 2025 at 07:47:34PM -0400, Benjamin Marzinski wrote: > > This patchset handles some dm-flakey issues reported by Kent Overstreet. > > It fixes some issues with dm-flakey's parsing and feature interactions > > and make

[PATCH v4] dm-bufio: don't schedule in atomic context

2025-04-22 Thread LongPing Wei
A BUG was reported as below when CONFIG_DEBUG_ATOMIC_SLEEP and try_verify_in_tasklet are enabled. [ 129.444685][ T934] BUG: sleeping function called from invalid context at drivers/md/dm-bufio.c:2421 [ 129.444723][ T934] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 934, name: kworke

Re: [PATCH 0/4] dm-flakey fixes

2025-04-22 Thread Kent Overstreet
On Tue, Apr 22, 2025 at 07:47:34PM -0400, Benjamin Marzinski wrote: > This patchset handles some dm-flakey issues reported by Kent Overstreet. > It fixes some issues with dm-flakey's parsing and feature interactions > and makes corrupting read bios work. > > Benjamin Marzinski (4): > dm-flakey:

[PATCH 2/4] dm-flakey: error all IOs when num_features is absent

2025-04-22 Thread Benjamin Marzinski
dm-flakey would error all IOs if num_features was 0, but if it was absent, dm-flakey would never error any IO. Fix this so that no num_features works the same as num_features set to 0. Fixes: aa7d7bc99fed7 ("dm flakey: add an "error_reads" option") Reported-by: Kent Overstreet Signed-off-by: Benj

[PATCH 3/4] dm-flakey: remove useless ERROR_READS check in flakey_end_io

2025-04-22 Thread Benjamin Marzinski
If ERROR_READS is set, flakey_map returns DM_MAPIO_KILL for read bios and flakey_end_io is never called, so there's no point in checking it there. Also clean up an incorrect comment about when read IOs are errored out. Signed-off-by: Benjamin Marzinski --- drivers/md/dm-flakey.c | 11 ++-

[PATCH 0/4] dm-flakey fixes

2025-04-22 Thread Benjamin Marzinski
This patchset handles some dm-flakey issues reported by Kent Overstreet. It fixes some issues with dm-flakey's parsing and feature interactions and makes corrupting read bios work. Benjamin Marzinski (4): dm-flakey: Clean up parsing messages dm-flakey: error all IOs when num_features is absent

[PATCH 4/4] dm-flakey: make corrupting read bios work

2025-04-22 Thread Benjamin Marzinski
dm-flakey corrupts the read bios in the endio function. However, the corrupt_bio_* functions checked bio_has_data() to see if there was data to corrupt. Since this was the endio function, there was no data left to complete, so bio_has_data() was always false. Fix this by saving a copy of the bio's

[PATCH 1/4] dm-flakey: Clean up parsing messages

2025-04-22 Thread Benjamin Marzinski
There were a number of cases where the error message for an invalid table line did not match the actual problem. Fix these. Additionally, error out when duplicate corrupt_bio_byte, random_read_corrupt, or random_write_corrupt features are present. Also, error_reads is incompatible with random_read_

Re: [PATCH v3] dm-bufio: don't schedule in atomic context

2025-04-22 Thread John Stultz
On Wed, Apr 16, 2025 at 8:07 PM LongPing Wei wrote: > diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c > index 9c8ed65cd87e..3088f9f9169a 100644 > --- a/drivers/md/dm-bufio.c > +++ b/drivers/md/dm-bufio.c > @@ -2424,8 +2426,13 @@ static void __scan(struct dm_bufio_client *c) > >

[PATCH 2/2] dm: pass through operations on wrapped inline crypto keys

2025-04-22 Thread Eric Biggers
From: Eric Biggers Make the device-mapper layer pass through the derive_sw_secret, import_key, generate_key, and prepare_key blk-crypto operations when all underlying devices support hardware-wrapped inline crypto keys and are passing through inline crypto support. Commit ebc4176551cd ("blk-cryp

[PATCH 1/2] blk-crypto: export wrapped key functions

2025-04-22 Thread Eric Biggers
From: Eric Biggers Export blk_crypto_derive_sw_secret(), blk_crypto_import_key(), blk_crypto_generate_key(), and blk_crypto_prepare_key() so that they can be used by device-mapper when passing through wrapped key support. Signed-off-by: Eric Biggers --- block/blk-crypto-profile.c | 4 1 f

[PATCH 0/2] dm: pass through operations on wrapped inline crypto keys

2025-04-22 Thread Eric Biggers
This series makes the device-mapper layer pass through the blk-crypto wrapped key operations when underlying devices support them. Eric Biggers (2): blk-crypto: export wrapped key functions dm: pass through operations on wrapped inline crypto keys block/blk-crypto-profile.c | 4 + drivers/

[PATCH] dm-verity: use softirq context only when !need_resched()

2025-04-22 Thread Eric Biggers
From: Eric Biggers Further limit verification in softirq (a.k.a. BH) context to cases where rescheduling of the interrupted task is not pending. This helps prevent the CPU from spending too long in softirq context. Note that handle_softirqs() in kernel/softirq.c already stops running softirqs i

[PATCH] dm-bufio: remove maximum age based eviction

2025-04-22 Thread Eric Biggers
From: Eric Biggers Every 30 seconds, dm-bufio evicts all buffers that were not accessed within the last max_age_seconds, except those pinned in memory via retain_bytes. By default max_age_seconds is 300 (i.e. 5 minutes), and retain_bytes is 262144 (i.e. 256 KiB) per dm-bufio client. This evicti

[PATCH] dm: use generic functions instead of disable_discard and disable_write_zeroes

2025-04-22 Thread Mikulas Patocka
A small code cleanup: use blk_queue_disable_discard and blk_queue_disable_write_zeroes instead of disable_discard and disable_write_zeroes. Signed-off-by: Mikulas Patocka --- drivers/md/dm-core.h |3 --- drivers/md/dm-rq.c |4 ++-- drivers/md/dm.c | 20 ++-- 3 f

[PATCH]dm-integrity: fix a warning on invalid table line

2025-04-22 Thread Mikulas Patocka
If we use the 'B' mode and we have an invalit table line, cancel_delayed_work_sync would trigger a warning. This commit avoids the warning. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org --- drivers/md/dm-integrity.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: li

[PATCH] dm: lock limits when reading them

2025-04-22 Thread Mikulas Patocka
Lock queue limits when reading them, so that we don't read halfway modified values. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org --- drivers/md/dm-table.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) Index: linux-2.6/drivers/md/dm-table.c ===

Re: [PATCH v2] dm-delay: Prevent zoned write reordering on suspend

2025-04-22 Thread Mikulas Patocka
On Tue, 22 Apr 2025, Damien Le Moal wrote: > It is not because you do not see a clean solution that there is not one. So > unless you have completely made up your mind already and are not willing to I haven't made up my mind completely. > I do not understand what you are talking about. A zone

Re: add more bio helper

2025-04-22 Thread Kent Overstreet
On Tue, Apr 22, 2025 at 04:26:01PM +0200, Christoph Hellwig wrote: > Hi all, > > this series adds more block layer helpers to remove boilerplate code when > adding memory to a bio or to even do the entire synchronous I/O. > > The main aim is to avoid having to convert to a struct page in the call

[PATCH 17/17] PM: hibernate: split and simplify hib_submit_io

2025-04-22 Thread Christoph Hellwig
Split hib_submit_io into a sync and async version. The sync version is a small wrapper around bdev_rw_virt which implements all the logic to add a kernel direct mapping range to a bio and synchronously submits it, while the async version is slightly simplified using the bio_add_virt_nofail for add

[PATCH 13/17] btrfs: use bdev_rw_virt in scrub_one_super

2025-04-22 Thread Christoph Hellwig
Replace the code building a bio from a kernel direct map address and submitting it synchronously with the bdev_rw_virt helper. Signed-off-by: Christoph Hellwig --- fs/btrfs/scrub.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c

[PATCH 16/17] zonefs: use bdev_rw_virt in zonefs_read_super

2025-04-22 Thread Christoph Hellwig
Switch zonefs_read_super to allocate the superblock buffer using kmalloc which falls back to the page allocator for PAGE_SIZE allocation but gives us a kernel virtual address and then use bdev_rw_virt to perform the synchronous read into it. Signed-off-by: Christoph Hellwig --- fs/zonefs/super.c

[PATCH 15/17] gfs2: use bdev_rw_virt in gfs2_read_super

2025-04-22 Thread Christoph Hellwig
Switch gfs2_read_super to allocate the superblock buffer using kmalloc which falls back to the page allocator for PAGE_SIZE allocation but gives us a kernel virtual address and then use bdev_rw_virt to perform the synchronous read into it. Signed-off-by: Christoph Hellwig --- fs/gfs2/ops_fstype.

[PATCH 12/17] xfs: simplify xfs_rw_bdev

2025-04-22 Thread Christoph Hellwig
Delegate to bdev_rw_virt when operating on non-vmalloc memory and use bio_add_vmalloc to insulate xfs from the details of adding vmalloc memory to a bio. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_bio_io.c | 30 -- 1 file changed, 12 insertions(+), 18 deletions(-

[PATCH 14/17] hfsplus: use bdev_rw_virt in hfsplus_submit_bio

2025-04-22 Thread Christoph Hellwig
Replace the code building a bio from a kernel direct map address and submitting it synchronously with the bdev_rw_virt helper. Signed-off-by: Christoph Hellwig --- fs/hfsplus/wrapper.c | 46 +--- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git

[PATCH 11/17] xfs: simplify xfs_buf_submit_bio

2025-04-22 Thread Christoph Hellwig
Convert the __bio_add_page(..., virt_to_page(), ...) pattern to the bio_add_virt_nofail helper implementing it and use bio_add_vmalloc to insulate xfs from the details of adding vmalloc memory to a bio. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_buf.c | 27 --- 1 fil

[PATCH 10/17] rnbd-srv: use bio_add_virt_nofail

2025-04-22 Thread Christoph Hellwig
Use the bio_add_virt_nofail to add a single kernel virtual address to a bio as that can't fail. Signed-off-by: Christoph Hellwig --- drivers/block/rnbd/rnbd-srv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv

[PATCH 09/17] dm-integrity: use bio_add_virt_nofail

2025-04-22 Thread Christoph Hellwig
Convert the __bio_add_page(..., virt_to_page(), ...) pattern to the bio_add_virt_nofail helper implementing it, and do the same for the similar pattern using bio_add_page for adding the first segment after a bio allocation as that can't fail either. Signed-off-by: Christoph Hellwig --- drivers/m

[PATCH 07/17] bcache: use bio_add_virt_nofail

2025-04-22 Thread Christoph Hellwig
Convert the __bio_add_page(..., virt_to_page(), ...) pattern to the bio_add_virt_nofail helper implementing it. Signed-off-by: Christoph Hellwig --- drivers/md/bcache/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super

[PATCH 06/17] block: simplify bio_map_kern

2025-04-22 Thread Christoph Hellwig
Split bio_map_kern into a simple version that can use bio_add_virt_nofail for kernel direct mapping addresses and a more complex bio_map_vmalloc with the logic to chunk up and map vmalloc ranges using the bio_add_vmalloc helper. Signed-off-by: Christoph Hellwig --- block/blk-map.c | 74 +

[PATCH 08/17] dm-bufio: use bio_add_virt_nofail

2025-04-22 Thread Christoph Hellwig
Convert the __bio_add_page(..., virt_to_page(), ...) pattern to the bio_add_virt_nofail helper implementing it. Signed-off-by: Christoph Hellwig --- drivers/md/dm-bufio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 9c8ed

[PATCH 05/17] block: pass the operation to bio_{map,copy}_kern

2025-04-22 Thread Christoph Hellwig
That way the bio can be allocated with the right operation already set and there is no need to pass the separated 'reading' argument. Signed-off-by: Christoph Hellwig --- block/blk-map.c | 30 ++ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/block/bl

[PATCH 04/17] block: remove the q argument from blk_rq_map_kern

2025-04-22 Thread Christoph Hellwig
Remove the q argument from blk_rq_map_kern and the internal helpers called by it as the queue can trivially be derived from the request. Signed-off-by: Christoph Hellwig --- block/blk-map.c| 24 ++-- drivers/block/pktcdvd.c| 2 +- drivers/block/ublk_drv.c |

[PATCH 03/17] block: add a bio_add_vmalloc helper

2025-04-22 Thread Christoph Hellwig
Add a helper to add a vmalloc region to a bio, abstracting away the vmalloc addresses from the underlying pages. Also add a helper to calculate how many segments need to be allocated for a vmalloc region. Signed-off-by: Christoph Hellwig --- block/bio.c | 27 +++

[PATCH 02/17] block: add a bdev_rw_virt helper

2025-04-22 Thread Christoph Hellwig
Add a helper to perform synchronous I/O on a kernel direct map range. Currently this is implemented in various places in usually not very efficient ways, so provide a generic helper instead. Signed-off-by: Christoph Hellwig --- block/bio.c | 30 ++ include/lin

[PATCH 01/17] block: add a bio_add_virt_nofail helper

2025-04-22 Thread Christoph Hellwig
Add a helper to add a directly mapped kernel virtual address to a bio so that callers don't have to convert to pages or folios. For now only the _nofail variant is provided as that is what all the obvious callers want. Signed-off-by: Christoph Hellwig --- include/linux/bio.h | 17 ++

add more bio helper

2025-04-22 Thread Christoph Hellwig
Hi all, this series adds more block layer helpers to remove boilerplate code when adding memory to a bio or to even do the entire synchronous I/O. The main aim is to avoid having to convert to a struct page in the caller when adding kernel direct mapping or vmalloc memory. Diffstat: block/bio.c

Re: [RFC PATCH 00/11] pcache: Persistent Memory Cache for Block Devices

2025-04-22 Thread Dongsheng Yang
On 2025/4/22 18:29, Mikulas Patocka wrote: Hi On Thu, 17 Apr 2025, Dongsheng Yang wrote: +ccing md-devel On 2025/4/16 23:10, Jens Axboe wrote: On 4/16/25 12:08 AM, Dongsheng Yang wrote: On 2025/4/16 9:04, Jens Axboe wrote: On 4/15/25 12:00 PM, Dan Williams wrote: Thanks for making the

Re: [PATCH v2] dm-delay: Prevent zoned write reordering on suspend

2025-04-22 Thread Damien Le Moal
On 4/22/25 20:27, Mikulas Patocka wrote: > > > On Fri, 18 Apr 2025, Damien Le Moal wrote: > >>> It seems that you want to send many small overlapping write bios - the >>> question is why? Why can't the application accumulate the content and send >>> it as one big bio? >> >> That is the applica

Re: [PATCH] dm-bufio: skip cond_resched when no_sleep is enabled

2025-04-22 Thread Mikulas Patocka
On Thu, 17 Apr 2025, LongPing Wei wrote: > On 2025/4/16 20:22, Mikulas Patocka wrote: > > > > > > On Wed, 16 Apr 2025, LongPing Wei wrote: > > > > > A BUG was reported as below when CONFIG_DEBUG_ATOMIC_SLEEP and > > > try_verify_in_tasklet are enabled. > > > > > > diff --git a/drivers/md/dm

Re: [PATCH v2] dm-delay: Prevent zoned write reordering on suspend

2025-04-22 Thread Mikulas Patocka
On Fri, 18 Apr 2025, Damien Le Moal wrote: > > It seems that you want to send many small overlapping write bios - the > > question is why? Why can't the application accumulate the content and send > > it as one big bio? > > That is the application problem. On HDDs at least, small IOs will hu

Re: [PATCH v3] dm-bufio: don't schedule in atomic context

2025-04-22 Thread Mikulas Patocka
Thanks, I staged this patch for 6.15. Mikulas On Thu, 17 Apr 2025, LongPing Wei wrote: > A BUG was reported as below when CONFIG_DEBUG_ATOMIC_SLEEP and > try_verify_in_tasklet are enabled. > [ 129.444685][ T934] BUG: sleeping function called from invalid context at > drivers/md/dm-bufio.c:24

Re: [RFC PATCH 00/11] pcache: Persistent Memory Cache for Block Devices

2025-04-22 Thread Mikulas Patocka
Hi On Thu, 17 Apr 2025, Dongsheng Yang wrote: > +ccing md-devel > > On 2025/4/16 23:10, Jens Axboe wrote: > > On 4/16/25 12:08 AM, Dongsheng Yang wrote: > > > On 2025/4/16 9:04, Jens Axboe wrote: > > > > On 4/15/25 12:00 PM, Dan Williams wrote: > > > > > Thanks for making the comparison chart.