Skip to main content

reclaim

Function reclaim 

Source
fn reclaim(dir: &Path, min_free: f64) -> Result<Vec<PathBuf>>
Expand description

Drop the oldest blocks, across every signal, until the volume is back above min_free. Returns what was unlinked, oldest first.

min_free is a parameter only so a test can say “pretend the volume is full” without one; the sweep passes MIN_FREE and nothing else ever will.

ponytail: one statfs per unlink and one full scan per sweep that trips. Both are O(blocks) on a path that only runs when the volume is nearly full, where the unlink dominates anyway. If a volume ever spends long enough down here for that to matter, the fix is to stop after freeing a target fraction in one pass rather than re-measuring per block.