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 GitHub
parent 973934b965
commit 05b72415d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View 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; flags.verbosity = 1;
if (excludes.count > 0 && !flags.replicate) { if (excludes.count > 0 && !flags.replicate) {

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;
@ -940,7 +941,7 @@ send_progress_thread(void *arg)
struct tm tm; struct tm tm;
int err; int err;
if (!pa->pa_parsable && pa->pa_verbosity != 0) { if (!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",
@ -990,7 +991,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,
@ -1206,6 +1207,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) {
@ -1886,6 +1888,7 @@ zfs_send_resume_impl_cb_impl(libzfs_handle_t *hdl, 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;
error = pthread_create(&tid, NULL, error = pthread_create(&tid, NULL,
send_progress_thread, &pa); 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_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);