__d_alloc(9)
π __d_alloc(9) π
okay so bestie, welcome to the Kernel API Manual entry for __d_alloc(9) β yes that's the actual title, no we're not skipping it, it's iconic and it's staying. this one is short and sweet, which honestly? a relief. let's get into it β¨
β¨ NAME β¨
__d_alloc β allocate a dcache entry π
like, that's the whole job. it makes a dentry. that's it. that's the vibe.
πΈ SYNOPSIS πΈ
struct dentry * __d_alloc (struct super_block *sb , const struct qstr
*name );
look at her go π returns a struct dentry *, takes a struct super_block * and a const struct qstr *. copy it exactly, don't be weird about the spacing.
π¦ ARGUMENTS π¦
sbβ the filesystem it will belong to. yep, every dentry's gotta have a home, and this is hers πnameβ theqstrof the name. the actual name-name, in qstr form. that's the whole thing.
π§ DESCRIPTION π§
so what does she do? she allocates a dentry. that's the assignment and she ate π
if there's not enough memory available, she returns NULL β no cap, that's the failure mode, don't @ me π
on success the dentry is returned. slay.
and here's the detail you actually need to remember, bestie, so listen up π: the name you pass in is copied, and the copy you passed in may be reused after this call. so like, you're free to do whatever with your name afterwards, she's got her own copy now. main character energy fr fr π«Ά
π SEE ALSO π
kernel file ./fs/dcache.c, plus the whole friend group:
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_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_add(9)d_ancestor(9)d_splice_alias(9)is_subdir(9)
and that's the page!! πβ¨ this lil cutie lives in ./fs and the version stamp says October 2026 β so like, mark your calendars bestie, that's the date on the tin π byeee π«Άπ
π¦ 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