[T10] WRITE SAME and 0 LBA counts

Black, David david.black at emc.com
Wed May 18 18:08:14 PDT 2016


> A wsnz bit value of one with a number of logical blocks field value of zero does promise failure,

> but there seems to be no definitive result with a wsnz bit value of zero.

That is correct and was deliberate -the WSNZ bit is specified as a "disable" bit to explicitly allow implementations to claim support for WRITE SAME commands without having to support the zero behavior of writing to the end of the medium.   There was no interest in an "enable" bit or field value at the time.

As for the original question:


> When the spec says "number of logical blocks specified to be [...] written" is this only in reference to the NUMBER OF LOGICAL BLOCKS

> passed in rather than the computed number of blocks to be written or is there a choice over which is used (i.e. the target can pick

> whether it errors or not if the computed blocks exceed the MAXIMUM WRITE SAME LENGTH)?

Neither - my reading of the current SBC-4 text is that the limit always applies to the number of blocks written by the command, but a careful reading of the text is involved to reach that conclusion.  Excerpts that follow are from 5.47 WRITE SAME (10) in SBC-4 rev 10:

If the WSNZ bit is set to zero, then a NUMBER OF LOGICAL BLOCKS field set to zero specifies that the number of
contiguous logical blocks that are requested to be unmapped or written includes all of the logical blocks
starting with the LBA specified in the LOGICAL BLOCK ADDRESS field to the last logical block on the medium.

Note the use of "specifies" in the first line.

If the number of logical blocks specified to be unmapped or written exceeds the value indicated in the
MAXIMUM WRITE SAME LENGTH field (see 6.6.4), then the device server shall
terminate the command with CHECK CONDITION status with the sense key set to ILLEGAL REQUEST and
the additional sense code set to INVALID FIELD IN CDB.

Note the use of "specified" in the first line.

So, a NUMBER OF LOGICAL BLOCKS field set to zero specifies that all of the logical blocks up to the end of the medium are to be unmapped or written, and if that (computed) number of logical blocks exceeds the MAXIMUM WRITE SAME LENGTH value, the required result is CHECK CONDITION, ILLEGAL REQUEST, INVALID FIELD IN CDB.


> For example, if I have an *SBC-3* 1GByte target with a WSNZ of 0 and a MAXIMUM WRITE SAME LENGTH of 131072 blocks

> (64Mbytes with a sector size of 512), then I issue a WRITE SAME with NUMBER OF LOGICAL BLOCKS of 0 and a

> LOGICAL BLOCK ADDRESS of 0 is it legal for the SBC-3 target to produce an error because the computed number of

> blocks to be written will be greater than 131072?

That is not only "legal", it is also the behavior required by the standard.

I believe the standard is unambiguous as written, but I'd support an editorial clarification to reduce the degree of careful reading required to reach that conclusion.

Thanks, --David

From: t10-bounces at t10.org [mailto:t10-bounces at t10.org] On Behalf Of John Geldman (jgeldman)
Sent: Wednesday, May 18, 2016 3:05 AM
To: Sitsofe Wheeler; t10 at t10.org
Subject: Re: [T10] WRITE SAME and 0 LBA counts


All,



What I see in SBC4r10 is a bit more problematic:
A write same non-zero (WSNZ) bit set to one indicates that the device server does not support a value of zero in the NUMBER OF LOGICAL BLOCKS field in the WRITE SAME command CDBs.
A WSNZ bit set to zero indicates that the device server may or may not support a value of zero in the NUMBER OF LOGICAL BLOCKS field of the WRITE SAME commands.



A wsnz bit value of one with a number of logical blocks field value of zero does promise failure, but there seems to be no definitive result with a wsnz bit value of zero.



One solution approach would be to clarify the standard to:

a)      allow both reported rejection and attempted processing if the host specifies  a number of logical blocks field value of zero when the wsnz bit value is zero; and

b)      allow both reported rejection and attempted processing if the host specifies  a number of logical blocks field value of zero when the wsnz bit value is zero and the actual affected block count would exceed the value of the maximum write same length field.







Thank you,

John Geldman



[cid:image001.png at 01D123AF.225CEFA0]<http://www.micron.com/>
John Geldman
Director, Industry Standards,

Micron Technology, Inc.
Office +1 (408) 822-0348  Mobile +1 (510) 449-3597

jgeldman at micron.com<mailto:jgeldman at micron.com>






-----Original Message-----
From: t10-bounces at t10.org<mailto:t10-bounces at t10.org> [mailto:t10-bounces at t10.org] On Behalf Of Sitsofe Wheeler
Sent: Tuesday, May 17, 2016 10:37 PM
To: t10 at t10.org<mailto:t10 at t10.org>
Subject: [T10] WRITE SAME and 0 LBA counts



According to SBC specs if the target's WSNZ bit is 0 and the WRITES SAME's NUMBER OF LOGICAL BLOCKS is set to 0 then the LBA from the LOGICAL BLOCK ADDRESS field to the last logical block on the medium should be written. However, it also says if the number of logical blocks specified to be written exceeds the MAXIMUM WRITE SAME LENGTH a CHECK CONDITION/ILLEGAL REQUEST/INVALID FIELD IN CDB should be raised.



When the spec says "number of logical blocks specified to be [...] written" is this only in reference to the NUMBER OF LOGICAL BLOCKS passed in rather than the computed number of blocks to be written or is there a choice over which is used (i.e. the target can pick whether it errors or not if the computed blocks exceed the MAXIMUM WRITE SAME LENGTH)?



For example, if I have an *SBC-3* 1GByte target with a WSNZ of 0 and a MAXIMUM WRITE SAME LENGTH of 131072 blocks (64Mbytes with a sector size of 512), then I issue a WRITE SAME with NUMBER OF LOGICAL BLOCKS of 0 and a LOGICAL BLOCK ADDRESS of 0 is it legal for the SBC-3 target to produce an error because the computed number of blocks to be written will be greater than 131072?



--

Sitsofe | http://sucs.org/~sits/

_______________________________________________

T10 mailing list

T10 at t10.org<mailto:T10 at t10.org>

http://www.t10.org/mailman/listinfo/t10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.t10.org/pipermail/t10/attachments/20160519/5112c667/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 6277 bytes
Desc: image001.png
URL: <http://www.t10.org/pipermail/t10/attachments/20160519/5112c667/attachment.png>


More information about the T10 mailing list