iget5_locked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

bestie, this is the iget5_locked(9) page from the Kernel API Manual, and it's literally about obtaining an inode from a mounted file system. no cap. πŸ¦‹

🌸 SYNOPSIS 🌸

struct inode * iget5_locked (struct super_block *sb , u64 hashval , int
       (*test)(struct inode *, void *) , int (*set)(struct inode *, void *) ,
       void *data );

✨ ARGUMENTS ✨

  • sb β€” super block of file system. the whole vibe check starts here.
  • hashval β€” hash value (usually inode number) to get. iykyk, usually the inode number.
  • test β€” callback used for comparisons between inodes. it's giving "are these the same?"
  • set β€” callback used to initialize a new struct inode. fresh inode, who dis?
  • data β€” opaque data pointer to pass to test and set. just vibes and a pointer.

πŸŽ€ DESCRIPTION πŸŽ€

okay so the function searches for the inode specified by hashval and data in the inode cache, and if it's present it returns it with an increased reference count. slay. this is a generalized version of iget_locked for file systems where the inode number is not sufficient for unique identification of an inode. periodt. πŸ’…

if the inode is not present in the cache, it allocates and inserts a new inode and returns it locked, hashed, and with the I_NEW flag set. iconic behavior, honestly. the file system gets to fill it in before unlocking it via unlock_new_inode. 🫢

bestie, listen: note that both test and set are called with the inode_hash_lock held, so they can't sleep. no naps. not even a little one. 😭

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./fs/inode.c: inode_init_always_gfp(9), alloc_inode(9), drop_nlink(9), clear_nlink(9), set_nlink(9), inc_nlink(9), inode_sb_list_add(9), __insert_inode_hash(9), __remove_inode_hash(9), evict_inodes(9), new_inode(9), unlock_new_inode(9), lock_two_nondirectories(9), unlock_two_nondirectories(9), inode_insert5(9), iget5_locked_rcu(9), iget_locked(9), iunique(9), ihold(9), ilookup5_nowait(9), ilookup5(9), ilookup(9), find_inode_nowait(9), find_inode_rcu(9), find_inode_by_ino_rcu(9), iput(9), iput_not_last(9), bmap(9), inode_update_time(9), generic_update_time(9), atime_needs_update(9), file_remove_privs(9), current_time(9), file_update_time(9), file_modified_flags(9), file_modified(9), kiocb_modified(9), inode_init_owner(9), inode_owner_or_capable(9), inode_dio_wait(9), timestamp_truncate(9), inode_set_ctime_current(9), inode_set_ctime_deleg(9), in_group_or_capable(9), mode_strip_sgid(9), dump_inode(9). all the besties are here. 🀝


that's the whole page, bestie! this gem comes from ./fs, with the October 2026 version vibe, and yes β€” the source and date are giving very "footer but make it cute." πŸ’–βœ¨

πŸ“¦ where this page comes from