Fix console progress reporting for recursive send

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
This commit is contained in:
Ameer Hamza 2023-02-03 04:09:57 +05:00 committed by Tony Hutter
parent 0e30635f9c
commit c63b47e4da
2 changed files with 7 additions and 3 deletions

View File

@ -4565,7 +4565,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; flags.verbosity = 1;
argc -= optind; argc -= optind;

View File

@ -84,6 +84,7 @@ typedef struct progress_arg {
boolean_t pa_estimate; boolean_t pa_estimate;
int pa_verbosity; int pa_verbosity;
boolean_t pa_astitle; boolean_t pa_astitle;
boolean_t pa_progress;
uint64_t pa_size; uint64_t pa_size;
} progress_arg_t; } progress_arg_t;
@ -926,7 +927,7 @@ send_progress_thread(void *arg)
return ((void *)(uintptr_t)err); return ((void *)(uintptr_t)err);
} }
if (firstloop && !pa->pa_parsable && pa->pa_verbosity != 0) { if (firstloop && !pa->pa_parsable && pa->pa_progress) {
(void) fprintf(stderr, (void) fprintf(stderr,
"TIME %s %sSNAPSHOT %s\n", "TIME %s %sSNAPSHOT %s\n",
pa->pa_estimate ? "BYTES" : " SENT", pa->pa_estimate ? "BYTES" : " SENT",
@ -965,7 +966,7 @@ send_progress_thread(void *arg)
(void) fprintf(stderr, "%02d:%02d:%02d\t%llu\t%s\n", (void) fprintf(stderr, "%02d:%02d:%02d\t%llu\t%s\n",
tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_hour, tm->tm_min, tm->tm_sec,
(u_longlong_t)bytes, zhp->zfs_name); (u_longlong_t)bytes, zhp->zfs_name);
} else if (pa->pa_verbosity != 0) { } else if (pa->pa_progress) {
zfs_nicebytes(bytes, buf, sizeof (buf)); zfs_nicebytes(bytes, buf, sizeof (buf));
(void) fprintf(stderr, "%02d:%02d:%02d %5s %s\n", (void) fprintf(stderr, "%02d:%02d:%02d %5s %s\n",
tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_hour, tm->tm_min, tm->tm_sec,
@ -1137,6 +1138,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
pa.pa_verbosity = sdd->verbosity; pa.pa_verbosity = sdd->verbosity;
pa.pa_size = sdd->size; pa.pa_size = sdd->size;
pa.pa_astitle = sdd->progressastitle; pa.pa_astitle = sdd->progressastitle;
pa.pa_progress = sdd->progress;
if ((err = pthread_create(&tid, NULL, if ((err = pthread_create(&tid, NULL,
send_progress_thread, &pa)) != 0) { send_progress_thread, &pa)) != 0) {
@ -1788,6 +1790,7 @@ zfs_send_resume_impl(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
pa.pa_verbosity = flags->verbosity; pa.pa_verbosity = flags->verbosity;
pa.pa_size = size; pa.pa_size = size;
pa.pa_astitle = flags->progressastitle; pa.pa_astitle = flags->progressastitle;
pa.pa_progress = flags->progress;
error = pthread_create(&tid, NULL, error = pthread_create(&tid, NULL,
send_progress_thread, &pa); send_progress_thread, &pa);
@ -2541,6 +2544,7 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags,
pa.pa_verbosity = flags->verbosity; pa.pa_verbosity = flags->verbosity;
pa.pa_size = size; pa.pa_size = size;
pa.pa_astitle = flags->progressastitle; pa.pa_astitle = flags->progressastitle;
pa.pa_progress = flags->progress;
err = pthread_create(&ptid, NULL, err = pthread_create(&ptid, NULL,
send_progress_thread, &pa); send_progress_thread, &pa);