Skip to main content

Module superblock

Module superblock 

Source
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§

BackupRoot
A single backup root entry from the superblock’s super_roots array.
Superblock
Parsed btrfs superblock.

Enums§

ChecksumType
Checksum algorithm used by the filesystem, stored in the superblock’s csum_type field.

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 true if the superblock buffer has valid magic and a matching checksum for whatever algorithm its csum_type field declares.
write_superblock_all_mirrors
Write a superblock buffer to all mirrors that fit within the device.