aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2022-03-01 05:20:37 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2022-03-01 05:20:37 +0000
commitd4e94e36b445985f8618ed048c98787ad0edfdf1 (patch)
treebf2b1fa6baa8bc6cbca4da66c3aeadb297f97ba7
parentc0b22a17517d2e95e66871fd6b94dc76005e619e (diff)
downloadsg3_utils-d4e94e36b445985f8618ed048c98787ad0edfdf1.tar.gz
zoned disk man page improvements
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@941 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog2
-rw-r--r--doc/sg3_utils.83
-rw-r--r--doc/sg_rep_zones.83
-rw-r--r--doc/sg_reset_wp.816
-rw-r--r--src/sg_rep_zones.c55
5 files changed, 59 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index eefeba79..1c53fc03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ 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 pre-release sg3_utils-1.48 [20220224] [svn: r940]
+Changelog for pre-release sg3_utils-1.48 [20220228] [svn: r941]
- sg_z_act_query: new utility for sending either a
Zone activate or Zone query command
- sg_rep_density: new utility for decoding the response of
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index f60fd841..bf81e3ad 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -850,3 +850,6 @@ or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.B sg_decode_sense(sg3_utils), sdparm(sdparm), ddpt(ddpt), lsscsi(lsscsi),
.B dmesg(1), mt(1)
+.br
+The format of this section is: <utility_name>(<package_containing_utility>)
+or <utility_name>(<manpage_section_number_containing_utility>) .
diff --git a/doc/sg_rep_zones.8 b/doc/sg_rep_zones.8
index fe492d1c..0f4c2c4c 100644
--- a/doc/sg_rep_zones.8
+++ b/doc/sg_rep_zones.8
@@ -206,4 +206,5 @@ Copyright \(co 2014\-2022 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
-.B sg_reset_wp,sg_zone(sg3_utils)
+.B sg_reset_wp,sg_zone(sg3_utils),
+.B zbd(libzbd), blkzone(util-linux)
diff --git a/doc/sg_reset_wp.8 b/doc/sg_reset_wp.8
index 1627e04c..ecc4ee6b 100644
--- a/doc/sg_reset_wp.8
+++ b/doc/sg_reset_wp.8
@@ -1,4 +1,4 @@
-.TH SG_RESET_WP "8" "May 2018" "sg3_utils\-1.43" SG3_UTILS
+.TH SG_RESET_WP "8" "February 2022" "sg3_utils\-1.48" SG3_UTILS
.SH NAME
sg_reset_wp \- send SCSI RESET WRITE POINTER command
.SH SYNOPSIS
@@ -9,8 +9,8 @@ sg_reset_wp \- send SCSI RESET WRITE POINTER command
.\" Add any additional description here
.PP
Sends a SCSI RESET WRITE POINTER command to the \fIDEVICE\fR. This command
-is found in the soon to be released ZBC standard (draft prior to standard:
-zbc\-r05.pdf).
+is described in ZBC standard (INCITS 536\-2016) and the draft ZBC\-2
+documents at T10 (e.g. zbc2r12.pdf).
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
.TP
@@ -24,6 +24,10 @@ all open zones and full zones. When this option is given then the
ZC is placed in the Zone Count field in the cdb of the RESET WRITE POINTER
command supported by this utility. ZC should be a value from 0 to
65535 (0xffff) inclusive.
+.br
+The action that the \fIDEVICE\fR takes with this option depends on whether
+the \fI\-\-all\fR option is set. See the RESET WRITE POINTER command
+description (e.g. section 5.9, table 46 in zbc2r12.pdf).
.TP
\fB\-h\fR, \fB\-\-help\fR
output the usage message then exit.
@@ -41,6 +45,10 @@ operation on the zone identified by the ZONE ID field. The default value is
0. Either this option or the \fI\-\-all\fR option is required.
\fIID\fR is assumed to be in decimal unless prefixed with '0x' or has a
trailing 'h' which indicate hexadecimal.
+.SH NOTES
+The Zones Emptied log parameter in the Zoned Block Device Statistics log
+page counts the number of times the RESET WRITE POINTER command has
+been (successfully) invoked.
.SH EXIT STATUS
The exit status of sg_reset_wp is 0 when it is successful. Otherwise see
the sg3_utils(8) man page.
@@ -49,7 +57,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2014\-2018 Douglas Gilbert
+Copyright \(co 2014\-2022 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/src/sg_rep_zones.c b/src/sg_rep_zones.c
index 5329c20e..1eca3a8d 100644
--- a/src/sg_rep_zones.c
+++ b/src/sg_rep_zones.c
@@ -731,6 +731,7 @@ struct statistics_t {
uint64_t wp_max_lba1; /* ... that isn't Zone start LBA */
uint64_t wp_blk_num; /* sum of (zwp - zs_lba) */
+ uint64_t conv_blk_num; /* sum of (z_blks) of zt=conv */
};
static int
@@ -789,25 +790,26 @@ gather_statistics(int sg_fd, uint8_t * rzBuff, const char * cmd_name,
zwp = sg_get_unaligned_be64(bp + 24);
zt = 0xf & bp[0];
switch (zt) {
- case 1:
+ case 1: /* conventional */
++st.zt_conv_num;
+ st.conv_blk_num += z_blks;
break;
- case 2:
+ case 2: /* sequential write required */
++st.zt_swr_num;
if (0 == st.zt_swr_1st_lba1)
st.zt_swr_1st_lba1 = zs_lba + 1;
break;
- case 3:
+ case 3: /* sequential write preferred */
++st.zt_swp_num;
if (0 == st.zt_swp_1st_lba1)
st.zt_swp_1st_lba1 = zs_lba + 1;
break;
- case 4:
+ case 4: /* sequential or before (write) */
++st.zt_sob_num;
if (0 == st.zt_sob_1st_lba1)
st.zt_sob_1st_lba1 = zs_lba + 1;
break;
- case 5:
+ case 5: /* gap */
++st.zt_gap_num;
if (0 == st.zt_gap_1st_lba1)
st.zt_gap_1st_lba1 = zs_lba + 1;
@@ -855,23 +857,23 @@ gather_statistics(int sg_fd, uint8_t * rzBuff, const char * cmd_name,
st.wp_blk_num += zwp - zs_lba;
}
break;
- case 5:
+ case 5: /* inactive */
++st.zc_ina_num;
if (0 == st.zc_ina_1st_lba1)
st.zc_ina_1st_lba1 = zs_lba + 1;
break;
- case 0xd:
+ case 0xd: /* read-only */
++st.zc_ro_num;
if (0 == st.zc_ro_1st_lba1)
st.zc_ro_1st_lba1 = zs_lba + 1;
break;
- case 0xe:
+ case 0xe: /* full */
++st.zc_full_num;
if (0 == st.zc_full_1st_lba1)
st.zc_full_1st_lba1 = zs_lba + 1;
st.wp_blk_num += z_blks;
break;
- case 0xf:
+ case 0xf: /* offline */
++st.zc_off_num;
if (0 == st.zc_off_1st_lba1)
st.zc_off_1st_lba1 = zs_lba + 1;
@@ -968,7 +970,11 @@ gather_statistics(int sg_fd, uint8_t * rzBuff, const char * cmd_name,
st.wp_blk_num);
if ((sg_fd >= 0) && (op->maxlen >= RCAP16_REPLY_LEN) &&
- (st.wp_blk_num > 0)) {
+ ((st.wp_blk_num > 0) || (st.conv_blk_num > 0))) {
+ uint32_t block_size = 0;
+ uint64_t total_sz;
+ double sz_mb, sz_gb;
+
res = sg_ll_readcap_16(sg_fd, false, 0, rzBuff,
RCAP16_REPLY_LEN, true, op->vb);
if (SG_LIB_CAT_INVALID_OP == res) {
@@ -979,11 +985,11 @@ gather_statistics(int sg_fd, uint8_t * rzBuff, const char * cmd_name,
else if (res) {
sg_get_category_sense_str(res, sizeof(b), b, op->vb);
pr2serr("READ CAPACITY (16) failed: %s\n", b);
- } else {
- uint32_t block_size = sg_get_unaligned_be32(rzBuff + 8);
- uint64_t total_sz = st.wp_blk_num * block_size;
- double sz_mb, sz_gb;
+ } else
+ block_size = sg_get_unaligned_be32(rzBuff + 8);
+ if (st.wp_blk_num) {
+ total_sz = st.wp_blk_num * block_size;
sz_mb = (double)(total_sz) / (double)(1048576);
sz_gb = (double)(total_sz) / (double)(1000000000L);
#ifdef SG_LIB_MINGW
@@ -1002,6 +1008,27 @@ gather_statistics(int sg_fd, uint8_t * rzBuff, const char * cmd_name,
}
printf("\n");
}
+ if (st.conv_blk_num) {
+ total_sz = st.conv_blk_num * block_size;
+ sz_mb = (double)(total_sz) / (double)(1048576);
+ sz_gb = (double)(total_sz) / (double)(1000000000L);
+ printf("Size of all conventional zones: ");
+#ifdef SG_LIB_MINGW
+ printf("%" PRIu64 " bytes, %g MiB, %g GB", total_sz, sz_mb,
+ sz_gb);
+#else
+ printf("%" PRIu64 " bytes, %.1f MiB, %.2f GB", total_sz,
+ sz_mb, sz_gb);
+#endif
+ if (sz_gb > 2000) {
+#ifdef SG_LIB_MINGW
+ printf(", %g TB", sz_gb / 1000);
+#else
+ printf(", %.2f TB", sz_gb / 1000);
+#endif
+ }
+ printf("\n");
+ }
}
return res;
}