pub struct SysChunk {
pub key: DiskKey,
pub length: u64,
pub owner: u64,
pub stripe_len: u64,
pub chunk_type: u64,
pub num_stripes: u16,
pub sub_stripes: u16,
pub stripes: Vec<Stripe>,
}Expand description
A decoded chunk map entry from the sys_chunk_array: the chunk’s logical
key, its geometry, and its stripes. This is the bootstrap logical→physical
record for a SYSTEM block group.
Fields§
§key: DiskKeyThe chunk item’s disk key; key.offset is the chunk’s logical start.
length: u64length — the chunk’s logical byte span.
owner: u64owner — the objectid that owns the chunk (2 = the extent tree).
stripe_len: u64stripe_len — the RAID stripe unit (irrelevant for single/DUP mapping).
chunk_type: u64type — the block-group flags (BLOCK_GROUP_SYSTEM | BLOCK_GROUP_DUP,
etc.).
num_stripes: u16num_stripes — the number of physical stripes that follow.
sub_stripes: u16sub_stripes — RAID10 sub-stripe count (1 for single/DUP).
stripes: Vec<Stripe>The decoded stripes (physical placements).
Implementations§
Source§impl SysChunk
impl SysChunk
Sourcepub fn logical_to_physical(&self, logical: u64) -> Option<u64>
pub fn logical_to_physical(&self, logical: u64) -> Option<u64>
Translate a logical address logical to a physical byte offset on the
first stripe’s device, for single-device single/DUP chunks.
Returns None if logical lies outside this chunk’s [key.offset .. key.offset + length) span, or if the chunk has no stripes. For DUP there
are two stripes on the same device; the first mirror (stripes[0]) is
chosen (both hold identical data). Multi-device / striped RAID mapping is
deferred to a later phase.
Sourcepub fn parse_array(
block: &[u8],
array_off: usize,
array_size: u32,
) -> Vec<SysChunk>
pub fn parse_array( block: &[u8], array_off: usize, array_size: u32, ) -> Vec<SysChunk>
Parse the packed sys_chunk_array starting at array_off for
array_size valid bytes, yielding one SysChunk per
[disk_key][chunk + stripes] entry.
Bounds-checked and panic-free: parsing stops at the first entry that does
not wholly fit within the declared array_size (or the block), and an
absurd num_stripes is capped by the remaining bytes — a malformed array
truncates rather than over-reads or panics.