pub struct Jbd2Dev<B: BlockDevice> { /* private fields */ }Expand description
Block device proxy that optionally routes metadata writes through JBD2.
Implementations§
Source§impl<B: BlockDevice> Jbd2Dev<B>
impl<B: BlockDevice> Jbd2Dev<B>
Sourcepub fn initial_jbd2dev(_mode: u8, block_dev: B, use_journal: bool) -> Self
pub fn initial_jbd2dev(_mode: u8, block_dev: B, use_journal: bool) -> Self
Creates a new JBD2 block device proxy.
Sourcepub fn is_use_journal(&self) -> bool
pub fn is_use_journal(&self) -> bool
Returns whether journal support is enabled.
Sourcepub fn journal_sequence(&self) -> Option<u32>
pub fn journal_sequence(&self) -> Option<u32>
Returns the current journal transaction sequence if journal is active.
Sourcepub fn journal_replay(&mut self)
pub fn journal_replay(&mut self)
Replays the journal if the proxy is configured to use it.
Sourcepub fn set_journal_use(&mut self, use_journal: bool)
pub fn set_journal_use(&mut self, use_journal: bool)
Enables or disables journal use at runtime.
Sourcepub fn set_journal_superblock(
&mut self,
super_block: JournalSuperBllockS,
journal_start_block: AbsoluteBN,
)
pub fn set_journal_superblock( &mut self, super_block: JournalSuperBllockS, journal_start_block: AbsoluteBN, )
Installs the journal superblock so JBD2 state can be initialized lazily.
Sourcepub fn umount_commit(&mut self)
pub fn umount_commit(&mut self)
Commits all buffered journal transactions during unmount.
Sourcepub fn write_block(
&mut self,
block_id: AbsoluteBN,
is_metadata: bool,
) -> Ext4Result<()>
pub fn write_block( &mut self, block_id: AbsoluteBN, is_metadata: bool, ) -> Ext4Result<()>
Writes the current internal block buffer.
Sourcepub fn read_block(&mut self, block_id: AbsoluteBN) -> Ext4Result<()>
pub fn read_block(&mut self, block_id: AbsoluteBN) -> Ext4Result<()>
Reads one block through the cached inner device.
Sourcepub fn buffer_mut(&mut self) -> &mut [u8]
pub fn buffer_mut(&mut self) -> &mut [u8]
Returns the cached block buffer mutably.
Sourcepub fn read_blocks(
&mut self,
buf: &mut [u8],
block_id: AbsoluteBN,
count: u32,
) -> Ext4Result<()>
pub fn read_blocks( &mut self, buf: &mut [u8], block_id: AbsoluteBN, count: u32, ) -> Ext4Result<()>
Reads multiple blocks directly.
Sourcepub fn write_blocks(
&mut self,
buf: &[u8],
block_id: AbsoluteBN,
count: u32,
is_metadata: bool,
) -> Ext4Result<()>
pub fn write_blocks( &mut self, buf: &[u8], block_id: AbsoluteBN, count: u32, is_metadata: bool, ) -> Ext4Result<()>
Writes multiple blocks, optionally journaling metadata buffers.
Sourcepub fn cantflush(&mut self) -> Ext4Result<()>
pub fn cantflush(&mut self) -> Ext4Result<()>
Flushes the inner cached device.
Sourcepub fn total_blocks(&self) -> u64
pub fn total_blocks(&self) -> u64
Returns the total number of device blocks.
Sourcepub fn block_size(&self) -> u32
pub fn block_size(&self) -> u32
Returns the underlying device block size.
Sourcepub fn current_time(&self) -> Ext4Result<Ext4Timestamp>
pub fn current_time(&self) -> Ext4Result<Ext4Timestamp>
Returns the current timestamp from the underlying device.