Expand description
on-disk layout of the file system’s metadata structures.
This module defines the on-disk layout of the file system’s core metadata structures. These types represent raw disk-resident data such as the superblock, block/inode allocation bitmaps, and inode table. Each struct in this module is tightly packed and designed to match the exact binary layout used by the file system when persisting and loading from disk.
This module defines MetaData trait, and support MetaData::load
method, allowing them to be generically loaded from a logical block address
(LBA).
§Examples of accessing metadata.
use crate::ffs::disk_layout::{MetaData, BlockBitmap};
let block_bitmap = BlockBitmap::load(ffs, lba)?; // read BlockPointsTo<BlockBitMap> from lba.
{ // READ
let guard = block_bitmap.read(); // reading metadata does not requires transaction.
assert!(guard.is_allocated(0));
}
{ // WRITE
let tx = ffs.open_transaction(); // Open a new transaction. Only a single transaction can be existed.
let mut guard = block_bitmap.write(&tx); // writing metadata requires transaction.
guard.try_allocate(1);
guard.submit(); // Submit the modified change to the transaction.
}Structs§
- Block
Bitmap - Represents the on-disk block allocation bitmap for the file system.
- Directory
Block - Represents a block that contains multiple directory entries.
- Directory
Block Entry - Represent a single directory entry within a directory block.
- Indirect
Block - Represents an indirect block in the filesystem.
- Inode
- Represent a single inode within a inode array.
- Inode
Array - Represents a fixed-size array of inodes loaded from a block.
- Inode
Bitmap - Represents the on-disk inode allocation bitmap for the file system.
- Journal
Sb - Represents the on-disk metadata for the journal superblock.
- Journal
TxBegin - Represents a journal transaction header used to track modified blocks.
- Journal
TxEnd - Represents a journal transaction is ended.
- Super
Block - On-disk representation of the superblock of the Fast File System (FFS).