MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / dealloc

Method dealloc

easy-fs/src/bitmap.rs:56–64  ·  view source on GitHub ↗
(&self, block_device: &Arc<dyn BlockDevice>, bit: usize)

Source from the content-addressed store, hash-verified

54 }
55
56 pub fn dealloc(&self, block_device: &Arc<dyn BlockDevice>, bit: usize) {
57 let (block_pos, bits64_pos, inner_pos) = decomposition(bit);
58 get_block_cache(block_pos + self.start_block_id, Arc::clone(block_device))
59 .lock()
60 .modify(0, |bitmap_block: &mut BitmapBlock| {
61 assert!(bitmap_block[bits64_pos] & (1u64 << inner_pos) > 0);
62 bitmap_block[bits64_pos] -= 1u64 << inner_pos;
63 });
64 }
65
66 pub fn maximum(&self) -> usize {
67 self.blocks * BLOCK_BITS

Callers 1

dealloc_dataMethod · 0.45

Calls 5

decompositionFunction · 0.85
get_block_cacheFunction · 0.85
cloneFunction · 0.85
modifyMethod · 0.80
lockMethod · 0.80

Tested by

no test coverage detected