mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 04:46:46 -05:00
Optimizes the cache use for all the RAID computations.
This commit is contained in:
parent
ed135e5912
commit
4f891087a2
8 changed files with 70 additions and 39 deletions
9
check.c
9
check.c
|
|
@ -437,7 +437,6 @@ static int state_check_process(struct snapraid_state* state, int check, int fix,
|
|||
block_off_t i;
|
||||
unsigned j;
|
||||
void* buffer_alloc;
|
||||
unsigned char* buffer_aligned;
|
||||
unsigned char** buffer;
|
||||
unsigned buffermax;
|
||||
int ret;
|
||||
|
|
@ -455,11 +454,9 @@ static int state_check_process(struct snapraid_state* state, int check, int fix,
|
|||
/* we need disk + 2 for each parity level buffers + 1 zero buffer */
|
||||
buffermax = diskmax + state->level * 2 + 1;
|
||||
|
||||
buffer_aligned = malloc_nofail_align(buffermax * state->block_size, &buffer_alloc);
|
||||
buffer = malloc_nofail(buffermax * sizeof(void*));
|
||||
for(i=0;i<buffermax;++i) {
|
||||
buffer[i] = buffer_aligned + i * state->block_size;
|
||||
}
|
||||
buffer = malloc_nofail_vector_align(buffermax, state->block_size, &buffer_alloc);
|
||||
|
||||
/* fill up the zero buffer */
|
||||
memset(buffer[buffermax-1], 0, state->block_size);
|
||||
|
||||
failed = malloc_nofail(diskmax * sizeof(struct failed_struct));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue