Improve and change the order of the user messages

The "Everything is OK" is now printed as latest one.
This commit is contained in:
Andrea Mazzoleni 2025-10-13 11:46:36 +02:00
parent 467fb8c1ac
commit 52ef48655f
7 changed files with 40 additions and 25 deletions

View file

@ -665,7 +665,11 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
}
end:
state_progress_end(state, countpos, countmax, countsize);
state_progress_end(state, countpos, countmax, countsize, "Nothing to scrub. Use the -p PLAN option to select a different plan, like -p full.\n");
/* save the new state if required */
if (state->need_write || state->opt.force_content_write)
state_write(state);
state_usage_print(state);
@ -788,10 +792,13 @@ int state_scrub(struct snapraid_state* state, int plan, int olderthan)
ps.plan = SCRUB_EVEN;
} else if (plan == SCRUB_FULL) {
ps.plan = SCRUB_FULL;
msg_info("Scrub plan: full. All data blocks will be checked.\n");
} else if (plan == SCRUB_NEW) {
ps.plan = SCRUB_NEW;
msg_info("Scrub plan: new. Only blocks that have never been scrubbed will be checked.\n");
} else if (plan == SCRUB_BAD) {
ps.plan = SCRUB_BAD;
msg_info("Scrub plan: bad. Only blocks previously marked as bad will be checked.\n");
} else if (state->opt.force_scrub_at) {
/* scrub the specified amount of blocks */
ps.plan = SCRUB_AUTO;
@ -812,6 +819,18 @@ int state_scrub(struct snapraid_state* state, int plan, int olderthan)
/* by default use a 10 day time limit */
recentlimit = now - 10 * 24 * 3600;
}
if (plan >= 0) {
if (olderthan >= 0)
msg_info("Scrub plan: auto. %d%% of the array, older than %d days, will be checked.\n", plan, olderthan);
else
msg_info("Scrub plan: auto. %d%% of the array, older than 10 days, will be checked.\n", plan);
} else {
if (olderthan >= 0)
msg_info("Scrub plan: auto. 8.3%% of the array, older than %d days, will be checked.\n", olderthan);
else
msg_info("Scrub plan: auto. 8.3%% of the array, older than 10 days, will be checked.\n");
}
}
/* identify the time limit */