Skip to main content

filesystem_open_multi

Function filesystem_open_multi 

Source
pub fn filesystem_open_multi<R: Read + Seek>(
    devices: BTreeMap<u64, R>,
) -> Result<OpenFilesystem<R>>
Expand description

Open a multi-device btrfs filesystem from a map of devid -> handle.

All devices in the filesystem must be present in the map; the bootstrap fails with a clear error if the chunk tree references a devid that is not in the map. Each device’s superblock is read and its dev_item.devid is verified against the map key, and all devices’ fsid must match.

The “primary” superblock used for filesystem-wide fields (root, chunk_root, generation, etc.) is the one with the lowest devid.

§Errors

Returns an error if any superblock cannot be read, any device’s superblock disagrees with its map key or with the primary’s fsid, or the chunk tree references a devid not in the map.

§Panics

Panics if the in-memory device map is empty after the initial non-empty check (an internal invariant violation, not a runtime possibility).