linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* remove another host aware model leftover
@ 2023-12-28  7:51 Christoph Hellwig
  2023-12-28  7:51 ` [PATCH 1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Christoph Hellwig @ 2023-12-28  7:51 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi

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(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics
  2023-12-28  7:51 remove another host aware model leftover Christoph Hellwig
@ 2023-12-28  7:51 ` Christoph Hellwig
  2024-01-08  8:48   ` Hannes Reinecke
  2023-12-28  7:51 ` [PATCH 2/2] block: remove disk_clear_zoned Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2023-12-28  7:51 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/sd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 6bedd2d5298f6d..dace4aa8e3534d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -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 */
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] block: remove disk_clear_zoned
  2023-12-28  7:51 remove another host aware model leftover Christoph Hellwig
  2023-12-28  7:51 ` [PATCH 1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics Christoph Hellwig
@ 2023-12-28  7:51 ` Christoph Hellwig
  2024-01-08  8:48   ` Hannes Reinecke
  2023-12-28  8:45 ` remove another host aware model leftover Damien Le Moal
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2023-12-28  7:51 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-zoned.c      | 21 ---------------------
 include/linux/blkdev.h |  1 -
 2 files changed, 22 deletions(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index c59d44ee6b236e..623879d875a43f 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -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);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 9f9fbc22c4b037..de944baddd6036 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: remove another host aware model leftover
  2023-12-28  7:51 remove another host aware model leftover Christoph Hellwig
  2023-12-28  7:51 ` [PATCH 1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics Christoph Hellwig
  2023-12-28  7:51 ` [PATCH 2/2] block: remove disk_clear_zoned Christoph Hellwig
@ 2023-12-28  8:45 ` Damien Le Moal
  2023-12-28 17:14   ` Christoph Hellwig
  2024-01-08  8:24 ` Christoph Hellwig
  2024-01-08 15:27 ` Jens Axboe
  4 siblings, 1 reply; 13+ messages in thread
From: Damien Le Moal @ 2023-12-28  8:45 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi

On 12/28/23 16:51, Christoph Hellwig wrote:
> 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.

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

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: remove another host aware model leftover
  2023-12-28  8:45 ` remove another host aware model leftover Damien Le Moal
@ 2023-12-28 17:14   ` Christoph Hellwig
  2024-01-03  0:02     ` Damien Le Moal
  0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2023-12-28 17:14 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Christoph Hellwig, Jens Axboe, Martin K. Petersen, Damien Le Moal,
	linux-block, linux-scsi

On Thu, Dec 28, 2023 at 05:45:29PM +0900, Damien Le Moal wrote:
> On 12/28/23 16:51, Christoph Hellwig wrote:
> > 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.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: remove another host aware model leftover
  2023-12-28 17:14   ` Christoph Hellwig
@ 2024-01-03  0:02     ` Damien Le Moal
  0 siblings, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2024-01-03  0:02 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K. Petersen, Damien Le Moal, linux-block,
	linux-scsi

On 12/29/23 02:14, Christoph Hellwig wrote:
> On Thu, Dec 28, 2023 at 05:45:29PM +0900, Damien Le Moal wrote:
>> On 12/28/23 16:51, Christoph Hellwig wrote:
>>> 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.
> 
> 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:

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

for the series.

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: remove another host aware model leftover
  2023-12-28  7:51 remove another host aware model leftover Christoph Hellwig
                   ` (2 preceding siblings ...)
  2023-12-28  8:45 ` remove another host aware model leftover Damien Le Moal
@ 2024-01-08  8:24 ` Christoph Hellwig
  2024-01-08 15:26   ` Jens Axboe
  2024-01-08 15:27 ` Jens Axboe
  4 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2024-01-08  8:24 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi

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!


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics
  2023-12-28  7:51 ` [PATCH 1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics Christoph Hellwig
@ 2024-01-08  8:48   ` Hannes Reinecke
  0 siblings, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2024-01-08  8:48 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi

On 12/28/23 08:51, Christoph Hellwig wrote:
> Now that host-aware devices are always treated as conventional this case
> can't happen.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/scsi/sd.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 6bedd2d5298f6d..dace4aa8e3534d 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -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 */
>   
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] block: remove disk_clear_zoned
  2023-12-28  7:51 ` [PATCH 2/2] block: remove disk_clear_zoned Christoph Hellwig
@ 2024-01-08  8:48   ` Hannes Reinecke
  0 siblings, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2024-01-08  8:48 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi

On 12/28/23 08:51, Christoph Hellwig wrote:
> disk_clear_zoned is unused now that the last warts of the host-aware
> model support in sd are gone.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   block/blk-zoned.c      | 21 ---------------------
>   include/linux/blkdev.h |  1 -
>   2 files changed, 22 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: remove another host aware model leftover
  2024-01-08  8:24 ` Christoph Hellwig
@ 2024-01-08 15:26   ` Jens Axboe
  2024-01-08 16:14     ` Martin K. Petersen
  0 siblings, 1 reply; 13+ messages in thread
From: Jens Axboe @ 2024-01-08 15:26 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi

On 1/8/24 1:24 AM, Christoph Hellwig wrote:
> 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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: remove another host aware model leftover
  2023-12-28  7:51 remove another host aware model leftover Christoph Hellwig
                   ` (3 preceding siblings ...)
  2024-01-08  8:24 ` Christoph Hellwig
@ 2024-01-08 15:27 ` Jens Axboe
  4 siblings, 0 replies; 13+ messages in thread
From: Jens Axboe @ 2024-01-08 15:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Martin K. Petersen, Damien Le Moal, linux-block, linux-scsi


On Thu, 28 Dec 2023 07:51:39 +0000, Christoph Hellwig wrote:
> 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(-)
> 
> [...]

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,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: remove another host aware model leftover
  2024-01-08 15:26   ` Jens Axboe
@ 2024-01-08 16:14     ` Martin K. Petersen
  2024-01-08 19:16       ` Jens Axboe
  0 siblings, 1 reply; 13+ messages in thread
From: Martin K. Petersen @ 2024-01-08 16:14 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, Martin K. Petersen, Damien Le Moal,
	linux-block, linux-scsi


Jens,

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

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: remove another host aware model leftover
  2024-01-08 16:14     ` Martin K. Petersen
@ 2024-01-08 19:16       ` Jens Axboe
  0 siblings, 0 replies; 13+ messages in thread
From: Jens Axboe @ 2024-01-08 19:16 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, Damien Le Moal, linux-block, linux-scsi

On 1/8/24 9:14 AM, Martin K. Petersen wrote:
> 
> Jens,
> 
>>> 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.
> 
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

Thanks!

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-01-08 19:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-28  7:51 remove another host aware model leftover Christoph Hellwig
2023-12-28  7:51 ` [PATCH 1/2] sd: remove the !ZBC && blk_queue_is_zoned case in sd_read_block_characteristics Christoph Hellwig
2024-01-08  8:48   ` Hannes Reinecke
2023-12-28  7:51 ` [PATCH 2/2] block: remove disk_clear_zoned Christoph Hellwig
2024-01-08  8:48   ` Hannes Reinecke
2023-12-28  8:45 ` remove another host aware model leftover Damien Le Moal
2023-12-28 17:14   ` Christoph Hellwig
2024-01-03  0:02     ` Damien Le Moal
2024-01-08  8:24 ` Christoph Hellwig
2024-01-08 15:26   ` Jens Axboe
2024-01-08 16:14     ` Martin K. Petersen
2024-01-08 19:16       ` Jens Axboe
2024-01-08 15:27 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).