Reduces memory usage, with new array growing by fixed size and not exponential.

This commit is contained in:
Andrea Mazzoleni 2013-09-28 09:40:08 +02:00
parent 7f02cd068f
commit d525b4a14a
18 changed files with 497 additions and 53 deletions

View file

@ -35,12 +35,12 @@ block_off_t parity_size(struct snapraid_state* state)
struct snapraid_disk* disk = i->data;
/* start from the declared size */
block_off_t block = tommy_array_size(&disk->blockarr);
block_off_t block = tommy_arrayblk_size(&disk->blockarr);
/* decrease the block until an used one */
/* we don't stop at deleted blocks, because we want to have them cleared */
/* if they are at the end of the parity */
while (block > parity_block && !block_has_file(tommy_array_get(&disk->blockarr, block - 1)))
while (block > parity_block && !block_has_file(tommy_arrayblk_get(&disk->blockarr, block - 1)))
--block;
/* get the highest value */