befs_find_brun_dblindirect(9)
bestie, welcome to the Kernel API Manual page for befs_find_brun_dblindirect(9) β we're about to find a block run in the datastream and honestly it's giving main-character energy π
β¨
π¦ NAME π¦
befs_find_brun_dblindirect β find a block run in the datastream. no cap, that's the whole vibe π«Ά
β¨ SYNOPSIS β¨
int befs_find_brun_dblindirect (struct super_block *sb , const
befs_data_stream *data , befs_blocknr_t blockno , befs_block_run *run );
πΈ ARGUMENTS πΈ
sbβ the superblock.dataβ the datastream.blocknoβ the blocknumber to find.runβ The found run is passed back through this pointer.
π DESCRIPTION π
Okay so this function finds the block run that starts at file block number blockno in the file represented by the datastream data, if that blockno is in the double-indirect region of the datastream. literally that's the mission π«
Return value is BEFS_OK if the blockrun is found, BEFS_ERR otherwise. periodt.
Algorithm: The block runs in the double-indirect region are different. They are always allocated 4 fs blocks at a time, so each block run maps a constant amount of file data. This means that we can directly calculate how many block runs into the double-indirect region we need to go to get to the one that maps a particular filesystem block. iconic shortcut behavior, ngl π₯
We do this in two stages. First we calculate which of the inode addresses in the double-indirect block will point us to the indirect block that contains the mapping for the data, then we calculate which of the inode addresses in that indirect block maps the data block we are after. two-stage girly math, we love to see it π§
Oh, and once we've done that, we actually read in the blocks that contain the inode addresses we calculated above. Even though the double-indirect run may be several blocks long, we can calculate which of those blocks will contain the index we are after and only read that one. We then follow it to the indirect block and perform a similar process to find the actual block run that maps the data block we are interested in. not us being efficient and only reading the one block we need ππ
Then we offset the run as in befs_find_brun_array and we are done. slay π
π SEE ALSO π
- Kernel file
./fs/befs/datastream.c befs_read_datastream(9)befs_fblock2brun(9)befs_count_blocks(9)befs_find_brun_direct(9)befs_find_brun_indirect(9)
mwah π this page comes from the ./fs/befs source tree, dated October 2026, and it's the befs_find_brun_dblindirect(9) page β bye bestie, go read some block runs! π«Άπ
π¦ 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