Skip to main content

min_dev_size

Function min_dev_size 

Source
pub fn min_dev_size(fd: BorrowedFd<'_>, devid: u64) -> Result<u64>
Expand description

Compute the minimum size to which device devid can be shrunk.

Walks the device tree for all DEV_EXTENT_KEY items belonging to devid, sums their lengths, then adjusts for extents that sit beyond the sum by checking whether they can be relocated into holes closer to the start of the device. The algorithm matches btrfs inspect-internal min-dev-size from btrfs-progs.

Requires CAP_SYS_ADMIN.