Skip to contentSkip to conversation

remove another host aware model leftover

PATCH In review Christoph Hellwig 5 participants 13 messages Dec 28, 2023 – Jan 8, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

now that support for the host aware zoned model is gone in the for-6.8/block branch, there is no way the sd driver can find a device where is has to clear the zoned flag, and we can thus remove the code for it, including a block layer helper.

Diffstat:

 block/blk-zoned.c      |   21 ---------------------
 drivers/scsi/sd.c      |    7 +++----
 include/linux/blkdev.h |    1 -
 3 files changed, 3 insertions(+), 26 deletions(-)
#1 lore raw

PATCH 1/2 sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics

Now that host-aware devices are always treated as conventional this case can't happen.

---
 drivers/scsi/sd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/sd.c +3 -4
index 6bedd2d5298f6d..dace4aa8e3534d 100644
@@ -3149,12 +3149,11 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
 		 * the device physical block size.
 		 */
 		blk_queue_zone_write_granularity(q, sdkp->physical_block_size);
-	} else if (blk_queue_is_zoned(q)) {
+	} else {
 		/*
-		 * Anything else.  This includes host-aware device that we treat
-		 * as conventional.
+		 * Host-aware devices are treated as conventional.
 		 */
-		disk_clear_zoned(sdkp->disk);
+		WARN_ON_ONCE(blk_queue_is_zoned(q));
 	}
 #endif /* CONFIG_BLK_DEV_ZONED */
 
Signature · 1 line
2.39.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics

Quoted 18 lines · Christoph Hellwig

Now that host-aware devices are always treated as conventional this case can't happen.

---
  drivers/scsi/sd.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/sd.c +1 -1
index 6bedd2d5298f6d..dace4aa8e3534d 100644
@@ -3149,12 +3149,11 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
  		 * the device physical block size.
  		 */
  		blk_queue_zone_write_granularity(q, sdkp->physical_block_size);
-	} else if (blk_queue_is_zoned(q)) {
+	} else {

drivers/scsi/sd.c static void sd_read_block_characteristics(struct scsi_disk *sdkp) · line 3159

Quoted 10 lines
drivers/scsi/sd.c +2 -3
  		/*
-		 * Anything else.  This includes host-aware device that we treat
-		 * as conventional.
+		 * Host-aware devices are treated as conventional.
  		 */
-		disk_clear_zoned(sdkp->disk);
+		WARN_ON_ONCE(blk_queue_is_zoned(q));
  	}
  #endif /* CONFIG_BLK_DEV_ZONED */
 

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Ivo Totev, Andrew McDonald,
Werner Knoblich
#3 lore raw

PATCH 2/2 block: remove disk_clear_zoned

In reply to Christoph Hellwig

disk_clear_zoned is unused now that the last warts of the host-aware model support in sd are gone.

---
 block/blk-zoned.c      | 21 ---------------------
 include/linux/blkdev.h |  1 -
 2 files changed, 22 deletions(-)
block/blk-zoned.c +0 -21
index c59d44ee6b236e..623879d875a43f 100644
@@ -615,24 +615,3 @@ int blk_revalidate_disk_zones(struct gendisk *disk,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones);
-
-void disk_clear_zoned(struct gendisk *disk)
-{
-	struct request_queue *q = disk->queue;
-
-	blk_mq_freeze_queue(q);
-
-	q->limits.zoned = false;
-	disk_free_zone_bitmaps(disk);
-	blk_queue_flag_clear(QUEUE_FLAG_ZONE_RESETALL, q);
-	q->required_elevator_features &= ~ELEVATOR_F_ZBD_SEQ_WRITE;
-	disk->nr_zones = 0;
-	disk->max_open_zones = 0;
-	disk->max_active_zones = 0;
-	q->limits.chunk_sectors = 0;
-	q->limits.zone_write_granularity = 0;
-	q->limits.max_zone_append_sectors = 0;
-
-	blk_mq_unfreeze_queue(q);
-}
-EXPORT_SYMBOL_GPL(disk_clear_zoned);
include/linux/blkdev.h +0 -1
index 9f9fbc22c4b037..de944baddd6036 100644
@@ -318,7 +318,6 @@ typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx,
 			       void *data);
 
 void disk_set_zoned(struct gendisk *disk);
-void disk_clear_zoned(struct gendisk *disk);
 
 #define BLK_ALL_ZONES  ((unsigned int)-1)
 int blkdev_report_zones(struct block_device *bdev, sector_t sector,
Signature · 1 line
2.39.2
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] block: remove disk_clear_zoned

Quoted 9 lines · Christoph Hellwig

disk_clear_zoned is unused now that the last warts of the host-aware model support in sd are gone.

---
  block/blk-zoned.c      | 21 ---------------------
  include/linux/blkdev.h |  1 -
  2 files changed, 22 deletions(-)

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Ivo Totev, Andrew McDonald,
Werner Knoblich
maintainer
#5 lore raw
In reply to Christoph Hellwig
Quoted 6 lines · Christoph Hellwig

