All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] sd fixes for zoned block devices
@ 2017-01-12  6:25 Damien Le Moal
  2017-01-12  6:25 ` [PATCH 1/2] sd: Fix wrong DPOFUA disable in sd_read_cache_type Damien Le Moal
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Damien Le Moal @ 2017-01-12  6:25 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Shaun Tancheff, Hannes Reinecke,
	Damien Le Moal

2 small fixes in this series:
(1) Fix sd_read_cache_type so that DPOFUA is not disabled for zoned block
devices supporting it.
(2) Ignore the zoned field of the block device characteristics page for
host-managed zoned block devices as there is no good match defined explicitely
for HM by the standard.

Damien Le Moal (2):
  sd: Fix wrong DPOFUA disable in sd_read_cache_type
  sd: Ignore zoned field for host-managed devices

 drivers/scsi/sd.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

-- 
2.9.3


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

* [PATCH 1/2] sd: Fix wrong DPOFUA disable in sd_read_cache_type
  2017-01-12  6:25 [PATCH 0/2] sd fixes for zoned block devices Damien Le Moal
@ 2017-01-12  6:25 ` Damien Le Moal
  2017-01-12  6:52   ` Hannes Reinecke
  2017-01-12  6:25 ` [PATCH 2/2] sd: Ignore zoned field for host-managed devices Damien Le Moal
  2017-01-17 19:07 ` [PATCH 0/2] sd fixes for zoned block devices Martin K. Petersen
  2 siblings, 1 reply; 6+ messages in thread
From: Damien Le Moal @ 2017-01-12  6:25 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Shaun Tancheff, Hannes Reinecke,
	Damien Le Moal

Zoned block devices force the use of READ/WRITE(16) commands by setting
sdkp->use_16_for_rw and clearing sdkp->use_10_for_rw. This result in
DPOFUA always being disabled for these drives as the assumed use of
the deprecated READ/WRITE(6) commands only looks at sdkp->use_10_for_rw.
Strenghten the test by also checking that sdkp->use_16_for_rw is false.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/scsi/sd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b193304..d7aaacf 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2600,7 +2600,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
 		if (sdp->broken_fua) {
 			sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n");
 			sdkp->DPOFUA = 0;
-		} else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
+		} else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw &&
+			   !sdkp->device->use_16_for_rw) {
 			sd_first_printk(KERN_NOTICE, sdkp,
 				  "Uses READ/WRITE(6), disabling FUA\n");
 			sdkp->DPOFUA = 0;
-- 
2.9.3


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

* [PATCH 2/2] sd: Ignore zoned field for host-managed devices
  2017-01-12  6:25 [PATCH 0/2] sd fixes for zoned block devices Damien Le Moal
  2017-01-12  6:25 ` [PATCH 1/2] sd: Fix wrong DPOFUA disable in sd_read_cache_type Damien Le Moal
@ 2017-01-12  6:25 ` Damien Le Moal
  2017-01-12  6:53   ` Hannes Reinecke
  2017-01-17 19:07 ` [PATCH 0/2] sd fixes for zoned block devices Martin K. Petersen
  2 siblings, 1 reply; 6+ messages in thread
From: Damien Le Moal @ 2017-01-12  6:25 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Shaun Tancheff, Hannes Reinecke,
	Damien Le Moal

There is no good match of the zoned filed of the block device
characteristics page for host-managed devices. For these devices, the
zoning model is derived directly from the device type. So ignore the
zoned field for these drives.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/scsi/sd.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index d7aaacf..6e6d4a4 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2784,13 +2784,21 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
 		queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q);
 	}
 
-	sdkp->zoned = (buffer[8] >> 4) & 3;
-	if (sdkp->zoned == 1)
-		q->limits.zoned = BLK_ZONED_HA;
-	else if (sdkp->device->type == TYPE_ZBC)
+	if (sdkp->device->type == TYPE_ZBC) {
+		/* Host-managed */
 		q->limits.zoned = BLK_ZONED_HM;
-	else
-		q->limits.zoned = BLK_ZONED_NONE;
+	} else {
+		sdkp->zoned = (buffer[8] >> 4) & 3;
+		if (sdkp->zoned == 1)
+			/* Host-aware */
+			q->limits.zoned = BLK_ZONED_HA;
+		else
+			/*
+			 * Treat drive-managed devices as
+			 * regular block devices.
+			 */
+			q->limits.zoned = BLK_ZONED_NONE;
+	}
 	if (blk_queue_is_zoned(q) && sdkp->first_scan)
 		sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n",
 		      q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");
-- 
2.9.3


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

* Re: [PATCH 1/2] sd: Fix wrong DPOFUA disable in sd_read_cache_type
  2017-01-12  6:25 ` [PATCH 1/2] sd: Fix wrong DPOFUA disable in sd_read_cache_type Damien Le Moal
