summaryrefslogtreecommitdiff
path: root/src/disk/allocation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/disk/allocation.rs')
-rw-r--r--src/disk/allocation.rs16
1 files changed, 8 insertions, 8 deletions
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;
}