pub struct BitmapAllocator { /* private fields */ }Expand description
Simple bitmap-style allocator backed by a BTreeSet of free block IDs.
Implementations§
Source§impl BitmapAllocator
impl BitmapAllocator
Sourcepub fn new(total_blocks: u64) -> Self
pub fn new(total_blocks: u64) -> Self
Create a new allocator for total_blocks blocks.
Blocks 0..FIRST_DATA_BLOCK are reserved and never allocatable.
Sourcepub fn mark_allocated(&self, block_id: u64) -> FsResult<()>
pub fn mark_allocated(&self, block_id: u64) -> FsResult<()>
Mark a block as already allocated (used during mount/recovery).
Sourcepub fn free_count(&self) -> u64
pub fn free_count(&self) -> u64
Return the number of free blocks.
Trait Implementations§
Source§impl SlotAllocator for BitmapAllocator
impl SlotAllocator for BitmapAllocator
Auto Trait Implementations§
impl !Freeze for BitmapAllocator
impl RefUnwindSafe for BitmapAllocator
impl Send for BitmapAllocator
impl Sync for BitmapAllocator
impl Unpin for BitmapAllocator
impl UnsafeUnpin for BitmapAllocator
impl UnwindSafe for BitmapAllocator
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