Count disks skipping the holes in the parity number warning

This commit is contained in:
Andrea Mazzoleni 2015-02-02 21:17:15 +01:00
parent ad57aafd8f
commit ce20be0ded

View file

@ -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);