mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Allocate only the minimal necessary waiting vector
This is more clear to understand.
This commit is contained in:
parent
377352e64f
commit
affc60e256
3 changed files with 10 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -279,7 +279,9 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
|
|||
/* initialize the io threads */
|
||||
io_init(&io, state, state->opt.io_cache, buffermax, scrub_data_reader, handle, diskmax, scrub_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;
|
||||
silent_error = 0;
|
||||
|
|
|
|||
|
|
@ -713,7 +713,10 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
|
|||
|
||||
failed = malloc_nofail(diskmax * sizeof(struct failed_struct));
|
||||
failed_map = malloc_nofail(diskmax * sizeof(unsigned));
|
||||
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;
|
||||
silent_error = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue