summaryrefslogtreecommitdiff
path: root/ayafs-core/src/disk/allocation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ayafs-core/src/disk/allocation.rs')
-rw-r--r--ayafs-core/src/disk/allocation.rs14
1 files changed, 12 insertions, 2 deletions
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<u32> {
// 如果 triple indirect 块存在, 则尝试从中销毁一个块
@@ -300,6 +301,7 @@ impl AyaFS {
None
}
+ #[allow(unused)]
fn deallocate_from_triple_indirect(&mut self, triple_indirect_entry: u32) -> Option<u32> {
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<u32> {
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<u32> {
let indirect_entry = indirect_entry as usize;
if let Some(indirect_block) = self
@@ -521,6 +525,11 @@ impl AyaFS {
) -> Option<&CachedBlock<T>> {
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::<T>(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::<T>(block_index).unwrap() // 可以 unwrap 吧这里 ??
})