Expand description
§Reading and parsing the btrfs superblock from a block device
The superblock is a 4096-byte structure stored at a fixed offset on disk (primary at 64 KiB, with mirrors at 64 MiB and 256 GiB). It contains the root pointers and metadata needed to bootstrap access to the rest of the filesystem.
Structs§
- Backup
Root - A single backup root entry from the superblock’s
super_rootsarray. - Superblock
- Parsed btrfs superblock.
Enums§
- Checksum
Type - Checksum algorithm used by the filesystem, stored in the superblock’s
csum_typefield.
Constants§
- SUPER_
MIRROR_ MAX - Maximum number of superblock mirrors (3: primary + 2 copies).
From kernel-shared/disk-io.h:
BTRFS_SUPER_MIRROR_MAX
Functions§
- csum_
superblock - Recompute the checksum of a superblock byte buffer in place.
- read_
superblock - Read and parse a btrfs superblock from a reader at the given mirror index (0, 1, or 2).
- read_
superblock_ at - Read and parse a btrfs superblock from a reader at an explicit byte offset.
- read_
superblock_ bytes - Read the raw 4096-byte superblock from the primary mirror into a byte buffer.
- read_
superblock_ bytes_ at - Read the raw 4096-byte superblock at an explicit byte offset.
- super_
mirror_ offset - Compute the byte offset of the superblock mirror at
index. - superblock_
generation - Extract the generation field from a raw superblock byte buffer.
- superblock_
is_ valid - Return
trueif the superblock buffer has valid magic and a matching checksum for whatever algorithm itscsum_typefield declares. - write_
superblock_ all_ mirrors - Write a superblock buffer to all mirrors that fit within the device.