mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-29 11:26:48 -05:00
Change the interface for parity allocation
This will allow a more compact representation of the parity allocation
This commit is contained in:
parent
2801634aa4
commit
0407c945db
15 changed files with 449 additions and 286 deletions
|
|
@ -66,7 +66,7 @@ static void import_file(struct snapraid_state* state, const char* path, uint64_t
|
|||
file->path = strdup_nofail(path);
|
||||
file->size = size;
|
||||
file->blockmax = (size + block_size - 1) / block_size;
|
||||
file->blockvec = malloc_nofail(file->blockmax * sizeof(struct snapraid_import_block));
|
||||
file->blockimp = malloc_nofail(file->blockmax * sizeof(struct snapraid_import_block));
|
||||
|
||||
buffer = malloc_nofail(block_size);
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ static void import_file(struct snapraid_state* state, const char* path, uint64_t
|
|||
|
||||
offset = 0;
|
||||
for (i = 0; i < file->blockmax; ++i) {
|
||||
struct snapraid_import_block* block = &file->blockvec[i];
|
||||
struct snapraid_import_block* block = &file->blockimp[i];
|
||||
unsigned read_size = block_size;
|
||||
if (read_size > size)
|
||||
read_size = size;
|
||||
|
|
@ -145,7 +145,7 @@ static void import_file(struct snapraid_state* state, const char* path, uint64_t
|
|||
void import_file_free(struct snapraid_import_file* file)
|
||||
{
|
||||
free(file->path);
|
||||
free(file->blockvec);
|
||||
free(file->blockimp);
|
||||
free(file);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue