Removes INV blocks. There are not unnecessary as we always keep deleted/changed ones to keep the information that the parity is invalid.

This commit is contained in:
Andrea Mazzoleni 2013-02-24 19:43:53 +01:00
parent 5c4f6dc5c4
commit 1e3e88d51c
9 changed files with 70 additions and 179 deletions

21
scan.c
View file

@ -164,7 +164,6 @@ static void scan_file_remove(struct snapraid_state* state, struct snapraid_disk*
struct snapraid_block* block = &file->blockvec[i];
block_off_t block_pos = block->parity_pos;
unsigned block_state;
tommy_node* j;
struct snapraid_deleted* deleted;
/* adjust the first free position */
@ -176,7 +175,6 @@ static void scan_file_remove(struct snapraid_state* state, struct snapraid_disk*
block_state = block_state_get(block);
switch (block_state) {
case BLOCK_STATE_BLK :
case BLOCK_STATE_INV :
/* we keep the hash making it an "old" hash, because the parity is still containing data for it */
break;
case BLOCK_STATE_CHG :
@ -204,15 +202,6 @@ static void scan_file_remove(struct snapraid_state* state, struct snapraid_disk*
/* set the deleted block in the block array */
tommy_array_set(&disk->blockarr, block_pos, &deleted->block);
/* invalidate the block of all the other disks */
for(j=state->disklist;j!=0;j=j->next) {
struct snapraid_disk* oth_disk = j->data;
struct snapraid_block* oth_block = disk_block_get(oth_disk, block_pos);
/* remove the parity info for this block */
block_clear_parity(oth_block);
}
}
/* remove the file from the file containers */
@ -240,7 +229,6 @@ static void scan_file_insert(struct snapraid_state* state, struct snapraid_disk*
block_pos = disk->first_free_block;
block_max = tommy_array_size(&disk->blockarr);
for(i=0;i<file->blockmax;++i) {
tommy_node* j;
struct snapraid_block* block;
/* find a free block */
@ -269,15 +257,6 @@ static void scan_file_insert(struct snapraid_state* state, struct snapraid_disk*
memcpy(file->blockvec[i].hash, block->hash, HASH_SIZE);
}
/* invalidate the block of all the other disks */
for(j=state->disklist;j!=0;j=j->next) {
struct snapraid_disk* oth_disk = j->data;
struct snapraid_block* oth_block = disk_block_get(oth_disk, block_pos);
/* remove the parity info for this block */
block_clear_parity(oth_block);
}
/* store in the disk map, after invalidating all the other blocks */
tommy_array_set(&disk->blockarr, block_pos, &file->blockvec[i]);
}