]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix console progress reporting for recursive send
authorAmeer Hamza <106930537+ixhamza@users.noreply.github.com>
Thu, 2 Feb 2023 23:09:57 +0000 (04:09 +0500)
committerGitHub <noreply@github.com>
Thu, 2 Feb 2023 23:09:57 +0000 (15:09 -0800)
After commit 19d3961, progress reporting (-v) with replication flag
enabled does not report the progress on the console. This commit
fixes the issue by updating the logic to check for pa->progress
instead of pa_verbosity in send_progress_thread().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #14448

cmd/zfs/zfs_main.c
lib/libzfs/libzfs_sendrecv.c

index 9d48b2b32e83736504c45cd830244f905757ce3f..cec025ce6de85bf591fa2a03d116ad0c4cfb991f 100644 (file)
@@ -4532,7 +4532,7 @@ zfs_do_send(int argc, char **argv)
                }
        }
 
-       if (flags.parsable && flags.verbosity == 0)
+       if ((flags.parsable || flags.progressastitle) && flags.verbosity == 0)
                flags.verbosity = 1;
 
        if (excludes.count > 0 && !flags.replicate) {
index 038613a1fcfadcf029a98b92d09e950923eed63b..1d2ad1944051f639c5f173cc93c9c4ef5029ba11 100644 (file)
@@ -84,6 +84,7 @@ typedef struct progress_arg {
        boolean_t pa_estimate;
        int pa_verbosity;
        boolean_t pa_astitle;
+       boolean_t pa_progress;
        uint64_t pa_size;
 } progress_arg_t;
 
@@ -940,7 +941,7 @@ send_progress_thread(void *arg)
        struct tm tm;
        int err;
 
-       if (!pa->pa_parsable && pa->pa_verbosity != 0) {
+       if (!pa->pa_parsable && pa->pa_progress) {
                (void) fprintf(stderr,
                    "TIME       %s   %sSNAPSHOT %s\n",
                    pa->pa_estimate ? "BYTES" : " SENT",
@@ -990,7 +991,7 @@ send_progress_thread(void *arg)
                        (void) fprintf(stderr, "%02d:%02d:%02d\t%llu\t%s\n",
                            tm.tm_hour, tm.tm_min, tm.tm_sec,
                            (u_longlong_t)bytes, zhp->zfs_name);
-               } else if (pa->pa_verbosity != 0) {
+               } else if (pa->pa_progress) {
                        zfs_nicebytes(bytes, buf, sizeof (buf));
                        (void) fprintf(stderr, "%02d:%02d:%02d   %5s   %s\n",
                            tm.tm_hour, tm.tm_min, tm.tm_sec,
@@ -1206,6 +1207,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
                        pa.pa_verbosity = sdd->verbosity;
                        pa.pa_size = sdd->size;
                        pa.pa_astitle = sdd->progressastitle;
+                       pa.pa_progress = sdd->progress;
 
                        if ((err = pthread_create(&tid, NULL,
                            send_progress_thread, &pa)) != 0) {
@@ -1886,6 +1888,7 @@ zfs_send_resume_impl_cb_impl(libzfs_handle_t *hdl, sendflags_t *flags,
                        pa.pa_verbosity = flags->verbosity;
                        pa.pa_size = size;
                        pa.pa_astitle = flags->progressastitle;
+                       pa.pa_progress = flags->progress;
 
                        error = pthread_create(&tid, NULL,
                            send_progress_thread, &pa);
@@ -2696,6 +2699,7 @@ zfs_send_one_cb_impl(zfs_handle_t *zhp, const char *from, int fd,
                pa.pa_verbosity = flags->verbosity;
                pa.pa_size = size;
                pa.pa_astitle = flags->progressastitle;
+               pa.pa_progress = flags->progress;
 
                err = pthread_create(&ptid, NULL,
                    send_progress_thread, &pa);