nilfs_btnod...e_change_key(9)
π nilfs_btnode_prepare_change_key(9) π
okay so you're in the Kernel API Manual bestie, and this page is literally about nilfs_btnode_prepare_change_key β the pre-game ritual before a b-tree node block gets a whole new search key. it's giving "let me get ready before I move" energy β¨
πΈ NAME πΈ
nilfs_btnode_prepare_change_key β prepare to change the search key of a b-tree node block π
π¦ SYNOPSIS π¦
int nilfs_btnode_prepare_change_key (struct address_space *btnc , struct
nilfs_btnode_chkey_ctxt *ctxt );
β¨ ARGUMENTS β¨
btncβ the page cache where the b-tree node block is buffered. that's its home base πctxtβ the structure used for exchanging context information for the key change. it's the group chat carrying all the deets π«Ά
π DESCRIPTION π
so nilfs_btnode_prepare_change_key prepares to move the contents of the b-tree node block of the old key given in the "oldkey" member of ctxt over to the position of the new key given in the "newkey" member of ctxt, inside the page cache btnc. periodt. π
quick lore drop: the key of the block is an index in units of blocks, and if the page size and block size match, it matches the page index in the page cache. iykyk π₯
now for the actual plan of action, bestie:
- if the page size and block size match, this function attempts to move the entire folio, and in preparation for this, inserts the original folio into the new index of the cache. main character move fr fr π
- if this insertion fails, or if the page size and block size are different, it falls back to a copy preparation using
nilfs_btnode_create_block, inserts a new block at the position corresponding to"newkey", and stores the buffer head pointer in the"newbh"member ofctxt. plan B ate, no cap π
heads up bestie, note that the current implementation does not support folio sizes larger than the page size. that's just how it is rn, don't come for me π
π RETURN π
0 on success π β or one of these negative error codes when it's not slaying:
-EIOβ I/O error (metadata corruption). π-ENOMEMβ insufficient memory available. the struggle π
π§ SEE ALSO π§
kernel file ./fs/nilfs2/btnode.c, plus these iconic little functions:
nilfs_init_btnc_inode(9)nilfs_btnode_delete(9)nilfs_btnode_commit_change_key(9)nilfs_btnode_abort_change_key(9)
and that's the whole vibe check, bestie π¦ this page lives under ./fs/nilfs2, dated October 2026, and it's part of the Kernel API Manual β go forth and change those keys, you absolute icon ππβ
π¦ 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