pub struct FreeSpaceManager { /* private fields */ }
Expand description
Free space manager using dual RB-trees for efficient allocation and coalescing Matches the kernel implementation’s design for correctness
Implementations§
Source§impl FreeSpaceManager
impl FreeSpaceManager
Sourcepub fn initialize(&mut self, device_size: u64) -> Result<()>
pub fn initialize(&mut self, device_size: u64) -> Result<()>
Initialize with device size and initial free space
Sourcepub fn set_device_size(&mut self, device_size: u64)
pub fn set_device_size(&mut self, device_size: u64)
Set device size for bounds checking (used when rebuilding from scan)
Sourcepub fn allocate_sectors(&mut self, sectors_needed: u64) -> Result<u64>
pub fn allocate_sectors(&mut self, sectors_needed: u64) -> Result<u64>
Allocate sectors using best-fit algorithm
Sourcepub fn release_sectors(&mut self, start: u64, count: u64) -> Result<()>
pub fn release_sectors(&mut self, start: u64, count: u64) -> Result<()>
Release sectors back to free space pool with coalescing
Sourcepub fn get_total_free(&self) -> u64
pub fn get_total_free(&self) -> u64
Get total free space in bytes
Sourcepub fn get_fragmentation(&self) -> u32
pub fn get_fragmentation(&self) -> u32
Get fragmentation percentage
Sourcepub fn get_free_chunks_count(&self) -> usize
pub fn get_free_chunks_count(&self) -> usize
Get number of free chunks
Sourcepub fn get_largest_free_chunk(&self) -> u64
pub fn get_largest_free_chunk(&self) -> u64
Get largest free chunk in bytes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FreeSpaceManager
impl RefUnwindSafe for FreeSpaceManager
impl Send for FreeSpaceManager
impl Sync for FreeSpaceManager
impl Unpin for FreeSpaceManager
impl UnwindSafe for FreeSpaceManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more