Re: [PATCH 21/26] block: move the poll flag to queue_limits

2024-06-11 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 05:21:07PM +0900, Damien Le Moal wrote: > Kind of the same remark as for io_stat about this not really being a device > feature. But I guess seeing "features" as a queue feature rather than just a > device feature makes it OK to have poll (and io_stat) as a feature rather

Re: [PATCH 19/26] block: move the nowait flag to queue_limits

2024-06-11 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 05:16:37PM +0900, Damien Le Moal wrote: > > @@ -1825,9 +1815,7 @@ int dm_table_set_restrictions(struct dm_table *t, > > struct request_queue *q, > > int r; > > > > if (dm_table_supports_nowait(t)) > > - blk_queue_flag_set(QUEUE_FLAG_NOWAIT, q); > > -

Re: [PATCH 16/26] block: move the io_stat flag setting to queue_limits

2024-06-11 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 05:09:45PM +0900, Damien Le Moal wrote: > On 6/11/24 2:19 PM, Christoph Hellwig wrote: > > Move the io_stat flag into the queue_limits feature field so that it > > can be set atomically and all I/O is frozen when changing the flag. > > Why a fe

Re: [PATCH 13/26] block: move cache control settings out of queue->flags

2024-06-11 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 04:55:04PM +0900, Damien Le Moal wrote: > On 6/11/24 2:19 PM, Christoph Hellwig wrote: > > Move the cache control settings into the queue_limits so that they > > can be set atomically and all I/O is frozen when changing the > > flags. > >

Re: [PATCH 13/26] block: move cache control settings out of queue->flags

2024-06-11 Thread Christoph Hellwig
A friendly reminder that I've skipped over the full quote. Please properly quote mails if you want your replies to be seen.

Re: [PATCH 10/26] xen-blkfront: don't disable cache flushes when they fail

2024-06-11 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 04:30:39PM +0900, Damien Le Moal wrote: > On 6/11/24 2:19 PM, Christoph Hellwig wrote: > > blkfront always had a robust negotiation protocol for detecting a write > > cache. Stop simply disabling cache flushes when they fail as that is > > a grave e

Re: [PATCH 02/26] sd: move zone limits setup out of sd_read_block_characteristics

2024-06-11 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 02:51:24PM +0900, Damien Le Moal wrote: > > - if (!sd_is_zoned(sdkp)) > > + if (!sd_is_zoned(sdkp)) { > > + lim->zoned = false; > > Maybe we should clear the other zone related limits here ? If the drive is > reformatted/converted from SMR to CMR (FORMAT WITH

Re: [PATCH 06/26] loop: also use the default block size from an underlying block device

2024-06-10 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 02:58:56PM +0900, Damien Le Moal wrote: > > + if (S_ISBLK(inode->i_mode)) > > + backing_bdev = I_BDEV(inode); > > + else if (inode->i_sb->s_bdev) > > + backing_bdev = inode->i_sb->s_bdev; > > + > > Why not move this hunk inside the below "if" ?

Re: [PATCH 05/26] loop: regularize upgrading the lock size for direct I/O

2024-06-10 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 02:56:59PM +0900, Damien Le Moal wrote: > > + if (!bsize) > > + bsize = loop_default_blocksize(lo, inode->i_sb->s_bdev); > > If bsize is specified and there is a backing dev used with direct IO, should > it > be checked that bsize is a multiple of

Re: [PATCH 03/26] loop: stop using loop_reconfigure_limits in __loop_clr_fd

2024-06-10 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 02:53:19PM +0900, Damien Le Moal wrote: > > + /* reset the block size to the default */ > > + lim = queue_limits_start_update(lo->lo_queue); > > + lim.logical_block_size = 512; > > Nit: SECTOR_SIZE ? maybe ? Yes. I was following the existing code, but SECTOR_SIZE

Re: [PATCH 02/26] sd: move zone limits setup out of sd_read_block_characteristics

2024-06-10 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 07:52:39AM +0200, Christoph Hellwig wrote: > > Maybe we should clear the other zone related limits here ? If the drive is > > reformatted/converted from SMR to CMR (FORMAT WITH PRESET), the other zone > > limits may be set already, no ? > > b

Re: [PATCH 02/26] sd: move zone limits setup out of sd_read_block_characteristics

2024-06-10 Thread Christoph Hellwig
On Tue, Jun 11, 2024 at 02:51:24PM +0900, Damien Le Moal wrote: > > - if (lim->zoned) > > + if (sdkp->device->type == TYPE_ZBC) > > Nit: use sd_is_zoned() here ? Yes. > > - if (!sd_is_zoned(sdkp)) > > + if (!sd_is_zoned(sdkp)) { > > + lim->zoned = false; > > Maybe we should

[PATCH 16/26] block: move the io_stat flag setting to queue_limits

2024-06-10 Thread Christoph Hellwig
pointless. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c| 1 - block/blk-mq.c| 6 +- block/blk-sysfs.c | 2 +- drivers/md/dm-table.c | 12 +--- drivers/md/dm.c | 13 +++-- drivers/md/md.c

[PATCH 12/26] block: remove blk_flush_policy

2024-06-10 Thread Christoph Hellwig
Fold blk_flush_policy into the only caller to prepare for pending changes to it. Signed-off-by: Christoph Hellwig --- block/blk-flush.c | 33 +++-- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/block/blk-flush.c b/block/blk-flush.c index

[PATCH 24/26] block: move the pci_p2pdma flag to queue_limits

2024-06-10 Thread Christoph Hellwig
Move the pci_p2pdma flag into the queue_limits feature field so that it can be set atomically and all I/O is frozen when changing the flag. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c | 1 - drivers/nvme/host/core.c | 8 +++- include/linux/blkdev.h | 7 --- 3 files

[PATCH 14/26] block: move the nonrot flag to queue_limits

2024-06-10 Thread Christoph Hellwig
on rotational devices even if that is probably not their main use today (e.g. virtio_blk and drbd). The flag is automatically inherited in blk_stack_limits matching the existing behavior in dm and md. Signed-off-by: Christoph Hellwig --- arch/m68k/emu/nfblock.c | 1 + arch/um/drivers

[PATCH 21/26] block: move the poll flag to queue_limits

2024-06-10 Thread Christoph Hellwig
of the underlying devices. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 5 ++-- block/blk-mq-debugfs.c| 1 - block/blk-mq.c| 31 +++- block/blk-settings.c | 10 --- block/blk-sysfs.c | 4 +-- drivers/md/dm-table.c

[PATCH 17/26] block: move the stable_write flag to queue_limits

2024-06-10 Thread Christoph Hellwig
devices. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c | 1 - block/blk-sysfs.c | 29 + drivers/block/drbd/drbd_main.c | 5 ++--- drivers/block/rbd.c| 9 +++-- drivers/block/zram/zram_drv.c | 2 +- drivers/md/dm

[PATCH 23/26] block: move the zone_resetall flag to queue_limits

2024-06-10 Thread Christoph Hellwig
Move the zone_resetall flag into the queue_limits feature field so that it can be set atomically and all I/O is frozen when changing the flag. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c | 1 - drivers/block/null_blk/zoned.c | 3 +-- drivers/block/ublk_drv.c | 4

[PATCH 26/26] block: move the bounce flag into the feature field

2024-06-10 Thread Christoph Hellwig
Move the bounce field into the flags field to reclaim a little bit of space. Signed-off-by: Christoph Hellwig --- block/blk-settings.c| 1 - block/blk.h | 2 +- drivers/scsi/scsi_lib.c | 2 +- include/linux/blkdev.h | 6 -- 4 files changed, 6 insertions(+), 5 deletions

[PATCH 10/26] xen-blkfront: don't disable cache flushes when they fail

2024-06-10 Thread Christoph Hellwig
blkfront always had a robust negotiation protocol for detecting a write cache. Stop simply disabling cache flushes when they fail as that is a grave error. Signed-off-by: Christoph Hellwig --- drivers/block/xen-blkfront.c | 29 + 1 file changed, 9 insertions(+), 20

[PATCH 19/26] block: move the nowait flag to queue_limits

2024-06-10 Thread Christoph Hellwig
of the underlying devices. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c| 1 - block/blk-mq.c| 2 +- block/blk-settings.c | 9 + drivers/block/brd.c | 4 ++-- drivers/md/dm-table.c | 16 ++-- drivers/md/md.c

[PATCH 18/26] block: move the synchronous flag to queue_limits

2024-06-10 Thread Christoph Hellwig
Move the synchronous flag into the queue_limits feature field so that it can be set atomically and all I/O is frozen when changing the flag. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c| 1 - drivers/block/brd.c | 2 +- drivers/block/zram/zram_drv.c | 4

[PATCH 07/26] loop: fold loop_update_rotational into loop_reconfigure_limits

2024-06-10 Thread Christoph Hellwig
This prepares for moving the rotational flag into the queue_limits and also fixes it for the case where the loop device is backed by a block device. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 23 --- 1 file changed, 4 insertions(+), 19 deletions(-) diff

[PATCH 22/26] block: move the zoned flag into the feature field

2024-06-10 Thread Christoph Hellwig
Move the boolean zoned field into the flags field to reclaim a little bit of space. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 5 ++--- drivers/block/null_blk/zoned.c | 2 +- drivers/block/ublk_drv.c | 2 +- drivers/block/virtio_blk.c | 5 +++-- drivers

[PATCH 25/26] block: move the skip_tagset_quiesce flag to queue_limits

2024-06-10 Thread Christoph Hellwig
Move the skip_tagset_quiesce flag into the queue_limits feature field so that it can be set atomically and all I/O is frozen when changing the flag. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c | 1 - drivers/nvme/host/core.c | 8 +--- include/linux/blkdev.h | 6 -- 3

[PATCH 15/26] block: move the add_random flag to queue_limits

2024-06-10 Thread Christoph Hellwig
without the flag set. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c| 1 - block/blk-sysfs.c | 6 +++--- drivers/block/mtip32xx/mtip32xx.c | 1 - drivers/md/dm-table.c | 18 -- drivers/mmc/core/queue.c | 2 -- drivers/mtd

[PATCH 13/26] block: move cache control settings out of queue->flags

2024-06-10 Thread Christoph Hellwig
is a pre-existing data integrity bug in those targets that really needs fixing, after which a non-zero num_flush_bios should be required in dm for targets that map to underlying devices. Signed-off-by: Christoph Hellwig --- .../block/writeback_cache_control.rst | 67 +++ arch

[PATCH 20/26] block: move the dax flag to queue_limits

2024-06-10 Thread Christoph Hellwig
Move the dax flag into the queue_limits feature field so that it can be set atomically and all I/O is frozen when changing the flag. Signed-off-by: Christoph Hellwig --- block/blk-mq-debugfs.c | 1 - drivers/md/dm-table.c| 4 ++-- drivers/nvdimm/pmem.c| 7 ++- drivers

[PATCH 11/26] block: freeze the queue in queue_attr_store

2024-06-10 Thread Christoph Hellwig
queue_attr_store updates attributes used to control generating I/O, and can cause malformed bios if changed with I/O in flight. Freeze the queue in common code instead of adding it to almost every attribute. Signed-off-by: Christoph Hellwig --- block/blk-mq.c| 5 +++-- block/blk-sysfs.c

[PATCH 01/26] sd: fix sd_is_zoned

2024-06-10 Thread Christoph Hellwig
model") Signed-off-by: Christoph Hellwig --- drivers/scsi/sd.h | 7 ++- drivers/scsi/sd_zbc.c | 7 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h index 726f1613f6cb56..65dff3c2108926 100644 --- a/drivers/scsi/sd.h +++

[PATCH 08/26] virtio_blk: remove virtblk_update_cache_mode

2024-06-10 Thread Christoph Hellwig
virtblk_update_cache_mode boils down to a single call to blk_queue_write_cache. Remove it in preparation for moving the cache control flags into the queue_limits. Signed-off-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions

[PATCH 05/26] loop: regularize upgrading the lock size for direct I/O

2024-06-10 Thread Christoph Hellwig
The LOOP_CONFIGURE path automatically upgrades the block size to that of the underlying file for O_DIRECT file descriptors, but the LOOP_SET_BLOCK_SIZE path does not. Fix this by lifting the code to pick the block size into common code. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c

[PATCH 03/26] loop: stop using loop_reconfigure_limits in __loop_clr_fd

2024-06-10 Thread Christoph Hellwig
__loop_clr_fd wants to clear all settings on the device. Prepare for moving more settings into the block limits by open coding loop_reconfigure_limits. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git

[PATCH 09/26] nbd: move setting the cache control flags to __nbd_set_size

2024-06-10 Thread Christoph Hellwig
Move setting the cache control flags in nbd in preparation for moving these flags into the queue_limits structure. Signed-off-by: Christoph Hellwig --- drivers/block/nbd.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block

[PATCH 06/26] loop: also use the default block size from an underlying block device

2024-06-10 Thread Christoph Hellwig
Fix the code in loop_reconfigure_limits to pick a default block size for O_DIRECT file descriptors to also work when the loop device sits on top of a block device and not just on a regular file on a block device based file system. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 8

[PATCH 04/26] loop: always update discard settings in loop_reconfigure_limits

2024-06-10 Thread Christoph Hellwig
Simplify loop_reconfigure_limits by always updating the discard limits. This adds a little more work to loop_set_block_size, but doesn't change the outcome as the discard flag won't change. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 10 -- 1 file changed, 4 insertions

[PATCH 02/26] sd: move zone limits setup out of sd_read_block_characteristics

2024-06-10 Thread Christoph Hellwig
Move a bit of code that sets up the zone flag and the write granularity into sd_zbc_read_zones to be with the rest of the zoned limits. Signed-off-by: Christoph Hellwig --- drivers/scsi/sd.c | 21 + drivers/scsi/sd_zbc.c | 13 - 2 files changed, 13 insertions

Re: convert the SCSI ULDs to the atomic queue limits API v2

2024-05-31 Thread Christoph Hellwig
On Fri, May 31, 2024 at 08:07:54AM -0400, Martin K. Petersen wrote: > If you have other block layer changes depending on this series we'll > probably need a shared branch. I'll need to make several changes to sd.c > to fix reported issues, including a couple in the zeroing/discard > department.

[PATCH 12/14] sr: convert to the atomic queue limits API

2024-05-31 Thread Christoph Hellwig
names to standard ones. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- drivers/scsi/sr.c | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 7ab000942b97fc..3f491019103e0c

[PATCH 13/14] block: remove unused queue limits API

2024-05-31 Thread Christoph Hellwig
Remove all APIs that are unused now that sd and sr have been converted to the atomic queue limits API. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- block/blk-settings.c | 190 - include/linux/blkdev.h | 24 -- 2 files changed

[PATCH 11/14] sd: convert to the atomic queue limits API

2024-05-31 Thread Christoph Hellwig
Assign all queue limits through a local queue_limits variable and queue_limits_commit_update so that we can't race updating them from multiple places, and freeze the queue when updating them so that in-progress I/O submissions don't see half-updated limits. Signed-off-by: Christoph Hellwig

[PATCH 14/14] block: add special APIs for run-time disabling of discard and friends

2024-05-31 Thread Christoph Hellwig
locks or freeze the queue. Keep the existing clearing of the relevant field to zero, but replace the old blk_queue_max_* APIs with new disable APIs that force the value to 0. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- arch/um/drivers/ubd_kern.c

[PATCH 09/14] sd: factor out a sd_discard_mode helper

2024-05-31 Thread Christoph Hellwig
Split the logic to pick the right discard mode into a little helper to prepare for further changes. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- drivers/scsi/sd.c | 37 - 1 file changed, 20 insertions(+), 17

[PATCH 07/14] sd: add a sd_disable_write_same helper

2024-05-31 Thread Christoph Hellwig
-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- drivers/scsi/sd.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index f07d90474e682b..70211d0b187652 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi

[PATCH 01/14] ubd: refactor the interrupt handler

2024-05-31 Thread Christoph Hellwig
Instead of a separate handler function that leaves no work in the interrupt hanler itself, split out a per-request end I/O helper and clean up the coding style and variable naming while we're at it. Signed-off-by: Christoph Hellwig --- arch/um/drivers/ubd_kern.c | 49

[PATCH 03/14] rbd: increase io_opt again

2024-05-31 Thread Christoph Hellwig
ize of any buffered read) and to prepare for using io_opt in the max_sectors calculation and getting drivers out of the business of overriding the max_user_sectors value. Signed-off-by: Christoph Hellwig --- drivers/block/rbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dri

[PATCH 08/14] sd: simplify the disable case in sd_config_discard

2024-05-31 Thread Christoph Hellwig
Fall through to the main call to blk_queue_max_discard_sectors given that max_blocks has been initialized to zero above instead of duplicating the call. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- drivers/scsi/sd.c | 3 +-- 1 file changed, 1

[PATCH 10/14] sd: cleanup zoned queue limits initialization

2024-05-31 Thread Christoph Hellwig
Consolidate setting zone-related queue limits in sd_zbc_read_zones instead of splitting them between sd_zbc_revalidate_zones and sd_zbc_read_zones, and move the early_zone_information initialization in sd_zbc_read_zones above setting up the queue limits. Signed-off-by: Christoph Hellwig Reviewed

[PATCH 05/14] sd: simplify the ZBC case in provisioning_mode_store

2024-05-31 Thread Christoph Hellwig
to change this now. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- drivers/scsi/sd.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3dff9150ce11e2..83aa17fea39d39 100644

[PATCH 06/14] sd: add a sd_disable_discard helper

2024-05-31 Thread Christoph Hellwig
Add helper to disable discard when it is not supported and use it instead of sd_config_discard in the I/O completion handler. This avoids touching more fields than required in the I/O completion handler and prepares for converting sd to use the atomic queue limits API. Signed-off-by: Christoph

[PATCH 04/14] block: take io_opt and io_min into account for max_sectors

2024-05-31 Thread Christoph Hellwig
big io_min value, but picks a much more useful default for those who provide these hints, and allows to remove the hacks to set the user max_sectors limit in nbd, rbd and sd. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- block/blk-settings.c | 7

[PATCH 02/14] ubd: untagle discard vs write zeroes not support handling

2024-05-31 Thread Christoph Hellwig
: Add support for DISCARD in the UBD Driver") Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- arch/um/drivers/ubd_kern.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/

convert the SCSI ULDs to the atomic queue limits API v2

2024-05-31 Thread Christoph Hellwig
Hi all, this series converts the SCSI upper level drivers to the atomic queue limits API. The first patch is a bug fix for ubd that later patches depend on and might be worth picking up for 6.10. The second patch changes the max_sectors calculation to take the optimal I/O size into account so

Re: [PATCH 02/12] block: take io_opt and io_min into account for max_sectors

2024-05-31 Thread Christoph Hellwig
On Fri, May 31, 2024 at 08:48:12AM +0200, Ilya Dryomov wrote: > We should revert io_opt from opts->alloc_size to objset_bytes (I think > it's what you meant to say but typoed). Yes, sorry. > How do you want to handle it? I can put together a patch, send it to > ceph-devel and it will be picked

Re: [PATCH 02/12] block: take io_opt and io_min into account for max_sectors

2024-05-30 Thread Christoph Hellwig
On Thu, May 30, 2024 at 09:48:06PM +0200, Ilya Dryomov wrote: > For rbd, this change effectively lowers max_sectors from 4M to 64K or > less and that is definitely not desirable. From previous interactions > with users we want max_sectors to match max_hw_sectors -- this has come > up a quite a

Re: [PATCH 09/12] sd: convert to the atomic queue limits API

2024-05-30 Thread Christoph Hellwig
On Thu, May 30, 2024 at 10:16:33AM +0100, John Garry wrote: >> -static void sd_config_write_same(struct scsi_disk *); >> +static void sd_config_discard(struct scsi_disk *sdkp, struct queue_limits >> *lim, >> +unsigned int mode); > > Are there any reasons why we keep forward

[PATCH 12/12] block: add special APIs for run-time disabling of discard and friends

2024-05-28 Thread Christoph Hellwig
locks or freezer the queue. Keep the existing clearing of the relevant field to zero, but replace the old blk_queue_max_* APIs with new disable APIs that force the value to 0. Signed-off-by: Christoph Hellwig --- arch/um/drivers/ubd_kern.c | 5 ++--- block/blk-settings.c | 41

[PATCH 10/12] sr: convert to the atomic queue limits API

2024-05-28 Thread Christoph Hellwig
names to standard ones. Signed-off-by: Christoph Hellwig --- drivers/scsi/sr.c | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 7ab000942b97fc..3f491019103e0c 100644 --- a/drivers/scsi/sr.c

[PATCH 11/12] block: remove unused queue limits API

2024-05-28 Thread Christoph Hellwig
Remove all APIs that are unused now that sd and sr have been converted to the atomic queue limits API. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 190 - include/linux/blkdev.h | 12 --- 2 files changed, 202 deletions(-) diff --git

[PATCH 08/12] sd: cleanup zoned queue limits initialization

2024-05-28 Thread Christoph Hellwig
Consolidate setting zone-related queue limits in sd_zbc_read_zones instead of splitting them between sd_zbc_revalidate_zones and sd_zbc_read_zones, and move the early_zone_information initialization in sd_zbc_read_zones above setting up the queue limits. Signed-off-by: Christoph Hellwig

[PATCH 06/12] sd: simplify the disable case in sd_config_discard

2024-05-28 Thread Christoph Hellwig
Fall through to the main call to blk_queue_max_discard_sectors given that max_blocks has been initialized to zero above instead of duplicating the call. Signed-off-by: Christoph Hellwig --- drivers/scsi/sd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c

[PATCH 01/12] ubd: untagle discard vs write zeroes not support handling

2024-05-28 Thread Christoph Hellwig
: Add support for DISCARD in the UBD Driver") Signed-off-by: Christoph Hellwig --- arch/um/drivers/ubd_kern.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index ef805eaa9e013d..a79a3b7c33a647 100644 ---

[PATCH 04/12] sd: add a sd_disable_discard helper

2024-05-28 Thread Christoph Hellwig
Add helper to disable discard when it is not supported and use it instead of sd_config_discard in the I/O completion handler. This avoids touching more fields than required in the I/O completion handler and prepares for converting sd to use the atomic queue limits API. Signed-off-by: Christoph

[PATCH 09/12] sd: convert to the atomic queue limits API

2024-05-28 Thread Christoph Hellwig
Assign all queue limits through a local queue_limits variable and queue_limits_commit_update so that we can't race updating them from multiple places, and free the queue when updating them so that in-progress I/O submissions don't see half-updated limits. Signed-off-by: Christoph Hellwig

convert the SCSI ULDs to the atomic queue limits API

2024-05-28 Thread Christoph Hellwig
Hi all, this series converts the SCSI upper level drivers to the atomic queue limits API. The first patch is a bug fix for ubd that later patches depend on and might be worth picking up for 6.10. The second patch changes the max_sectors calculation to take the optimal I/O size into account so

[PATCH 07/12] sd: factor out a sd_discard_mode helper

2024-05-28 Thread Christoph Hellwig
Split the logic to pick the right discard mode into a little helper to prepare for further changes. Signed-off-by: Christoph Hellwig --- drivers/scsi/sd.c | 37 - 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi

[PATCH 02/12] block: take io_opt and io_min into account for max_sectors

2024-05-28 Thread Christoph Hellwig
change that could use careful review from people familiar with rbd. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 7 +++ drivers/block/nbd.c | 2 +- drivers/block/rbd.c | 1 - drivers/scsi/sd.c| 29 + 4 files changed, 13 insertions(+), 26

[PATCH 05/12] sd: add a sd_disable_write_same helper

2024-05-28 Thread Christoph Hellwig
-by: Christoph Hellwig --- drivers/scsi/sd.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a8838381823254..09ffe9d826aeac 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1004,6 +1004,13 @@ static blk_status_t

[PATCH 03/12] sd: simplify the ZBC case in provisioning_mode_store

2024-05-28 Thread Christoph Hellwig
to change this now. Signed-off-by: Christoph Hellwig --- drivers/scsi/sd.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3dff9150ce11e2..15d0035048d902 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -461,14 +461,13

Re: [PATCH 2/2] iommu/dma: Fix zero'ing of bounce buffer padding used by untrusted devices

2024-05-06 Thread Christoph Hellwig
On Sun, Apr 07, 2024 at 09:11:42PM -0700, mhkelle...@gmail.com wrote: > I've wondered if this code for zero'ing the pre- and post-padding > should go in swiotlb_tbl_map_single(). The bounce buffer proper is > already being initialized there. But swiotlb_tbl_map_single() > would need to test for an

Re: [PATCH v4 bpf-next 2/2] mm: Introduce VM_SPARSE kind and vm_area_[un]map_pages().

2024-03-06 Thread Christoph Hellwig
I'd still prefer to hide the vm_area, but for now: Reviewed-by: Christoph Hellwig

Re: [PATCH v2 bpf-next 3/3] mm: Introduce VM_SPARSE kind and vm_area_[un]map_pages().

2024-02-29 Thread Christoph Hellwig
On Tue, Feb 27, 2024 at 05:31:28PM -0800, Alexei Starovoitov wrote: > What would it look like with a cookie? > A static inline wrapper around get_vm_area() that returns area->addr ? > And the start address of vmap range will be such a cookie? Hmm, just making the kernel virtual address the cookie

Re: [PATCH v2 bpf-next 3/3] mm: Introduce VM_SPARSE kind and vm_area_[un]map_pages().

2024-02-27 Thread Christoph Hellwig
> privately-managed pages into a sparse vm area with the following steps: > > area = get_vm_area(area_size, VM_SPARSE); // at bpf prog verification time > vm_area_map_pages(area, kaddr, 1, page); // on demand > // it will return an error if kaddr is out of range >

Re: convert xen-blkfront to atomic queue limit updates v2

2024-02-27 Thread Christoph Hellwig
Jens, can you pick this up with the Xen maintainer review in place?

Re: [PATCH v2 bpf-next 2/3] mm, xen: Separate xen use cases from ioremap.

2024-02-26 Thread Christoph Hellwig
On Fri, Feb 23, 2024 at 03:57:27PM -0800, Alexei Starovoitov wrote: > From: Alexei Starovoitov > > xen grant table and xenbus ring are not ioremap the way arch specific code is > using it, > so let's add VM_XEN flag to separate them from VM_IOREMAP users. > xen will not and should not be

Re: [PATCH v2 bpf-next 1/3] mm: Enforce VM_IOREMAP flag and range in ioremap_page_range.

2024-02-26 Thread Christoph Hellwig
() matches created vm_area to avoid accidentally ioremap-ing > into wrong address range. Nit: overly long lines in the commit message here. Otherwise looks good: Reviewed-by: Christoph Hellwig

[PATCH 4/4] xen-blkfront: atomically update queue limits

2024-02-21 Thread Christoph Hellwig
Pass the initial queue limits to blk_mq_alloc_disk and use the blkif_set_queue_limits API to update the limits on reconnect. Signed-off-by: Christoph Hellwig Acked-by: Roger Pau Monné --- drivers/block/xen-blkfront.c | 41 1 file changed, 23 insertions

[PATCH 2/4] xen-blkfront: rely on the default discard granularity

2024-02-21 Thread Christoph Hellwig
The block layer now sets the discard granularity to the physical block size default. Take advantage of that in xen-blkfront and only set the discard granularity if explicitly specified. Signed-off-by: Christoph Hellwig Acked-by: Roger Pau Monné --- drivers/block/xen-blkfront.c | 4 ++-- 1

convert xen-blkfront to atomic queue limit updates v2

2024-02-21 Thread Christoph Hellwig
Hi all, this series converts xen-blkfront to the new atomic queue limits update API in the block tree. I don't have a Xen setup so this is compile tested only. Changes since v1: - constify the info argument to blkif_set_queue_limits - remove a spurious word from a commit message Diffstat:

[PATCH 3/4] xen-blkfront: don't redundantly set max_sements in blkif_recover

2024-02-21 Thread Christoph Hellwig
blkif_set_queue_limits already sets the max_sements limits, so don't do it a second time. Also remove a comment about a long fixe bug in blk_mq_update_nr_hw_queues. Signed-off-by: Christoph Hellwig Acked-by: Roger Pau Monné --- drivers/block/xen-blkfront.c | 8 +++- 1 file changed, 3

[PATCH 1/4] xen-blkfront: set max_discard/secure erase limits to UINT_MAX

2024-02-21 Thread Christoph Hellwig
Currently xen-blkfront set the max discard limit to the capacity of the device, which is suboptimal when the capacity changes. Just set it to UINT_MAX, which has the same effect and is simpler. Signed-off-by: Christoph Hellwig Acked-by: Roger Pau Monné --- drivers/block/xen-blkfront.c | 6

Re: [PATCH 4/4] xen-blkfront: atomically update queue limits

2024-02-20 Thread Christoph Hellwig
On Tue, Feb 20, 2024 at 01:35:07PM +0100, Roger Pau Monné wrote: > On Tue, Feb 20, 2024 at 09:49:35AM +0100, Christoph Hellwig wrote: > > Pass the initial queue limits to blk_mq_alloc_disk and use the > > blkif_set_queue_limits API to update the limits on reconnect. > > Al

Re: [PATCH 1/4] xen-blkfront: set max_discard/secure erase limits to UINT_MAX

2024-02-20 Thread Christoph Hellwig
On Tue, Feb 20, 2024 at 12:39:59PM +0100, Roger Pau Monné wrote: > On Tue, Feb 20, 2024 at 09:49:32AM +0100, Christoph Hellwig wrote: > > Currently xen-blkfront set the max discard limit to the capacity of > > the device, which is suboptimal when the capacity changes. Just set >

[PATCH 4/4] xen-blkfront: atomically update queue limits

2024-02-20 Thread Christoph Hellwig
Pass the initial queue limits to blk_mq_alloc_disk and use the blkif_set_queue_limits API to update the limits on reconnect. Signed-off-by: Christoph Hellwig --- drivers/block/xen-blkfront.c | 41 1 file changed, 23 insertions(+), 18 deletions(-) diff --git

[PATCH 3/4] xen-blkfront: don't redundantly set max_sements in blkif_recover

2024-02-20 Thread Christoph Hellwig
blkif_set_queue_limits already sets the max_sements limits, so don't do it a second time. Also remove a comment about a long fixe bug in blk_mq_update_nr_hw_queues. Signed-off-by: Christoph Hellwig --- drivers/block/xen-blkfront.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions

[PATCH 1/4] xen-blkfront: set max_discard/secure erase limits to UINT_MAX

2024-02-20 Thread Christoph Hellwig
Currently xen-blkfront set the max discard limit to the capacity of the device, which is suboptimal when the capacity changes. Just set it to UINT_MAX, which has the same effect except and is simpler. Signed-off-by: Christoph Hellwig --- drivers/block/xen-blkfront.c | 6 ++ 1 file changed

[PATCH 2/4] xen-blkfront: rely on the default discard granularity

2024-02-20 Thread Christoph Hellwig
The block layer now sets the discard granularity to the physical block size default. Take advantage of that in xen-blkfront and only set the discard granularity if explicitly specified. Signed-off-by: Christoph Hellwig --- drivers/block/xen-blkfront.c | 4 ++-- 1 file changed, 2 insertions

convert xen-blkfront to atomic queue limit updates

2024-02-20 Thread Christoph Hellwig
Hi all, this series converts xen-blkfront to the new atomic queue limits update API in the block tree. I don't have a Xen setup so this is compile tested only. Diffstat: xen-blkfront.c | 53 +++-- 1 file changed, 27 insertions(+), 26

Re: [PATCH RFC v3 for-6.8/block 04/17] mtd: block2mtd: use bdev apis

2024-01-04 Thread Christoph Hellwig
On Thu, Jan 04, 2024 at 12:28:55PM +0100, Jan Kara wrote: > What do you think? Because when we are working with the folios it is rather > natural to use their mapping for dirty balancing? The real problem is that block2mtd pokes way to deep into block internals. I think the saviour here is

Re: [PATCH RFC v3 for-6.8/block 02/17] xen/blkback: use bdev api in xen_update_blkif_status()

2024-01-04 Thread Christoph Hellwig
On Thu, Jan 04, 2024 at 12:06:31PM +0100, Jan Kara wrote: > This function uses invalidate_inode_pages2() while invalidate_bdev() ends > up using mapping_try_invalidate() and there are subtle behavioral > differences between these two (for example invalidate_inode_pages2() tries > to clean dirty

Re: [PATCH RFC v2 for-6.8/block 15/18] buffer: add a new helper to read sb block

2023-12-12 Thread Christoph Hellwig
On Mon, Dec 11, 2023 at 10:07:53PM +0800, Yu Kuai wrote: > +static __always_inline int buffer_uptodate_or_error(struct buffer_head *bh) > +{ > + /* > + * If the buffer has the write error flag, data was failed to write > + * out in the block. In this case, set buffer uptodate to

Re: [PATCH RFC v2 for-6.8/block 17/18] ext4: remove block_device_ejected()

2023-12-12 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig

Re: [PATCH RFC v2 for-6.8/block 01/18] block: add some bdev apis

2023-12-12 Thread Christoph Hellwig
> +void invalidate_bdev_range(struct block_device *bdev, pgoff_t start, > +pgoff_t end) > +{ > + invalidate_mapping_pages(bdev->bd_inode->i_mapping, start, end); > +} > +EXPORT_SYMBOL_GPL(invalidate_bdev_range); Can we have kerneldoc comments for the new helpers

Re: [PATCH RFC v2 for-6.8/block 01/18] block: add some bdev apis

2023-12-12 Thread Christoph Hellwig
On Mon, Dec 11, 2023 at 05:52:17PM +0100, Jan Kara wrote: > > +void bdev_associated_mapping(struct block_device *bdev, > > +struct address_space *mapping) > > +{ > > + mapping->host = bdev->bd_inode; > > +} > > Here I'm not sure - is the helper really a win? It seems a

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-06 Thread Christoph Hellwig
On Wed, Dec 06, 2023 at 12:50:38PM -0500, Theodore Ts'o wrote: > This was added because pulling a mounted a USB thumb drive (or a HDD > drops off the SATA bus) while the file system is mounted and actively > in use, would result in a kernel OOPS. If that's no longer true, > that's great, but it

Re: [PATCH -next RFC 02/14] xen/blkback: use bdev api in xen_update_blkif_status()

2023-12-05 Thread Christoph Hellwig
On Wed, Dec 06, 2023 at 02:56:05PM +0800, Yu Kuai wrote: > > > - invalidate_inode_pages2( > > > - blkif->vbd.bdev_handle->bdev->bd_inode->i_mapping); > > > + invalidate_bdev(blkif->vbd.bdev_handle->bdev); > > > > blkbak is a bdev exported. I don't think it should ever call > >

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Christoph Hellwig
On Wed, Dec 06, 2023 at 02:50:56PM +0800, Yu Kuai wrote: > I'm a litter confused, so there are 3 use cases: > 1) use GFP_USER, default gfp from bdev_alloc. > 2) use GFP_KERNEL > 3) use GFP_NOFS > > I understand that you're suggesting memalloc_nofs_save() to distinguish > 2 and 3, but how can I

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Christoph Hellwig
> +void invalidate_bdev_range(struct block_device *bdev, pgoff_t start, > +pgoff_t end) > +{ > + invalidate_mapping_pages(bdev->bd_inode->i_mapping, start, end); > +} > +EXPORT_SYMBOL_GPL(invalidate_bdev_range); All these could probably use kerneldoc comments. For

Re: [PATCH -next RFC 02/14] xen/blkback: use bdev api in xen_update_blkif_status()

2023-12-05 Thread Christoph Hellwig
On Tue, Dec 05, 2023 at 08:37:16PM +0800, Yu Kuai wrote: > diff --git a/drivers/block/xen-blkback/xenbus.c > b/drivers/block/xen-blkback/xenbus.c > index e34219ea2b05..e645afa4af57 100644 > --- a/drivers/block/xen-blkback/xenbus.c > +++ b/drivers/block/xen-blkback/xenbus.c > @@ -104,8 +104,7 @@

  1   2   3   4   5   6   7   8   9   10   >