From ce20be0ded7537863a8e369434b06a3ab488120b Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 2 Feb 2015 21:17:15 +0100 Subject: [PATCH] Count disks skipping the holes in the parity number warning --- cmdline/state.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmdline/state.c b/cmdline/state.c index cb9b103f..c8389efb 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -1142,6 +1142,8 @@ static void state_map(struct snapraid_state* state) if (map->position + 1 > diskcount) diskcount = map->position + 1; } + + /* ensure to don't go over the limit of the RAID engine */ if (diskcount > RAID_DATA_MAX) { /* LCOV_EXCL_START */ fprintf(stderr, "Too many data disks. No more than %u.\n", RAID_DATA_MAX); @@ -1149,6 +1151,9 @@ static void state_map(struct snapraid_state* state) /* LCOV_EXCL_STOP */ } + /* now count the real number of data disks, excluding holes left after removing some */ + diskcount = tommy_list_count(&state->maplist); + /* recommend number of parities */ if (diskcount >= 36 && state->level < 6) { fprintf(stderr, "WARNING! With %u disks it's recommended to use six parity levels.\n", diskcount);