Skip to main content

subvolume_list

Function subvolume_list 

Source
pub fn subvolume_list(fd: BorrowedFd<'_>) -> Result<Vec<SubvolumeListItem>>
Expand description

List all user subvolumes and snapshots in the filesystem referred to by fd by walking the root tree.

Two tree-search passes are made:

  1. ROOT_ITEM_KEY — reads each subvolume’s metadata (generation, flags, UUIDs, creation time).
  2. BTRFS_ROOT_BACKREF_KEY — reads each subvolume’s parent ID and leaf name.

Subvolumes for which no backref is found are still included; their parent_id, dir_id, and name will be zeroed / empty.

Requires CAP_SYS_ADMIN.