From cb8b3dc8042cea922d5e521611cb01bb09ec1f5c Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 22 May 2021 08:46:53 +0200 Subject: [PATCH] Print a new Selecting... stage to get an idea of the time spent on it --- cmdline/check.c | 16 +++++++++------- cmdline/scrub.c | 6 ++++-- cmdline/state.c | 2 +- cmdline/sync.c | 6 ++++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/cmdline/check.c b/cmdline/check.c index b3d20486..a4ad9727 100644 --- a/cmdline/check.c +++ b/cmdline/check.c @@ -889,6 +889,8 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna unrecoverable_error = 0; recovered_error = 0; + msg_progress("Selecting...\n"); + /* first count the number of blocks to process */ countmax = 0; for (i = blockstart; i < blockmax; ++i) { @@ -897,6 +899,13 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna ++countmax; } + if (fix) + msg_progress("Fixing...\n"); + else if (!state->opt.auditonly) + msg_progress("Checking...\n"); + else + msg_progress("Hashing...\n"); + /* check all the blocks in files */ countsize = 0; countpos = 0; @@ -2019,13 +2028,6 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b parity_ptr[l] = 0; } - if (fix) - msg_progress("Fixing...\n"); - else if (!state->opt.auditonly) - msg_progress("Checking...\n"); - else - msg_progress("Hashing...\n"); - error = 0; /* skip degenerated cases of empty parity, or skipping all */ diff --git a/cmdline/scrub.c b/cmdline/scrub.c index d69f3f0d..65b20b00 100644 --- a/cmdline/scrub.c +++ b/cmdline/scrub.c @@ -289,6 +289,8 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par silent_error = 0; io_error = 0; + msg_progress("Selecting...\n"); + /* first count the number of blocks to process */ countmax = 0; plan->countlast = 0; @@ -312,6 +314,8 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par countpos = 0; plan->countlast = 0; + msg_progress("Scrubbing...\n"); + /* start all the worker threads */ io_start(&io, blockstart, blockmax, &block_is_enabled, plan); @@ -874,8 +878,6 @@ int state_scrub(struct snapraid_state* state, int plan, int olderthan) } } - msg_progress("Scrubbing...\n"); - error = 0; ret = state_scrub_process(state, parity_handle, 0, blockmax, &ps, now); diff --git a/cmdline/state.c b/cmdline/state.c index f15bccb9..f1356133 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -4117,7 +4117,7 @@ void state_filter(struct snapraid_state* state, tommy_list* filterlist_file, tom if (!filter_missing && !filter_error && tommy_list_empty(filterlist_file) && tommy_list_empty(filterlist_disk)) return; - msg_progress("Filtering...\n"); + msg_progress("Selecting...\n"); for (i = tommy_list_head(filterlist_disk); i != 0; i = i->next) { struct snapraid_filter* filter = i->data; diff --git a/cmdline/sync.c b/cmdline/sync.c index 96a23c89..e1d51455 100644 --- a/cmdline/sync.c +++ b/cmdline/sync.c @@ -732,6 +732,8 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari silent_error = 0; io_error = 0; + msg_progress("Selecting...\n"); + /* first count the number of blocks to process */ countmax = 0; plan.handle_max = diskmax; @@ -756,6 +758,8 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari countsize = 0; countpos = 0; + msg_progress("Syncing...\n"); + /* start all the worker threads */ io_start(&io, blockstart, blockmax, &block_is_enabled, &plan); @@ -1575,8 +1579,6 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t log_fatal("WARNING! Skipped state write for --test-skip-content-write option.\n"); } - msg_progress("Syncing...\n"); - /* skip degenerated cases of empty parity, or skipping all */ if (blockstart < blockmax) { ret = state_sync_process(state, parity_handle, blockstart, blockmax);