From d73e93b4dfab10c80688b061c30048df05585c7e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 17 Dec 2023 17:53:58 +0100 Subject: 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 Reviewed-by: Damien Le Moal Reviewed-by: Martin K. Petersen Link: https://lore.kernel.org/r/20231217165359.604246-5-hch@lst.de Signed-off-by: Jens Axboe --- drivers/scsi/sd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/scsi') 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; -- cgit v1.2.3