ext2_block_to_path(9)
π NAME π
okay so bestie, this is ext2_block_to_path(9) from the Kernel API Manual, and it is literally here to parse the block number into an array of offsets. periodt π
β¨ SYNOPSIS β¨
int ext2_block_to_path (struct inode *inode , long i_block , int
offsets[4] , int *boundary );
π ARGUMENTS π
inodeβ the inode in question, but bestie we are only interested in its superblock πi_blockβ the block number to be parsed, no capoffsetsβ the array where the offsets get stored πboundaryβ set this non-zero if the referred-to block is likely to be followed (on disk) by an indirect block. To store the locations of file's data ext2 uses a data structure common for UNIX filesystems - tree of pointers anchored in the inode, with data blocks at leaves and indirect blocks in intermediate nodes. This function translates the block number into path in that tree - return value is the path length andoffsets[n]is the offset of pointer to(n+1)th node in the nth one. If block is out of range (negative or too large) warning is printed and zero returned. π«Ά
π«Ά NOTE π«Ά
function doesn't find node addresses, so no IO is needed. All we need to know is the capacity of indirect blocks (taken from the inode->i_sb). lowkey iconic that it stays IO-free β¨
π SEE ALSO π
Kernel file ./fs/ext2/inode.c:
ext2_get_branch(9)ext2_find_near(9)ext2_find_goal(9)ext2_blks_to_allocate(9)ext2_alloc_blocks(9)ext2_alloc_branch(9)ext2_splice_branch(9)ext2_find_shared(9)ext2_free_data(9)ext2_free_branches(9)
this cutie comes from ./fs/ext2 and is dated October 2026 β mwah ππΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms