Skip to main content

SysChunk

Struct SysChunk 

Source
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: DiskKey

The chunk item’s disk key; key.offset is the chunk’s logical start.

§length: u64

length — the chunk’s logical byte span.

§owner: u64

owner — the objectid that owns the chunk (2 = the extent tree).

§stripe_len: u64

stripe_len — the RAID stripe unit (irrelevant for single/DUP mapping).

§chunk_type: u64

type — the block-group flags (BLOCK_GROUP_SYSTEM | BLOCK_GROUP_DUP, etc.).

§num_stripes: u16

num_stripes — the number of physical stripes that follow.

§sub_stripes: u16

sub_stripes — RAID10 sub-stripe count (1 for single/DUP).

§stripes: Vec<Stripe>

The decoded stripes (physical placements).

Implementations§

Source§

impl SysChunk

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for SysChunk

Source§

fn clone(&self) -> SysChunk

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SysChunk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SysChunk

Source§

impl PartialEq for SysChunk

Source§

fn eq(&self, other: &SysChunk) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SysChunk

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.