Hi all,

now that support for the host aware zoned model is gone in the for-6.8/block branch, there is no way the sd driver can find a device where is has to clear the zoned flag, and we can thus remove the code for it, including a block layer helper.

Hmmm... There is one case: if the user uses a passthrough command to issue a FORMAT WITH PRESET command to reformat the disk from SMR to CMR or from CMR to SMR. The next revalidate will see a different device type in this case, and SMR-to-CMR reformat will need clearing the zoned stuff.

Quoted 7 lines

Diffstat:

 block/blk-zoned.c      |   21 ---------------------
 drivers/scsi/sd.c      |    7 +++----
 include/linux/blkdev.h |    1 -
 3 files changed, 3 insertions(+), 26 deletions(-)
Signature · 2 lines
Damien Le Moal
Western Digital Research
#6 lore raw
Quoted 8 lines · Damien Le Moal
Quoted 6 lines · Christoph Hellwig

Hi all,

now that support for the host aware zoned model is gone in the for-6.8/block branch, there is no way the sd driver can find a device where is has to clear the zoned flag, and we can thus remove the code for it, including a block layer helper.

Quoted 4 lines

Hmmm... There is one case: if the user uses a passthrough command to issue a FORMAT WITH PRESET command to reformat the disk from SMR to CMR or from CMR to SMR. The next revalidate will see a different device type in this case, and SMR-to-CMR reformat will need clearing the zoned stuff.

scsi_device.type is only set in scsi_add_lun and thus can't change without a re-probe of the upper level driver.

maintainer Reviewed-by
#7 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · Damien Le Moal
Quoted 6 lines · Christoph Hellwig

Hi all,

now that support for the host aware zoned model is gone in the for-6.8/block branch, there is no way the sd driver can find a device where is has to clear the zoned flag, and we can thus remove the code for it, including a block layer helper.

Quoted 7 lines
Quoted 4 lines

Hmmm... There is one case: if the user uses a passthrough command to issue a FORMAT WITH PRESET command to reformat the disk from SMR to CMR or from CMR to SMR. The next revalidate will see a different device type in this case, and SMR-to-CMR reformat will need clearing the zoned stuff.

scsi_device.type is only set in scsi_add_lun and thus can't change without a re-probe of the upper level driver.

OK. I was worried about what might happen with libata/libsas drives, but checking the code, ata_dev_same_device() throws an error from ata_reread_id() if the device class (device type) changes. So that will force the user to do a full rescan for this corner case. I think we are OK.

Feel free to add:

for the series.

Signature · 2 lines
Damien Le Moal
Western Digital Research
maintainer
#9 lore raw
Quoted 4 lines · Christoph Hellwig

Jens, Martin,

can you take a look at this? It would be great to finish the zone aware removal fully with this for 6.8. Thanks!

Looks fine to me and I can queue it up. I'll do so preemptively, Martin let me know if you have concerns and I can drop it from top-of-tree.

Signature · 1 line
Jens Axboe
Reviewed-by
#10 lore raw

Jens,

Quoted 6 lines
Quoted 2 lines

can you take a look at this? It would be great to finish the zone aware removal fully with this for 6.8. Thanks!

Looks fine to me and I can queue it up. I'll do so preemptively, Martin let me know if you have concerns and I can drop it from top-of-tree.

It was addressed to you so I assumed you'd be picking it up. Looks good to me.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
maintainer
#11 lore raw
Quoted 6 lines · Martin K. Petersen

Jens,

Quoted 3 lines
Quoted 2 lines

can you take a look at this? It would be great to finish the zone aware removal fully with this for 6.8. Thanks!

Quoted 8 lines
Quoted 3 lines

Looks fine to me and I can queue it up. I'll do so preemptively, Martin let me know if you have concerns and I can drop it from top-of-tree.

It was addressed to you so I assumed you'd be picking it up. Looks good to me.

Thanks!

Signature · 1 line
Jens Axboe
maintainer Applied
#12 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

now that support for the host aware zoned model is gone in the for-6.8/block branch, there is no way the sd driver can find a device where is has to clear the zoned flag, and we can thus remove the code for it, including a block layer helper.

Quoted 7 lines

Diffstat:

 block/blk-zoned.c      |   21 ---------------------
 drivers/scsi/sd.c      |    7 +++----
 include/linux/blkdev.h |    1 -
 3 files changed, 3 insertions(+), 26 deletions(-)

[...]

Applied, thanks!

[1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics

      commit: 6945a1804e5c2a3382232a8d6c2143930b833362
[2/2] block: remove disk_clear_zoned
      commit: 4e33b071bb8e8415fb9847249ffcf300fa7d8cac

Best regards,

Signature · 1 line
Jens Axboe