aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--README2
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg_readcap.88
-rw-r--r--doc/sg_write_same.832
-rw-r--r--sg3_utils.spec4
-rw-r--r--src/sg_readcap.c7
-rw-r--r--src/sg_vpd.c40
8 files changed, 59 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index a8522c23..602543c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,8 +2,9 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for sg3_utils-1.31 [20110110] [svn: r373]
+Changelog for sg3_utils-1.31 [20110122] [svn: r374]
- sg_decode_sense: new utility to decode sense data
+ - sg_vpd: LB provisioning + Block limits pages (sbc3r26)
- sync asc/ascq and version descriptors with spc4r28
- sg_lib: implement forwarded sense data descriptor
- sg_lib, sg_turs, sg_format: more precision for progress
diff --git a/README b/README
index 1a53a150..5a6012ec 100644
--- a/README
+++ b/README
@@ -348,4 +348,4 @@ See http://sg.danny.cz/sg/tools.html
Doug Gilbert
-10th January 2011
+22nd January 2011
diff --git a/debian/changelog b/debian/changelog
index 558fb82a..8577206b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.31-0.1) unstable; urgency=low
* New upstream version
- -- Doug Gilbert <dgilbert@interlog.com> Mon, 10 Jan 2011 15:00:00 +0100
+ -- Doug Gilbert <dgilbert@interlog.com> Sat, 22 Jan 2011 17:30:00 +0100
sg3-utils (1.30-0.1) unstable; urgency=low
diff --git a/doc/sg_readcap.8 b/doc/sg_readcap.8
index 005625a0..a52f329f 100644
--- a/doc/sg_readcap.8
+++ b/doc/sg_readcap.8
@@ -1,4 +1,4 @@
-.TH SG_READCAP "8" "October 2010" "sg3_utils\-1.30" SG3_UTILS
+.TH SG_READCAP "8" "January 2011" "sg3_utils\-1.31" SG3_UTILS
.SH NAME
sg_readcap \- sends a SCSI READ CAPACITY command
.SH SYNOPSIS
@@ -66,6 +66,7 @@ will yield the last block address after \fILBA\fR prior to a delay. For a
disk, given a \fILBA\fR it yields the highest numbered block on the same
cylinder (i.e. before the heads need to move). \fILBA\fR is assumed to be
decimal unless prefixed by "0x" or it has a trailing "h". Defaults to 0.
+This option was made obsolete in SBC\-3 revision 26.
.TP
\fB\-l\fR, \fB\-\-long\fR
Use the 16 byte cdb variant of the READ CAPACITY command. The default
@@ -85,7 +86,8 @@ switch to older style options.
partial medium indicator: for finding the next block address prior to
some delay (e.g. head movement). In the absence of this option, the
total number of blocks and the block size of the device are output.
-Used in conjunction with the \fI\-\-lba=LBA\fR option.
+Used in conjunction with the \fI\-\-lba=LBA\fR option. This option was
+made obsolete in SBC\-3 revision 26.
.TP
\fB\-r\fR, \fB\-\-raw\fR
output response in binary to stdout.
@@ -155,7 +157,7 @@ outputs version string then exits.
.SH AUTHORS
Written by Douglas Gilbert
.SH COPYRIGHT
-Copyright \(co 1999\-2010 Douglas Gilbert
+Copyright \(co 1999\-2011 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/doc/sg_write_same.8 b/doc/sg_write_same.8
index d6754398..01edfa07 100644
--- a/doc/sg_write_same.8
+++ b/doc/sg_write_same.8
@@ -1,4 +1,4 @@
-.TH SG_WRITE_SAME "8" "November 2010" "sg3_utils\-1.30" SG3_UTILS
+.TH SG_WRITE_SAME "8" "January 2011" "sg3_utils\-1.31" SG3_UTILS
.SH NAME
sg_write_same \- send the SCSI WRITE SAME command
.SH SYNOPSIS
@@ -31,10 +31,11 @@ or the \fI\-\-unmap\fR option is given then WRITE SAME(16) is sent.
The \fI\-\-10\fR, \fI\-\-16\fR and \fI\-\-32\fR options are mutually
exclusive.
.PP
-As of SBC\-3 revision 24 the UNMAP and ANCHOR bits are not supported by
-WRITE SAME (10). However there is a proposal to allow that case and
-this utility now allows those bits to be set for WRITE SAME (10) when
-the \fI\-\-10\fR is given.
+In SBC\-3 revision 26 the UNMAP and ANCHOR bits were added to the
+WRITE SAME (10) command. Since the UNMAP bit has been in WRITE SAME (16)
+and WRITE SAME (32) since SBC\-3 revision 18, the lower of the two (i.e.
+WRITE SAME (16)) is the default when the \fI\-\-unmap\fR option is given.
+To send WRITE SAME (10) use the \fI\-\-10\fR option.
.PP
.B Take care:
The WRITE SAME(10, 16 and 32) commands interpret a \fINUM\fR of zero
@@ -43,7 +44,17 @@ as write to the end of \fIDEVICE\fR. This utility defaults \fINUM\fR to
large (or zero) then an invocation of this utility could take a long
time, potentially as long as a FORMAT UNIT command. In such situations
the command timeout value \fITO\fR may need to be increased from its
-default value of 60 seconds.
+default value of 60 seconds. In SBC\-3 revision 26 the WSNZ (write same
+no zero) bit was added to the Block Limits VPD page [0xB0]. If set the
+WRITE SAME commands will not accepts a \fINUM\fR of zero. The same
+SBC\-3 revision added the "Maximum Write Same Length" field to the Block
+Limits VPD page.
+.PP
+The Logical Block Provisioning VPD page [0xB2] contains the LBWS and
+LBW10 bits. If LBWS is set then WRITE SAME (16) supports the UNMAP bit.
+If LBWS10 is set then WRITE SAME (10) supports the UNMAP bit. If either
+LBWS or LBWS10 is set and the WRITE SAME (32) is supported then WRITE
+SAME (32) supports the UNMAP bit. This is as of SBC\-3 revision 26.
.PP
As a precaution against an accidental 'sg_write_same /dev/sda' (for example)
overwriting LBA 0 on /dev/sda with zeroes, at least one of the
@@ -54,10 +65,9 @@ options carefully.
Arguments to long options are mandatory for short options as well.
.TP
\fB\-R\fR, \fB\-\-10\fR
-send a SCSI WRITE SAME (10) command to \fIDEVICE\fR. This option has been
-added to allow the \fI\-\-unmap\fR (and \fI\-\-anchor\fR) options to be
-set on the SCSI WRITE SAME (10) command. As of the SBC\-3 revision 25
-draft this has been proposed but hasn't be accepted.
+send a SCSI WRITE SAME (10) command to \fIDEVICE\fR. The ability to
+set the \fI\-\-unmap\fR (and \fI\-\-anchor\fR) options to this command
+was added in SBC\-3 revision 26.
.TP
\fB\-S\fR, \fB\-\-16\fR
send a SCSI WRITE SAME (16) command to \fIDEVICE\fR.
@@ -133,7 +143,7 @@ data out buffer length. If both this option and the \fIIF\fR option are
given and \fILEN\fR exceeds the length of the \fIIF\fR file then \fILEN\fR
is the data out buffer length with zeroes used as pad bytes.
.SH UNMAP
-Logical block provisioning is the complicated term used in SBC\-3 revision
+Logical block provisioning is a new term introduced in SBC\-3 revision
25 for the ability to mark blocks as unused. It is closely related to the
ATA DATA SET MANAGEMENT command with the "Trim" bit set. For large
storage arrays, it is a way to provision less physical storage than the
diff --git a/sg3_utils.spec b/sg3_utils.spec
index d18ff7e0..55aaa59c 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,8 +79,8 @@ fi
%{_libdir}/*.la
%changelog
-* Mon Jan 10 2011 - dgilbert at interlog dot com
-- add sg_decode_sense
+* Sat Jan 22 2011 - dgilbert at interlog dot com
+- add sg_decode_sense; track t10 changes
* sg3_utils-1.31
* Fri Nov 05 2010 - dgilbert at interlog dot com
diff --git a/src/sg_readcap.c b/src/sg_readcap.c
index a3e58a2a..c224c2ee 100644
--- a/src/sg_readcap.c
+++ b/src/sg_readcap.c
@@ -16,7 +16,7 @@
/* This code is does a SCSI READ CAPACITY command on the given device
and outputs the result.
-* Copyright (C) 1999 - 2009 D. Gilbert
+* Copyright (C) 1999 - 2011 D. Gilbert
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
@@ -28,7 +28,7 @@
*/
-static char * version_str = "3.85 20101030";
+static char * version_str = "3.86 20110121";
#define ME "sg_readcap: "
@@ -87,7 +87,8 @@ static void usage()
"--long)\n"
" --pmi|-p partial medium indicator (without this "
"option shows\n"
- " total disk capacity)\n"
+ " total disk capacity) [made obsolete in "
+ "sbc3r26]\n"
" --raw|-r output response in binary to stdout\n"
" --verbose|-v increase verbosity\n"
" --version|-V print version string and exit\n\n"
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 8f68d04d..ca402e35 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2010 Douglas Gilbert.
+ * Copyright (c) 2006-2011 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
@@ -30,7 +30,7 @@
*/
-static char * version_str = "0.46 20101030"; /* spc4r27 + sbc3r25 */
+static char * version_str = "0.47 20110122"; /* spc4r29 + sbc3r26 */
extern void svpd_enumerate_vendor(void);
extern int svpd_decode_vendor(int sg_fd, int num_vpd, int subvalue,
@@ -1325,6 +1325,7 @@ decode_b0_vpd(unsigned char * buff, int len, int do_hex, int pdt)
"short=%d\n", len);
return;
}
+ printf(" Write same no zero (WSNZ): %d\n", !!(buff[4] & 0x1));
printf(" Maximum compare and write length: %u blocks\n",
buff[5]);
u = (buff[6] << 8) | buff[7];
@@ -1350,6 +1351,9 @@ decode_b0_vpd(unsigned char * buff, int len, int do_hex, int pdt)
printf(" Maximum unmap block descriptor count: %u\n", u);
}
if (len > 35) { /* added in sbc3r19 */
+ int m;
+ uint64_t mwsl;
+
u = ((unsigned int)buff[28] << 24) | (buff[29] << 16) |
(buff[30] << 8) | buff[31];
printf(" Optimal unmap granularity: %u\n", u);
@@ -1358,6 +1362,15 @@ decode_b0_vpd(unsigned char * buff, int len, int do_hex, int pdt)
u = ((unsigned int)(buff[32] & 0x7f) << 24) | (buff[33] << 16) |
(buff[34] << 8) | buff[35];
printf(" Unmap granularity alignment: %u\n", u);
+ /* added in sbc3r26 */
+ mwsl = 0;
+ for (m = 0; m < 8; ++m) {
+ if (m > 0)
+ mwsl <<= 8;
+ mwsl |= buff[36 + m];
+ }
+ printf(" Maximum write same length: 0x%" PRIx64 " blocks\n",
+ mwsl);
}
break;
case 1: case 8:
@@ -1440,28 +1453,21 @@ decode_b1_vpd(unsigned char * buff, int len, int do_hex, int pdt)
static int
decode_block_lb_prov_vpd(unsigned char * b, int len)
{
- int dp, anc_sup;
+ int dp;
if (len < 4) {
fprintf(stderr, "Logical block provisioning page too short=%d\n",
len);
return SG_LIB_CAT_MALFORMED;
}
- printf(" Unmap supported (TPU): %d\n", !!(0x80 & b[5]));
- printf(" Write same with unmap supported (TPWS): %d\n", !!(0x40 & b[5]));
- anc_sup = (b[5] >> 1) & 0x7;
- switch (anc_sup) {
- case 0:
- printf(" Anchored LBAs not supported\n");
- break;
- case 1:
- printf(" Anchored LBAs supported\n");
- break;
- default:
- printf(" Anchored LBAs support reserved [%d]\n", anc_sup);
- break;
- }
+ printf(" Unmap command supported (LBPU): %d\n", !!(0x80 & b[5]));
+ printf(" Write same (16) with unmap bit supported (LBWS): %d\n",
+ !!(0x40 & b[5]));
+ printf(" Write same (10) with unmap bit supported (LBWS10): %d\n",
+ !!(0x20 & b[5]));
+ printf(" Anchored LBAs supported (ANC_SUP): %d\n", !!(0x2 & b[5]));
dp = !!(b[5] & 0x1);
+ // sbc3r26 refers to a provisioning type field but not shown in page
printf(" Threshold exponent: %d\n", b[4]);
printf(" Descriptor present (DP): %d\n", dp);
if (dp) {