d_add(9)
π d_add(9) β add dentry to hash queues π
okay bestie, welcome to the Kernel API Manual, section d_add(9). this one's short and sweet β a little two-ingredient recipe for putting a dentry where the kernel can find it later. no cap, it's like the "file it in the right drawer" function of the dcache. ποΈβ¨
πΈ NAME πΈ
d_add β add dentry to hash queues. that's it, that's the whole vibe. it hashes the dentry and blesses it with an inode. slay.
β¨ SYNOPSIS β¨
void d_add (struct dentry *entry , struct inode *inode );
return type void, meaning it gives you nothing back and honestly? iconic. it just does the thing and leaves. π
π ARGUMENTS π
entryβ the dentry you're adding, bestie. this is the dentry to add. she's the main character here. πinodeβ the inode to attach to this dentry. they're getting linked up, it's giving soulmate energy fr fr. π«Ά
π¦ DESCRIPTION π¦
so what does it actually do? two things, and honestly they're both kind of a big deal:
- it adds the
entryto the hash queues, so future lookups can actually find her instead of wandering around lost π - it initializes inode β your
inodeargument gets attached to the dentry
and the little lore drop you need to know: the entry was actually filled in earlier during d_alloc. so by the time you get here, the dentry's already been built β you're not creating anything, you're just filing her. lowkey efficient. β
not me emphasizing this: the filling-in already happened ind_alloc.d_adddoesn't build the dentry, it just hashes it and hooks up the inode. don't come for me if you skip thed_allocstep, i warned you π
π SEE ALSO π
the whole friend group, in order, no one gets left out π:
- kernel file
./fs/dcache.c d_drop(9)dentry_kill(9)__move_to_shrink_list(9)d_find_any_alias(9)d_find_alias(9)prune_dcache_sb(9)shrink_dcache_sb(9)enum d_walk_ret(9)d_walk(9)path_has_submounts(9)shrink_dcache_tree(9)d_invalidate(9)__d_alloc(9)d_alloc(9)d_alloc_pseudo(9)d_instantiate(9)d_obtain_alias(9)d_obtain_root(9)d_add_ci(9)d_same_name(9)__d_lookup_rcu(9)d_lookup(9)__d_lookup(9)d_hash_and_lookup(9)d_delete(9)d_rehash(9)d_ancestor(9)d_splice_alias(9)is_subdir(9)
and that's the page!! π this lil gem comes to you from source ./fs, dated October 2026 β so yeah, mark your calendar bestie, future vibes only. go forth and hash those dentries, i'm literally obsessed with you πβ¨π¦πΈπ«Ά
π¦ 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