Skip to main content

Module chunk

Module chunk 

Source
Expand description

§Logical-to-physical address mapping for btrfs filesystems

Btrfs maps logical addresses to physical device offsets through chunk items stored in the chunk tree. The superblock embeds a small subset of the chunk tree (the system chunk array) to bootstrap access to the full chunk tree.

This module provides a ChunkTreeCache that resolves logical addresses to physical offsets, seeded from the sys_chunk_array and then populated from the full chunk tree.

Structs§

CallerOverlay
A range of caller bytes that overlays a data column slot.
ChunkMapping
A chunk mapping: maps a range of logical addresses to physical device locations.
ChunkTreeCache
Cache of chunk tree mappings for resolving logical to physical addresses.
ParityDataColumn
One data column slot in a ParityRow.
ParityPlan
Per-row write plan for RAID5/RAID6 chunks.
ParityRow
One physical row of a RAID5/RAID6 chunk that the write touches.
ParityTarget
One parity column slot to write.
Stripe
A single stripe in a chunk mapping, identifying a physical location on a device.
StripePlacement
One per-device write or read produced by ChunkTreeCache::plan_write or ChunkTreeCache::plan_read.

Enums§

ChunkProfile
RAID profile derived from a chunk’s chunk_type flags.
ParityKind
Which parity polynomial a ParityTarget holds.
WritePlan
Result of ChunkTreeCache::plan_write.

Functions§

chunk_item_bytes
Serialize a ChunkMapping into the on-disk btrfs_chunk byte layout (48-byte fixed header + num_stripes * 32-byte stripes).
parse_chunk_item
Parse a chunk item (btrfs_chunk + stripes) from a raw byte buffer.
seed_from_sys_chunk_array
Seed a ChunkTreeCache from the superblock’s sys_chunk_array.
sys_chunk_array_append
Append a single (disk_key, btrfs_chunk) record to the superblock’s sys_chunk_array byte buffer.
sys_chunk_array_contains
Walk the superblock’s sys_chunk_array and return true if it already contains a record whose disk_key.offset matches bg_start (i.e. the system chunk starting at that logical address is already part of the bootstrap snippet).