From b8afa7cfb02b32278e268924e189170496f81c1b Mon Sep 17 00:00:00 2001 From: Chuyan Zhang Date: Thu, 23 Nov 2023 02:11:16 -0800 Subject: Add some callback (not finished) --- src/disk/allocation.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/disk/allocation.rs') diff --git a/src/disk/allocation.rs b/src/disk/allocation.rs index bfdba46..5643dd3 100644 --- a/src/disk/allocation.rs +++ b/src/disk/allocation.rs @@ -194,11 +194,8 @@ impl AyaFS { { let mut triple_indirect_block = triple_indirect_block.clone(); let mut block_modified = false; - for double_indirect_entry in triple_indirect_block - .block - .double_indirect - .iter_mut() - .rev() + for double_indirect_entry in + triple_indirect_block.block.double_indirect.iter_mut().rev() { // 如果这个位置的 double indirect 存在 if self.data_bitmap.query(*double_indirect_entry as usize) { @@ -212,8 +209,10 @@ impl AyaFS { return Some(block_index); // 成功则直接返回 } else { // 失败则把这个 double indirect 销毁 - let double_indirect_entry_to_deallocate = std::mem::replace(double_indirect_entry, 0); - self.data_bitmap.deallocate(double_indirect_entry_to_deallocate as usize); + let double_indirect_entry_to_deallocate = + std::mem::replace(double_indirect_entry, 0); + self.data_bitmap + .deallocate(double_indirect_entry_to_deallocate as usize); triple_indirect_block.dirty = true; block_modified = true; } @@ -246,7 +245,8 @@ impl AyaFS { } else { // 失败则把这个 indirect 销毁 let indirect_entry_to_deallocate = std::mem::replace(indirect_entry, 0); - self.data_bitmap.deallocate(indirect_entry_to_deallocate as usize); + self.data_bitmap + .deallocate(indirect_entry_to_deallocate as usize); double_indirect_block.dirty = true; block_modified = true; } -- cgit v1.2.3-70-g09d2