Change the internal mapping to a tree of chunk

This is intended to save memory as now we can use a fixed
block of 17 bytes to store the block information, compared
to the previous 28/36 bytes.
This commit is contained in:
Andrea Mazzoleni 2015-10-04 22:02:05 +02:00
parent fa775d24a8
commit 9bc5f9e5ce
12 changed files with 900 additions and 258 deletions

View file

@ -37,7 +37,7 @@ block_off_t parity_allocated_size(struct snapraid_state* state)
struct snapraid_disk* disk = i->data;
/* start from the declared size */
block_off_t block = disk_block_size(disk);
block_off_t block = disk_size(disk);
/* decrease the block until an allocated one, but part of a file */
/* we don't stop at deleted blocks, because we want to have them cleared */
@ -64,7 +64,7 @@ block_off_t parity_used_size(struct snapraid_state* state)
struct snapraid_disk* disk = i->data;
/* start from the declared size */
block_off_t block = disk_block_size(disk);
block_off_t block = disk_size(disk);
/* decrease the block until an used one */
while (block > parity_block && !block_has_file_and_valid_parity(fs_par2block_get(disk, block - 1)))