Quiesce scrub read-ahead before autosave and distinguish read/write barriers

This commit is contained in:
Andrea Mazzoleni 2026-09-24 19:41:52 +02:00
parent fba3f74538
commit bcfd2734b6
4 changed files with 32 additions and 21 deletions

View file

@ -6651,13 +6651,12 @@ void generate_configuration(const char* path)
state_done(&state);
}
/**
* Establish a durable I/O barrier: drain asynchronous writes, collect their
* errors, sync parity only if all writes succeeded, then quiesce read-ahead.
* A failed writer invalidates the whole barrier because parity must not be
* treated as coherent, or recorded in content state, after a failed write.
*/
int state_barrier(struct snapraid_state* state, struct snapraid_io* io, struct snapraid_parity_handle* parity_handle, block_off_t blockcur)
void state_read_barrier(struct snapraid_io* io)
{
io_quiesce(io);
}
int state_write_barrier(struct snapraid_state* state, struct snapraid_io* io, struct snapraid_parity_handle* parity_handle, block_off_t blockcur)
{
unsigned l;
@ -6689,7 +6688,7 @@ int state_barrier(struct snapraid_state* state, struct snapraid_io* io, struct s
/* complete all read-ahead without consuming the results */
if (io)
io_quiesce(io);
state_read_barrier(io);
return 0;
}