0.18 round 2: refactor Disc::patch onto Pipeline + PatchSink
Patch was strictly serial (per-sector recovery: read → seek+write → mapfile.record → next). Lifting the write+record onto a consumer thread lets the drive issue the next per-sector retry while the previous block's recovered bytes are being committed — small but real win on damaged discs with many bad sectors, and uniform with sweep's threading model. - New PatchSink: Sink<PatchItem> impl in src/disc/patch.rs. Owns WritebackFile + Mapfile. apply() seeks+writes recovered bytes and records mapfile state per item; close() runs sync_all and mapfile.flush. - Channel depth: WRITE_THROUGH_DEPTH (1). Patch wants minimum buffering — back-pressure should kick in immediately so the drive's per-sector retry budget isn't ahead of the writer. - Disc::patch: keeps every existing recovery decision on the producer (reverse walk, damage-window skip, NOT_READY pauses, bridge-degradation handling, wedge exit, range watchdog). WritebackFile ownership moves to the sink. Behaviour-preserving: per-sector single-shot read budget unchanged (BU40N+Initio bridge wedge concern still respected); recovery algorithm bit-identical. See (internal)/memory/0_18_redesign.md. Single contributor: MattJackson.
This commit is contained in:
+4
-4
@@ -21,9 +21,9 @@ pub mod pipeline;
|
||||
|
||||
pub(crate) use writeback_file::WritebackFile;
|
||||
|
||||
// Re-exports for the 0.18 redesign. Currently flagged unused because
|
||||
// no in-tree call site has been migrated yet (sweep is still on
|
||||
// `disc/sweep_pipeline.rs`; patch and mux have no pipeline). The next
|
||||
// 0.18 slice removes this allow as it wires up the first consumer.
|
||||
// Re-exports for the 0.18 redesign. `Disc::patch` (0.18 round 2)
|
||||
// uses `Pipeline` + `Sink` + `Flow` + `WRITE_THROUGH_DEPTH`. Sweep
|
||||
// and mux still need to be migrated; until they are,
|
||||
// `DEFAULT_PIPELINE_DEPTH` is unused outside tests.
|
||||
#[allow(unused_imports)]
|
||||
pub use pipeline::{DEFAULT_PIPELINE_DEPTH, Flow, Pipeline, Sink, WRITE_THROUGH_DEPTH};
|
||||
|
||||
Reference in New Issue
Block a user