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. Ye

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

2024-05-31 Thread Martin K. Petersen
Christoph, > The patches are against Jens' block-6.10 tree. Due to the amount of > block layer changes in here, and other that will depend on it, it > would be good if this could eventually be merged through the block > tree, or at least a shared branch between the SCSI and block trees. If you

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

2024-05-31 Thread Nitesh Shetty
On 31/05/24 09:48AM, Christoph Hellwig wrote: A few drivers optimistically try to support discard, write zeroes and secure erase and disable the features from the I/O completion handler if the hardware can't support them. This disable can't be done using the atomic queue limits API because the I

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

2024-05-31 Thread John Garry
On 31/05/2024 08:48, Christoph Hellwig wrote: 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 l

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

2024-05-31 Thread John Garry
On 31/05/2024 08:47, Christoph Hellwig wrote: Hi all, Just saying that b4 for some reason does not create a .mbox to apply for this series when using "b4 am". It also no longer does for v1 (when it did previously). I guess that the series versioning confused it. this series converts the S

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

2024-05-31 Thread John Garry
On 31/05/2024 08:48, Christoph Hellwig wrote: A few drivers optimistically try to support discard, write zeroes and secure erase and disable the features from the I/O completion handler if the hardware can't support them. This disable can't be done using the atomic queue limits API because the I

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

2024-05-31 Thread John Garry
On 31/05/2024 08:48, Christoph Hellwig wrote: 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 Reviewed-by: John Garry

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

2024-05-31 Thread John Garry
On 29/05/2024 06:04, Christoph Hellwig wrote: 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: John Garry

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

2024-05-31 Thread John Garry
On 29/05/2024 06:04, Christoph Hellwig wrote: A few drivers optimistically try to support discard, write zeroes and secure erase and disable the features from the I/O completion handler if the hardware can't support them. This disable can't be done using the atomic queue limits API because the I

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

2024-05-31 Thread Ilya Dryomov
On Fri, May 31, 2024 at 9:48 AM Christoph Hellwig wrote: > > The soft max_sectors limit is normally capped by the hardware limits and > an arbitrary upper limit enforced by the kernel, but can be modified by > the user. A few drivers want to increase this limit (nbd, rbd) or > adjust it up or dow

Re: [PATCH 03/14] rbd: increase io_opt again

2024-05-31 Thread Ilya Dryomov
On Fri, May 31, 2024 at 9:48 AM Christoph Hellwig wrote: > > Commit 16d80c54ad42 ("rbd: set io_min, io_opt and discard_granularity to > alloc_size") lowered the io_opt size for rbd from objset_bytes which is > 4MB for typical setup to alloc_size which is typically 64KB. > > The commit mostly talks

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

2024-05-31 Thread Christoph Hellwig
A few drivers optimistically try to support discard, write zeroes and secure erase and disable the features from the I/O completion handler if the hardware can't support them. This disable can't be done using the atomic queue limits API because the I/O completion handlers can't take sleeping locks

[PATCH 12/14] sr: 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 free the queue when updating them so that in-progress I/O submissions don't see half-updated limits. Also use the chance to clean up variable n

[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 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 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 Review

[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 d

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

2024-05-31 Thread Christoph Hellwig
Add helper to disable WRITE SAME when it is not supported and use it instead of sd_config_write_same 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: Chris

[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 in

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

2024-05-31 Thread Christoph Hellwig
Don't reset the discard settings to no-op over and over when a user writes to the provisioning attribute as that is already the default mode for ZBC devices. In hindsight we should have made writing to the attribute fail for ZBC devices, but the code has probably been around for far too long to ch

[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 He

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

2024-05-31 Thread Christoph Hellwig
The soft max_sectors limit is normally capped by the hardware limits and an arbitrary upper limit enforced by the kernel, but can be modified by the user. A few drivers want to increase this limit (nbd, rbd) or adjust it up or down based on hardware capabilities (sd). Change blk_validate_limits t

[PATCH 03/14] rbd: increase io_opt again

2024-05-31 Thread Christoph Hellwig
Commit 16d80c54ad42 ("rbd: set io_min, io_opt and discard_granularity to alloc_size") lowered the io_opt size for rbd from objset_bytes which is 4MB for typical setup to alloc_size which is typically 64KB. The commit mostly talks about discard behavior and does mention io_min in passing. Reducing

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 th

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

2024-05-31 Thread Christoph Hellwig
Discard and Write Zeroes are different operation and implemented by different fallocate opcodes for ubd. If one fails the other one can work and vice versa. Split the code to disable the operations in ubd_handler to only disable the operation that actually failed. Fixes: 50109b5a03b4 ("um: Add s

[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 ++--