mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-25 17:36:26 -05:00
Replace physical reach tracking with the natural file and parity EOF
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
This commit is contained in:
parent
873a5561e4
commit
62ae6c3552
7 changed files with 195 additions and 278 deletions
|
|
@ -911,7 +911,7 @@ static void sync_parity_writer(struct snapraid_worker* worker, struct snapraid_t
|
|||
int ret;
|
||||
|
||||
/* write parity */
|
||||
ret = parity_write(parity_handle, blockcur, buffer, state->block_size);
|
||||
ret = parity_write(parity_handle, blockcur, buffer, state->block_size, state->opt.skip_fallocate);
|
||||
if (ret == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("parity_%s:%" PRIu64 ":%s: Write error. %s.\n", es(errno), blockcur, lev_config_name(level), strerror(errno));
|
||||
|
|
@ -2011,16 +2011,16 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
|||
* discard parity positions that are still referenced by the previously
|
||||
* persisted content file.
|
||||
*
|
||||
* This comparison deliberately does not use physical_reach_size or physical EOF.
|
||||
* Those describe physical I/O extent, not the logical parity layout whose
|
||||
* crash-consistency relationship with the content file must be preserved.
|
||||
* This comparison deliberately does not use physical EOF. It describes
|
||||
* physical I/O extent, not the logical parity layout whose crash-consistency
|
||||
* relationship with the content file must be preserved.
|
||||
*/
|
||||
parity_size(&parity_handle[l], ¤t_size);
|
||||
if (size < current_size)
|
||||
parity_shrink = 1;
|
||||
|
||||
/* number of block in the parity file */
|
||||
parity_physical_reach_size(&parity_handle[l], &out_size);
|
||||
parity_physical_size(&parity_handle[l], &out_size);
|
||||
parityblocks = out_size / state->block_size;
|
||||
|
||||
/* if the file is too small */
|
||||
|
|
@ -2041,9 +2041,9 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
|||
* truncation before parity_tail remains fatal.
|
||||
*
|
||||
* New levels need the same physical coverage of valid blocks, not an exact
|
||||
* match with another level or the allocated extent. After an interrupted
|
||||
* sync, fix leaves pending parity to sync and may truncate its unwritten
|
||||
* tail. Sync will resize and regenerate that tail if it is still allocated.
|
||||
* match with another level or the allocated extent. Physical EOF only records
|
||||
* presence; pending or invalid parity is identified independently by block
|
||||
* state and regenerated by sync when required.
|
||||
*/
|
||||
if (!state->opt.force_full && !(state->opt.force_realloc && state->opt.parity_tail == 0)) {
|
||||
/* if the parities are too small */
|
||||
|
|
@ -2103,9 +2103,9 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
|||
* existing post-resize content write persists the resulting split sizes before
|
||||
* parity synchronization begins.
|
||||
*
|
||||
* This decision uses the logical parity size, not physical_reach_size or physical
|
||||
* EOF. physical_reach_size is only a physical I/O extent and does not represent
|
||||
* parity validity or the persisted logical mapping.
|
||||
* This decision uses the logical parity size, not physical EOF. Physical EOF
|
||||
* is only an I/O extent and does not represent parity validity or the persisted
|
||||
* logical mapping.
|
||||
*/
|
||||
if (state->opt.force_full)
|
||||
state_sync_mark_rebuild(state);
|
||||
|
|
@ -2132,7 +2132,7 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
|||
* Sync may reallocate an elastic split into following splits. Any resulting
|
||||
* logical split mapping is persisted by the sync state-update protocol.
|
||||
*/
|
||||
ret = parity_chsize(&parity_handle[l], &state->parity[l], &is_modified, size, state->block_size, state->opt.skip_fallocate, state->opt.skip_space_holder, 1);
|
||||
ret = parity_chsize(&parity_handle[l], &state->parity[l], &is_modified, size, state->block_size, state->opt.skip_fallocate, state->opt.skip_space_holder);
|
||||
if (ret == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
data_off_t out_size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue