aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChristoph Hellwig2023-12-17 17:53:58 +0100
committerJens Axboe2023-12-19 20:17:43 -0700
commitd73e93b4dfab10c80688b061c30048df05585c7e (patch)
tree64fe5d6da0ad0053c9d42f6356ec2032e928024c /drivers/scsi
parent7437bb73f087e5f216f9c6603f5149d354e315af (diff)
block: simplify disk_set_zoned
Only use disk_set_zoned to actually enable zoned device support. For clearing it, call disk_clear_zoned, which is renamed from disk_clear_zone_settings and now directly clears the zoned flag as well. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20231217165359.604246-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 19a19eb277f5..dbed075cdb98 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3135,11 +3135,13 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
}
+
+#ifdef CONFIG_BLK_DEV_ZONED /* sd_probe rejects ZBD devices early otherwise */
if (sdkp->device->type == TYPE_ZBC) {
/*
* Host-managed.
*/
- disk_set_zoned(sdkp->disk, true);
+ disk_set_zoned(sdkp->disk);
/*
* Per ZBC and ZAC specifications, writes in sequential write
@@ -3152,8 +3154,9 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
* Anything else. This includes host-aware device that we treat
* as conventional.
*/
- disk_set_zoned(sdkp->disk, false);
+ disk_clear_zoned(sdkp->disk);
}
+#endif /* CONFIG_BLK_DEV_ZONED */
if (!sdkp->first_scan)
return;