pub struct JournalIO<'a> {
pub ffs: &'a FastFileSystemInner,
}Expand description
A handle for performing journal I/O operations.
The journal is used to provide crash consistency by recording intended changes before they are committed to the main file system. This structure provides an interface for reading from and writing to the journal region of the disk.
Fields§
§ffs: &'a FastFileSystemInnerA reference to the file system.
Implementations§
Source§impl JournalIO<'_>
impl JournalIO<'_>
Sourcepub fn write_metadata_block(
&self,
lba: LogicalBlockAddress,
block: &[u8; 4096],
) -> Result<(), KernelError>
pub fn write_metadata_block( &self, lba: LogicalBlockAddress, block: &[u8; 4096], ) -> Result<(), KernelError>
Writes a metadata block into the journal.
This function records a 4 KiB block of metadata at the specified logical block address (LBA) in the journal. The block is stored as part of the write-ahead log, ensuring that metadata updates can be safely replayed in case of a crash.
Sourcepub fn read_journal(
&self,
lba: LogicalBlockAddress,
b: &mut [u8; 4096],
) -> Result<(), KernelError>
pub fn read_journal( &self, lba: LogicalBlockAddress, b: &mut [u8; 4096], ) -> Result<(), KernelError>
Reads a journal block from the disk.
This function retrieves a 4 KiB block from the journal at the given logical block address (LBA) and copies it into the provided buffer. It is primarily used during recovery to replay logged operations and restore the file system to a consistent state.