From 4c34414b26bf71e747ea3ecb2586645bab4aba52 Mon Sep 17 00:00:00 2001 From: Chuyan Zhang Date: Fri, 1 Dec 2023 19:42:13 -0800 Subject: Multiple bugfix, it works! --- ayafs-core/src/disk/allocation.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ayafs-core/src/disk/allocation.rs') diff --git a/ayafs-core/src/disk/allocation.rs b/ayafs-core/src/disk/allocation.rs index a187fad..6b7167a 100644 --- a/ayafs-core/src/disk/allocation.rs +++ b/ayafs-core/src/disk/allocation.rs @@ -255,6 +255,7 @@ impl AyaFS { Ok(()) } + #[allow(unused)] /// 从 inode 中删去最后一个 block pub(crate) fn deallocate_block_for(&mut self, inode: &mut Inode) -> Option { // 如果 triple indirect 块存在, 则尝试从中销毁一个块 @@ -300,6 +301,7 @@ impl AyaFS { None } + #[allow(unused)] fn deallocate_from_triple_indirect(&mut self, triple_indirect_entry: u32) -> Option { let triple_indirect_entry = triple_indirect_entry as usize; if let Some(triple_indirect_block) = self @@ -339,6 +341,7 @@ impl AyaFS { None } + #[allow(unused)] fn deallocate_from_double_indirect(&mut self, double_indirect_entry: u32) -> Option { let double_indirect_entry = double_indirect_entry as usize; if let Some(double_indirect_block) = self @@ -373,6 +376,7 @@ impl AyaFS { None } + #[allow(unused)] fn deallocate_from_indirect(&mut self, indirect_entry: u32) -> Option { let indirect_entry = indirect_entry as usize; if let Some(indirect_block) = self @@ -521,6 +525,11 @@ impl AyaFS { ) -> Option<&CachedBlock> { self.get_block_index(inode, block_index_within_inode) .map(|block_index| { + debug!( + "access_block(index: {}) found with global index {}", + block_index_within_inode, + block_index, + ); self.get_block::(block_index).unwrap() // 可以 unwrap 吧这里 ?? }) } @@ -533,8 +542,9 @@ impl AyaFS { self.get_block_index(inode, block_index_within_inode) .map(|block_index| { debug!( - "access_block_mut(index: {}) found", - block_index_within_inode + "access_block_mut(index: {}) found with global index {}", + block_index_within_inode, + block_index, ); self.get_block_mut::(block_index).unwrap() // 可以 unwrap 吧这里 ?? }) -- cgit v1.2.3-70-g09d2