aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-05-31 09:48:09 +0200
committerJens Axboe <axboe@kernel.dk>2024-06-14 10:19:44 -0600
commit73e3715ed14844067c5c598e72777641004a7f60 (patch)
tree1dfc2856f39e2b782bf860b1f000bd321d12fdfb /drivers/scsi/sd.c
parent1652b0bafeaa8281ca9a805d81e13d7647bd2f44 (diff)
block: add special APIs for run-time disabling of discard and friends
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 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 <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Nitesh Shetty <nj.shetty@samsung.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20240531074837.1648501-15-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 049071b56819..d957e29b17a9 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -837,7 +837,7 @@ static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd,
static void sd_disable_discard(struct scsi_disk *sdkp)
{
sdkp->provisioning_mode = SD_LBP_DISABLE;
- blk_queue_max_discard_sectors(sdkp->disk->queue, 0);
+ blk_queue_disable_discard(sdkp->disk->queue);
}
static void sd_config_discard(struct scsi_disk *sdkp, struct queue_limits *lim,
@@ -1019,7 +1019,7 @@ static void sd_disable_write_same(struct scsi_disk *sdkp)
{
sdkp->device->no_write_same = 1;
sdkp->max_ws_blocks = 0;
- blk_queue_max_write_zeroes_sectors(sdkp->disk->queue, 0);
+ blk_queue_disable_write_zeroes(sdkp->disk->queue);
}
static void sd_config_write_same(struct scsi_disk *sdkp,