find_inode_nowait(9)
π¦ find_inode_nowait(9) β a Kernel API Manual moment π¦
Okay bestie, this one is so niche but honestly kind of iconic. Itβs the manual page for find_inode_nowait, and weβre about to make inode-cache searching make sense. No cap.
π NAME π
find_inode_nowait β find an inode in the inode cache. Thatβs the whole vibe. π
β¨ SYNOPSIS β¨
struct inode * find_inode_nowait (struct super_block *sb , u64 hashval , int (*match)(struct inode *, u64, void *) , void *data );
π ARGUMENTS π
sbβ super block of file system to search. Like, which filesystemβs cache are we digging through? ποΈhashvalβ hash value (usually inode number) to search for. This is the target. π―matchβ callback used for comparisons between inodes. Itβs the little judge that says yes/no/stop. βοΈdataβ opaque data pointer to pass tomatch. Extra luggage, but make it cute. π§³
π DESCRIPTION π
So weβre searching for the inode specified by hashval and data in the inode cache. The helper function match is the one doing the vibe check: it returns 0 if the inode does not match, 1 if the inode does match, and -1 if the search should be stopped. Very demure, very mindful. π§
But bestie, match has responsibilities. It must be responsible for taking the i_lock spin_lock and checking i_state for an inode being freed or being initialized, and incrementing the reference count before returning 1. It also must not sleep, since it is called with the inode_hash_lock spinlock held. Literally do not nap on the job. π
π¨ Warning-ish energy:matchmust not sleep β itβs running with theinode_hash_lockspinlock held. Also, the reference-count increment and thei_lock/i_statechecks are onmatchto handle. No passing the buck. π
This is a even more generalized version of ilookup5 when the function must never block --- find_inode can block in __wait_on_freeing_inode --- or when the caller can not increment the reference count because the resulting iput might cause an inode eviction. The tradeoff is that the match funtion must be very carefully implemented. Like, highkey carefully. π₯
π₯ SEE ALSO π₯
Kernel file ./fs/inode.c and the whole friend group:
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(9)iget5_locked_rcu(9)iget_locked(9)iunique(9)ihold(9)ilookup5_nowait(9)ilookup5(9)ilookup(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)
xoxo, bestie β source/version: ./fs π date: October 2026 π manual: find_inode_nowait(9)
π¦ 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