Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] sd_zbc: Force use of READ16/WRITE16
@ 2016-11-11  5:53 Damien Le Moal
  2016-11-14 16:10 ` Christoph Hellwig
  2016-11-14 20:17 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Damien Le Moal @ 2016-11-11  5:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, linux-scsi, Christoph Hellwig, Martin K . Petersen,
	Hannes Reinecke, Shaun Tancheff, Damien Le Moal

Normally, sd_read_capacity sets sdp->use_16_for_rw to 1 based on the
disk capacity so that READ16/WRITE16 are used for large drives.
However, for a zoned disk with RC_BASIS set to 0, the capacity reported
through READ_CAPACITY may be very small, leading to use_16_for_rw not being
set and READ10/WRITE10 commands being used, even after the actual zoned disk
capacity is corrected in sd_zbc_read_zones. This causes LBA offset overflow for
accesses beyond 2TB.

As the ZBC standard makes it mandatory for ZBC drives to support
the READ16/WRITE16 commands anyway, make sure that use_16_for_rw is set.

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

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 394ab49..92620c8 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -612,6 +612,10 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp,
 	if (ret)
 		goto err;
 
+	/* READ16/WRITE16 is mandatory for ZBC disks */
+	sdkp->device->use_16_for_rw = 1;
+	sdkp->device->use_10_for_rw = 0;
+
 	return 0;
 
 err:
-- 
2.7.4


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

* Re: [PATCH] sd_zbc: Force use of READ16/WRITE16
  2016-11-11  5:53 [PATCH] sd_zbc: Force use of READ16/WRITE16 Damien Le Moal
@ 2016-11-14 16:10 ` Christoph Hellwig
  2016-11-14 20:17 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2016-11-14 16:10 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Jens Axboe, linux-block, linux-scsi, Christoph Hellwig,
	Martin K . Petersen, Hannes Reinecke, Shaun Tancheff

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] sd_zbc: Force use of READ16/WRITE16
  2016-11-11  5:53 [PATCH] sd_zbc: Force use of READ16/WRITE16 Damien Le Moal
  2016-11-14 16:10 ` Christoph Hellwig
@ 2016-11-14 20:17 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2016-11-14 20:17 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: linux-block, linux-scsi, Christoph Hellwig, Martin K . Petersen,
	Hannes Reinecke, Shaun Tancheff

On 11/10/2016 10:53 PM, Damien Le Moal wrote:
> Normally, sd_read_capacity sets sdp->use_16_for_rw to 1 based on the
> disk capacity so that READ16/WRITE16 are used for large drives.
> However, for a zoned disk with RC_BASIS set to 0, the capacity reported
> through READ_CAPACITY may be very small, leading to use_16_for_rw not being
> set and READ10/WRITE10 commands being used, even after the actual zoned disk
> capacity is corrected in sd_zbc_read_zones. This causes LBA offset overflow for
> accesses beyond 2TB.
>
> As the ZBC standard makes it mandatory for ZBC drives to support
> the READ16/WRITE16 commands anyway, make sure that use_16_for_rw is set.

Added to the 4.10 branch, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2016-11-14 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-11  5:53 [PATCH] sd_zbc: Force use of READ16/WRITE16 Damien Le Moal
2016-11-14 16:10 ` Christoph Hellwig
2016-11-14 20:17 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox