mirror of
https://github.com/rustfs/rustfs.git
synced 2026-12-03 06:36:35 +00:00
fix(ecstore): bound readahead on cold shard window reads
This commit is contained in:
@@ -15274,11 +15274,12 @@ async fn batch_shard_pread_blocking(requests: Vec<PermittedShardPreadRequest>) -
|
||||
metrics.as_deref(),
|
||||
LocalBatchReadStage::Read,
|
||||
|| {
|
||||
// Preload the requested window before reading it. Kernel
|
||||
// readahead is advisory and may still extend past the
|
||||
// window, so the tail is reclaimed after the read below.
|
||||
// Preload just this window. Disable automatic readahead
|
||||
// on this descriptor so pread does not start a second
|
||||
// read past the window while the explicit hint is in flight.
|
||||
#[cfg(target_os = "linux")]
|
||||
if let (Ok(start), Ok(len)) = (u64::try_from(offset), u64::try_from(length)) {
|
||||
let _ = rustix::fs::fadvise(&file, 0, None, rustix::fs::Advice::Random);
|
||||
let _ = rustix::fs::fadvise(
|
||||
&file,
|
||||
start,
|
||||
|
||||
Reference in New Issue
Block a user