Fix doubly and triply indirect blocks

This commit is contained in:
pjht 2024-09-27 13:36:02 -05:00
parent c3fe557045
commit 04bb2e97c6
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A

View File

@ -194,7 +194,7 @@ impl Inode {
Some(block)
}
} else if block < (12 + num_sing_indir + num_doub_indir) as u32 {
let base_block = 12 - num_sing_indir;
let base_block = 12 + num_sing_indir;
let doub_indir_offset = (block as usize - base_block) / num_sing_indir;
let sing_indir_offset = (block as usize - base_block) % num_sing_indir;
let sing_indir_blocks = self
@ -210,7 +210,7 @@ impl Inode {
Some(block)
}
} else if block < (12 + num_sing_indir + num_doub_indir + num_trip_indir) as u32 {
let base_block = 12 - num_sing_indir;
let base_block = 12 + num_sing_indir + num_doub_indir;
let trip_indir_offset = (block as usize - base_block) / num_doub_indir;
let doub_indir_offset =
((block as usize - base_block) % num_doub_indir) / num_sing_indir;