The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=350c1232a57a64b955a3ae7f9b92dde164d1eb65

commit 350c1232a57a64b955a3ae7f9b92dde164d1eb65
Author:     Warner Losh <[email protected]>
AuthorDate: 2026-02-02 13:30:28 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2026-02-02 13:31:21 +0000

    nvmecontrol: telemetry-log --verbose
    
    Add -v / --verbose to report status report since these things can take
    minutes to retrieve.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D55019
---
 sbin/nvmecontrol/nvmecontrol.8 |  6 +++++-
 sbin/nvmecontrol/telemetry.c   | 24 +++++++++++++++++++++---
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8
index dc757bcf90c3..61574715a26c 100644
--- a/sbin/nvmecontrol/nvmecontrol.8
+++ b/sbin/nvmecontrol/nvmecontrol.8
@@ -33,7 +33,7 @@
 .\"
 .\" Author: Jim Harris <[email protected]>
 .\"
-.Dd July 9, 2025
+.Dd January 31, 2026
 .Dt NVMECONTROL 8
 .Os
 .Sh NAME
@@ -256,6 +256,7 @@
 .Ic telemetry-log
 .Fl O Ar output-file
 .Op Fl d Ar data-area
+.Op Fl v
 .Aq Ar device-id
 .Sh DESCRIPTION
 NVM Express (NVMe) is a storage protocol standard for SSDs and other
@@ -875,6 +876,9 @@ Output file for the data.
 This parameter is mandatory.
 .It Fl d Ar data-area
 The data area is either 1, 2 or 3.
+.It Fl v
+Verbose output reporing progress.
+This log can be quite large and take minutes to retrieve.
 .El
 .Sh DEVICE NAMES
 Where
diff --git a/sbin/nvmecontrol/telemetry.c b/sbin/nvmecontrol/telemetry.c
index c22d53ecdfed..60bd3e025f3d 100644
--- a/sbin/nvmecontrol/telemetry.c
+++ b/sbin/nvmecontrol/telemetry.c
@@ -51,6 +51,7 @@ static struct options {
        const char *outfn;
        const char *dev;
        uint8_t da;
+       bool verbose;
 } opt = {
        .outfn = NULL,
        .dev = NULL,
@@ -63,6 +64,8 @@ static const struct opts telemetry_log_opts[] = {
            "output file for telemetry data"),
        OPT("data-area", 'd', arg_uint8, opt, da,
            "output file for telemetry data"),
+       OPT("verbose", 'v', arg_none, opt, verbose,
+           "Be verbose about process"),
        { NULL, 0, arg_none, NULL, NULL }
 };
 #undef OPT
@@ -96,7 +99,7 @@ telemetry_log(const struct cmd *f, int argc, char *argv[])
        int                             fd, fdout;
        char                            *path;
        uint32_t                        nsid;
-       ssize_t                         size;
+       ssize_t                         size, blocks;
        uint64_t                        off;
        ssize_t                         chunk;
        struct nvme_controller_data     cdata;
@@ -151,13 +154,23 @@ telemetry_log(const struct cmd *f, int argc, char *argv[])
        default:
                errx(EX_USAGE, "Impossible data area %d", opt.da);
        }
-       size = (size + 1) * 512; /* The count of additional pages */
+       blocks = size + 1;
+       size = blocks * 512; /* The count of additional pages */
        chunk = 4096;
 
-       printf("Extracting %llu bytes\n", (unsigned long long)size);
+       if (opt.verbose)
+               printf("Extracting %llu bytes %llu blocks\n", (unsigned long 
long)size,
+                   (unsigned long long)size / 512);
+       else
+               printf("Extracting %llu bytes\n", (unsigned long long)size);
        do {
                if (chunk > size)
                        chunk = size;
+               if (opt.verbose && off % 10240 == 0) {
+                       printf("%s: %llu / %llu\r", opt.dev, (unsigned long 
long)off / 512,
+                           (unsigned long long)blocks);
+                       fflush(stdout);
+               }
                read_logpage(fd, NVME_LOG_TELEMETRY_HOST_INITIATED, nsid, 0, 0, 
true,
                    off, 0, 0, 0, &buf, chunk);
                if (write(fdout, &buf, chunk) != chunk)
@@ -165,6 +178,11 @@ telemetry_log(const struct cmd *f, int argc, char *argv[])
                off += chunk;
                size -= chunk;
        } while (size > 0);
+       if (opt.verbose) {
+               printf("%s: %llu / %llu\n", opt.dev, (unsigned long long)off / 
512,
+                   (unsigned long long)blocks);
+               fflush(stdout);
+       }
 
        close(fdout);
        close(fd);

Reply via email to