Expand description
The count of the entries under a checkout, from which the free space a migration needs follows.
What:
The count of the entries under a checkout: every file, directory and link below its root, counted once each.
Why:
The free space a migration needs is the metadata of its entries (subvolume_preflight.rs), so the refusal for too little
space starts from how many entries the copy will write. The walk reads directory listings only, no file contents, and
follows no link, as the copy pass does not.
In TS you’d write (pseudocode):
const entries: number = countEntries(root); // readdir on each directory, one count per nameFunctions§
- count_
entries - What:
How many entries are below
root.&Pathborrows the path read-only (TS: astringargument);u64is an unsigned 64-bit integer (siblings:u32,usize). Why: A directory that cannot be listed (gone, or not readable) adds nothing, because the copy reports an unreadable directory with its own message and the preflight must not duplicate it.u64rather thanusizebecause the figure is multiplied into a byte count that is stored asu64in the filesystem facts. Gotcha: A link to a directory counts as one entry and its target is not walked, unlike a TSreaddirrecursion that followsstat; the work stack below replaces recursion so a deep tree cannot overflow the call stack.