use super::*;
pub(super) struct SplitInfo {
pub(super) start_block: u32,
pub(super) phy_block: AbsoluteBN,
}
impl<'a> ExtentTree<'a> {
pub(super) fn calc_block_eh_max() -> u16 {
let hdr_size = Ext4ExtentHeader::disk_size();
let entry_size = Ext4Extent::disk_size(); (BLOCK_SIZE.saturating_sub(hdr_size) / entry_size) as u16
}
pub(super) fn get_node_start_block(node: &ExtentNode) -> u32 {
match node {
ExtentNode::Leaf { entries, .. } => {
if entries.is_empty() {
0
} else {
entries[0].ee_block
}
}
ExtentNode::Index { entries, .. } => {
if entries.is_empty() {
0
} else {
entries[0].ei_block
}
}
}
}
}