@ 2017-01-12  6:52   ` Hannes Reinecke
  0 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2017-01-12  6:52 UTC (permalink / raw)
  To: Damien Le Moal, Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Shaun Tancheff

On 01/12/2017 07:25 AM, Damien Le Moal wrote:
> Zoned block devices force the use of READ/WRITE(16) commands by setting
> sdkp->use_16_for_rw and clearing sdkp->use_10_for_rw. This result in
> DPOFUA always being disabled for these drives as the assumed use of
> the deprecated READ/WRITE(6) commands only looks at sdkp->use_10_for_rw.
> Strenghten the test by also checking that sdkp->use_16_for_rw is false.
>
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
>  drivers/scsi/sd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index b193304..d7aaacf 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2600,7 +2600,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
>  		if (sdp->broken_fua) {
>  			sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n");
>  			sdkp->DPOFUA = 0;
> -		} else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
> +		} else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw &&
> +			   !sdkp->device->use_16_for_rw) {
>  			sd_first_printk(KERN_NOTICE, sdkp,
>  				  "Uses READ/WRITE(6), disabling FUA\n");
>  			sdkp->DPOFUA = 0;
>
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 2/2] sd: Ignore zoned field for host-managed devices
  2017-01-12  6:25 ` [PATCH 2/2] sd: Ignore zoned field for host-managed devices Damien Le Moal
@ 2017-01-12  6:53   ` Hannes Reinecke
  0 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2017-01-12  6:53 UTC (permalink / raw)
  To: Damien Le Moal, Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Shaun Tancheff

On 01/12/2017 07:25 AM, Damien Le Moal wrote:
> There is no good match of the zoned filed of the block device
> characteristics page for host-managed devices. For these devices, the
> zoning model is derived directly from the device type. So ignore the
> zoned field for these drives.
>
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
>  drivers/scsi/sd.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index d7aaacf..6e6d4a4 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2784,13 +2784,21 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
>  		queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q);
>  	}
>
> -	sdkp->zoned = (buffer[8] >> 4) & 3;
> -	if (sdkp->zoned == 1)
> -		q->limits.zoned = BLK_ZONED_HA;
> -	else if (sdkp->device->type == TYPE_ZBC)
> +	if (sdkp->device->type == TYPE_ZBC) {
> +		/* Host-managed */
>  		q->limits.zoned = BLK_ZONED_HM;
> -	else
> -		q->limits.zoned = BLK_ZONED_NONE;
> +	} else {
> +		sdkp->zoned = (buffer[8] >> 4) & 3;
> +		if (sdkp->zoned == 1)
> +			/* Host-aware */
> +			q->limits.zoned = BLK_ZONED_HA;
> +		else
> +			/*
> +			 * Treat drive-managed devices as
> +			 * regular block devices.
> +			 */
> +			q->limits.zoned = BLK_ZONED_NONE;
> +	}
>  	if (blk_queue_is_zoned(q) && sdkp->first_scan)
>  		sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n",
>  		      q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");
>
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 0/2] sd fixes for zoned block devices
  2017-01-12  6:25 [PATCH 0/2] sd fixes for zoned block devices Damien Le Moal
  2017-01-12  6:25 ` [PATCH 1/2] sd: Fix wrong DPOFUA disable in sd_read_cache_type Damien Le Moal
  2017-01-12  6:25 ` [PATCH 2/2] sd: Ignore zoned field for host-managed devices Damien Le Moal
@ 2017-01-17 19:07 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2017-01-17 19:07 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Martin K . Petersen, James E . J . Bottomley, linux-scsi,
	Christoph Hellwig, Shaun Tancheff, Hannes Reinecke

>>>>> "Damien" == Damien Le Moal <damien.lemoal@wdc.com> writes:

Damien> 2 small fixes in this series: (1) Fix sd_read_cache_type so that
Damien> DPOFUA is not disabled for zoned block devices supporting it.
Damien> (2) Ignore the zoned field of the block device characteristics
Damien> page for host-managed zoned block devices as there is no good
Damien> match defined explicitely for HM by the standard.

Damien> Damien Le Moal (2): sd: Fix wrong DPOFUA disable in
Damien> sd_read_cache_type sd: Ignore zoned field for host-managed
Damien> devices

Applied to 4.10/scsi-fixes.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2017-01-17 19:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12  6:25 [PATCH 0/2] sd fixes for zoned block devices Damien Le Moal
2017-01-12  6:25 ` [PATCH 1/2] sd: Fix wrong DPOFUA disable in sd_read_cache_type Damien Le Moal
2017-01-12  6:52   ` Hannes Reinecke
2017-01-12  6:25 ` [PATCH 2/2] sd: Ignore zoned field for host-managed devices Damien Le Moal
2017-01-12  6:53   ` Hannes Reinecke
2017-01-17 19:07 ` [PATCH 0/2] sd fixes for zoned block devices Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.