Skip to main content

compute_min_size

Function compute_min_size 

Source
pub fn compute_min_size(dev_extents: &[(u64, u64)]) -> u64
Expand description

Compute the minimum device size from a list of device extents.

Each entry is (physical_start, length). The list must be sorted by ascending physical_start (as returned by the device tree).

The algorithm sums all extent lengths (plus 1 MiB base), then tries to relocate tail extents into holes to reduce the total. Matches the btrfs-progs min-dev-size logic.