diff --git a/src/io/pipeline.rs b/src/io/pipeline.rs index 1d218c8..4d56377 100644 --- a/src/io/pipeline.rs +++ b/src/io/pipeline.rs @@ -49,13 +49,14 @@ use crate::error::Error; /// Empirically tuned for sweep and mux — both want enough slack that /// short consumer stalls don't immediately back up onto the producer, /// but not so much that a producer outpacing the consumer accumulates -/// arbitrary buffered work. `4` matches the depth sweep has used -/// since 0.17.11 (originally in `disc/sweep_pipeline.rs`, now in -/// `disc/sweep.rs::SweepSink`). Patch should usually use -/// [`WRITE_THROUGH_DEPTH`] (`1`) instead — write-through gives clean -/// back-pressure between every read attempt and the matching write, -/// which matters when the consumer is updating the mapfile in lockstep. -pub const DEFAULT_PIPELINE_DEPTH: usize = 4; +/// arbitrary buffered work. `16` matches the depth needed for UHD-scale +/// mux where WritebackFile sync_file_range on NFS can stall the consumer; +/// sweep uses [`DEFAULT_PIPELINE_DEPTH`] directly, mux should use this +/// or deeper if ISO read is moved to a separate producer thread. Patch +/// should usually use [`WRITE_THROUGH_DEPTH`] (`1`) instead — write-through +/// gives clean back-pressure between every read attempt and the matching +/// write, which matters when the consumer is updating the mapfile in lockstep. +pub const DEFAULT_PIPELINE_DEPTH: usize = 32; /// Channel depth for write-through pipelines. Each `send` fully /// drains before the next can enqueue. Use this when the producer diff --git a/src/io/writeback_file.rs b/src/io/writeback_file.rs index 8c0bfcc..2d083b0 100644 --- a/src/io/writeback_file.rs +++ b/src/io/writeback_file.rs @@ -27,7 +27,7 @@ use std::path::Path; use super::writeback::WritebackPipeline; -const CHUNK_BYTES: u64 = 32 * 1024 * 1024; +const WRITEBACK_CHUNK_BYTES: u64 = 32 * 1024 * 1024; pub(crate) struct WritebackFile { file: File, @@ -42,7 +42,7 @@ impl WritebackFile { /// or appended files). pub(crate) fn new(mut file: File) -> io::Result { let pos = file.stream_position()?; - let pipeline = WritebackPipeline::new(&file, pos, CHUNK_BYTES); + let pipeline = WritebackPipeline::new(&file, pos, WRITEBACK_CHUNK_BYTES); Ok(Self { file, pipeline,