Allocate only the minimal necessary waiting vector

This is more clear to understand.
This commit is contained in:
Andrea Mazzoleni 2016-01-21 18:52:45 +01:00
parent 377352e64f
commit affc60e256
3 changed files with 10 additions and 3 deletions

View file

@ -191,7 +191,9 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
/* initialize the io threads */
io_init(&io, state, state->opt.io_cache, buffermax, dry_data_reader, handle, diskmax, dry_parity_reader, 0, parity_handle, state->level);
waiting_map = malloc_nofail((diskmax + RAID_PARITY_MAX) * sizeof(unsigned));
/* possibly waiting disks */
waiting_mac = diskmax > RAID_PARITY_MAX ? diskmax : RAID_PARITY_MAX;
waiting_map = malloc_nofail(waiting_mac * sizeof(unsigned));
error = 0;
io_error = 0;