mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Specialize block hash copies for the full hash size
This commit is contained in:
parent
b64c28b537
commit
902c19b668
8 changed files with 29 additions and 15 deletions
|
|
@ -547,7 +547,7 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
|
|||
*/
|
||||
|
||||
/* copy the hash in the block */
|
||||
memcpy(block->hash, hash, BLOCK_HASH_SIZE);
|
||||
hash_copy(block->hash, hash);
|
||||
|
||||
/* and mark the block as hashed */
|
||||
block_state_set(block, BLOCK_STATE_REP);
|
||||
|
|
@ -1353,7 +1353,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
|
|||
* During rehash this uses the previous hash algorithm and is
|
||||
* overwritten with the new hash below when rehash is committed.
|
||||
*/
|
||||
memcpy(rehandle[diskcur].sync_hash, hash, BLOCK_HASH_SIZE);
|
||||
hash_copy(rehandle[diskcur].sync_hash, hash);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1574,7 +1574,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
|
|||
* was handled above. Publish the staged hash atomically with CHG -> BLK.
|
||||
*/
|
||||
if (block_state_get(block) == BLOCK_STATE_CHG)
|
||||
memcpy(block->hash, rehandle[j].sync_hash, BLOCK_HASH_SIZE);
|
||||
hash_copy(block->hash, rehandle[j].sync_hash);
|
||||
|
||||
/* now all the blocks have the hash and the parity computed */
|
||||
block_state_set(block, BLOCK_STATE_BLK);
|
||||
|
|
@ -1595,7 +1595,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
|
|||
/* store all the new hash already computed */
|
||||
for (j = 0; j < diskmax; ++j) {
|
||||
if (rehandle[j].block)
|
||||
memcpy(rehandle[j].block->hash, rehandle[j].new_hash, BLOCK_HASH_SIZE);
|
||||
hash_copy(rehandle[j].block->hash, rehandle[j].new_hash);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue