Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix block bitmap area calculation #638

Merged
merged 7 commits into from
Aug 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Take reserved blocks into account for disk usage
vinc committed Jun 6, 2024
commit d0865f6a4133c891cb22dee8ec54aa3311654c66
9 changes: 7 additions & 2 deletions src/sys/fs/super_block.rs
Original file line number Diff line number Diff line change
@@ -27,13 +27,18 @@ impl SuperBlock {

pub fn new() -> Option<Self> {
if let Some(ref dev) = *super::block_device::BLOCK_DEVICE.lock() {
Some(Self {
let mut sb = Self {
signature: SIGNATURE,
version: super::VERSION,
block_size: dev.block_size() as u32,
block_count: dev.block_count() as u32,
alloc_count: 0,
})
};

// Reserved blocks
sb.alloc_count = sb.data_area() - 1;

Some(sb)
} else {
None
}