From ff3fc0a194d32cbee32274572e22976beb26af7f Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 22 May 2021 09:34:40 +0200 Subject: [PATCH] Avoid to get the info block if not necessary --- cmdline/check.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmdline/check.c b/cmdline/check.c index 58c96d80..fc5bead1 100644 --- a/cmdline/check.c +++ b/cmdline/check.c @@ -801,15 +801,16 @@ close_and_continue: */ static int block_is_enabled(struct snapraid_state* state, block_off_t i, struct snapraid_handle* handle, unsigned diskmax) { - snapraid_info info; unsigned j; unsigned l; - /* get block specific info */ - info = info_get(&state->infoarr, i); - /* if we filter for only bad blocks */ if (state->opt.badonly) { + snapraid_info info; + + /* get block specific info */ + info = info_get(&state->infoarr, i); + /* skip if this is not bad */ if (!info_get_bad(info)) return 0;