Skip to main content

check_write

Function check_write 

Source
pub fn check_write(
    limits: WriteLimits,
    already_written: u64,
    bytes: u64,
    available: Option<u64>,
) -> WriteVerdict
Expand description

Whether a write of bytes may proceed.

available is what the filesystem reports, or None when it could not be measured. An unmeasurable filesystem allows the write: a guard that cannot see has nothing to say, and refusing on it would block every write on any filesystem the probe cannot read. The other two ceilings still apply.

already_written counts the run so far, excluding this call.

Checked in that order on purpose. Running out of disk is the only one that harms anything outside this run, so it is reported first when more than one applies - a user reading “over the per-call limit” would go raise the limit, which is exactly wrong when the real problem is a full disk.