mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-25 01:16:31 -05:00
Refactor the parity size detection before sync.
Now we resize the parity only after checking the size of all the parity file.
This commit is contained in:
parent
6844fb7527
commit
ad57aafd8f
11 changed files with 112 additions and 62 deletions
|
|
@ -544,7 +544,8 @@ static inline int block_has_updated_hash(const struct snapraid_block* block)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified block has an a past hash.
|
||||
* Checks if the specified block has a past hash,
|
||||
* i.e. the hash of the data that it's now overwritten or lost.
|
||||
*
|
||||
* Note that EMPTY / BLK / REP return 0.
|
||||
*/
|
||||
|
|
@ -637,6 +638,18 @@ static inline int block_has_invalid_parity(const struct snapraid_block* block)
|
|||
|| state == BLOCK_STATE_CHG || state == BLOCK_STATE_REP;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the block is part of a file with valid parity.
|
||||
*
|
||||
* Note that anything different than BLK return 0.
|
||||
*/
|
||||
static inline int block_has_file_and_valid_parity(const struct snapraid_block* block)
|
||||
{
|
||||
unsigned state = block_state_get(block);
|
||||
|
||||
return state == BLOCK_STATE_BLK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relative position of a block inside the file.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue