nilfs_btnod...e_change_key(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 of ctxt. 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:


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