pub struct FileExtentItem {
pub generation: u64,
pub ram_bytes: u64,
pub compression: CompressionType,
pub extent_type: FileExtentType,
pub body: FileExtentBody,
}Expand description
File extent descriptor, stored as EXTENT_DATA in the FS tree.
Key: (inode, EXTENT_DATA, file_offset). Describes how a range of file
bytes maps to on-disk storage. Extents can be inline (data embedded in the
item), regular (referencing a disk extent), or prealloc (reserved but
unwritten).
Fields§
§generation: u64Generation when this extent was allocated.
ram_bytes: u64Uncompressed size of the data in this extent.
compression: CompressionTypeCompression algorithm applied to the on-disk data.
extent_type: FileExtentTypeWhether the extent is inline, regular, or preallocated.
body: FileExtentBodyType-specific extent location.
Implementations§
Source§impl FileExtentItem
impl FileExtentItem
Sourcepub const HEADER_SIZE: usize = 21
pub const HEADER_SIZE: usize = 21
Size of the fixed btrfs_file_extent_item header (the bytes before
disk_bytenr / inline data).
Sourcepub const REGULAR_SIZE: usize = 53
pub const REGULAR_SIZE: usize = 53
Size of a regular or prealloc EXTENT_DATA item: 21-byte header plus
32-byte body (disk_bytenr, disk_num_bytes, offset, num_bytes).
Sourcepub fn to_bytes_regular(
generation: u64,
ram_bytes: u64,
compression: CompressionType,
prealloc: bool,
disk_bytenr: u64,
disk_num_bytes: u64,
offset: u64,
num_bytes: u64,
) -> Vec<u8> ⓘ
pub fn to_bytes_regular( generation: u64, ram_bytes: u64, compression: CompressionType, prealloc: bool, disk_bytenr: u64, disk_num_bytes: u64, offset: u64, num_bytes: u64, ) -> Vec<u8> ⓘ
Serialize a regular or prealloc EXTENT_DATA item (53 bytes).
prealloc selects BTRFS_FILE_EXTENT_PREALLOC instead of the default
BTRFS_FILE_EXTENT_REG. disk_bytenr of 0 represents a hole.
Sourcepub fn to_bytes_inline(
generation: u64,
ram_bytes: u64,
compression: CompressionType,
data: &[u8],
) -> Vec<u8> ⓘ
pub fn to_bytes_inline( generation: u64, ram_bytes: u64, compression: CompressionType, data: &[u8], ) -> Vec<u8> ⓘ
Serialize an inline EXTENT_DATA item: 21-byte header followed by
data bytes (raw or already-compressed/framed payload).
ram_bytes is the uncompressed file size covered by this inline
extent. compression indicates whether data is compressed.
Trait Implementations§
Source§impl Clone for FileExtentItem
impl Clone for FileExtentItem
Source§fn clone(&self) -> FileExtentItem
fn clone(&self) -> FileExtentItem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more