gfs2_evict_inode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… gfs2_evict_inode(9) β€” like, the whole Kernel API Manual page but make it make sense

okay so bestie, this is gfs2_evict_inode, straight out of the Kernel API Manual, and it's literally about yeeting an inode out of the cache. yes. removing it. gone. bye. 🫢


✨ NAME ✨

gfs2_evict_inode β€” Remove an inode from cache. that's it, that's the vibe. it's giving eviction notice energy πŸ’…


🌸 SYNOPSIS 🌸

void gfs2_evict_inode (struct inode *inode );

literally one function, one pointer, zero drama (well, ok, a little drama, see the description) πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • inode β€” the inode to evict. the main character of this whole operation, ngl. it's the one getting removed from cache πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

so there are three cases to consider, and no you cannot skip any of them, this is the whole plot:

  1. i_nlink == 0, and we are the final opener β€” which means we must deallocate πŸ”₯
  2. i_nlink == 0, but we are not the final opener β€” so we cannot deallocate πŸ™ˆ
  3. i_nlink > 0 β€” case closed, that's it, that's the third one πŸ’€

okay but here's the twist: if the fs is read only, then we have to treat all cases as per case #3, because we are literally unable to do any deallocation. periodt. the inode will be deallocated by the next read/write node to attempt an allocation in the same resource group. iykyk 🌈

and then there's the lock situation, which the author is honestly so real about: we have to (at the moment) hold the inode's main lock to cover the gap between unlocking the shared lock on the iopen lock and taking the exclusive lock. the author would rather do a shared -> exclusive conversion on the iopen lock, but like, we can change that later. it's safe, just less efficient. no cap. ⭐

fr fr: the "less efficient" part is a real note from the original β€” safe, but slower. don't come for me, I'm just the messenger 🧚

πŸ”₯ SEE ALSO πŸ”₯

kernel file ./fs/gfs2/super.c and honestly a whole friend group of functions, all linked here, all iconic in their own right:

like, go read them, they're literally right there πŸ’œ


okay that's the page!! it lives in ./fs/gfs2 and this particular version is dated October 2026 β€” so yeah, future girlie energy 🌸✨ tysm for reading, mwah, go evict some inodes responsibly πŸ«ΆπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from