pub struct FileSizing {
pub logical: u64,
pub allocated: u64,
pub unique: Option<u64>,
pub sharing: Sharing,
pub inode: InodeId,
pub nlink: u64,
pub clone_id: Option<u64>,
pub clone_refcount: Option<u32>,
}Expand description
What one file costs, and what dies with it.
Fields§
§logical: u64Logical length (st_size / ATTR_FILE_DATALENGTH).
allocated: u64Allocated bytes, counting shared blocks in full. On platforms without allocation metadata the fallback uses logical length as an estimate.
unique: Option<u64>Bytes private to this inode. Unlinking one of several hardlinks does not
free them; callers must also account for nlink. None when unsupported.
sharing: Sharing§inode: InodeId§nlink: u64§clone_id: Option<u64>Identifies the clone group this file’s blocks belong to, when the
platform reports one. IDs are scoped to inode.dev and to the observation;
they are not durable content identities.
clone_refcount: Option<u32>Live inodes in this file’s clone group, itself included, when the
platform reports it (APFS ATTR_CMNEXT_CLONE_REFCNT). At most one
means no other file shares these blocks: whatever is not private is
held by filesystem snapshots, and is freed once those snapshots go.
Implementations§
Source§impl FileSizing
impl FileSizing
Blocks shared with other inodes, when known.
Sourcepub fn snapshot_held(&self) -> Option<u64>
pub fn snapshot_held(&self) -> Option<u64>
Shared bytes that no other live file holds, only snapshots. None
when the platform does not report the clone group’s size, or when the
group’s size cannot tell a snapshot from a live file.
APFS counts only the files still in an unmodified clone group. A clone that is written to leaves the group and gets a new clone id, while it keeps sharing every block it did not rewrite. Partly rewriting a clone therefore leaves both files partly shared with a refcount of 1 each. A store blob is never written after it is stored, so a blob that is partly shared was partly rewritten through a live clone, and its shared bytes stay unknown. Appending to a clone leaves the blob fully shared with a refcount of 1, which reads the same as a snapshot and is counted as one (kunobi-ninja/kache#1195).
Sourcepub fn frees_nothing(&self) -> bool
pub fn frees_nothing(&self) -> bool
True when deleting this file alone reclaims nothing.