d_splice_alias(9)
π NAME π
d_splice_alias β splice a disconnected dentry into the tree if one exists. π¦
okay so bestie, this is d_splice_alias(9) from the Kernel API Manual, and itβs literally the function that does exactly what the name says, no cap β¨
β¨ SYNOPSIS β¨
struct dentry * d_splice_alias (struct inode *inode , struct dentry *dentry );
π ARGUMENTS π
inodeβ the inode which may have a disconnected dentry. π«Άdentryβ a negative dentry which we want to point to the inode. π
π¦ DESCRIPTION π¦
okay, the logic is giving conditional queen, so stay with me:
- if
inodeis a directory and has anIS_ROOTalias, thend_movethat in place of the givendentryand return it; else simplyd_addthe inode to thedentryand returnNULL. β¨ - if a
non-IS_ROOTdirectory is found, the filesystem is corrupt, and we should error out: directories can't have multiple aliases. π¨ this is a hard no. - this is needed in the lookup routine of any filesystem that is exportable (via
knfsd) so that we can builddcachepaths to directories effectively. π - if a
dentrywas found and moved, then it is returned. otherwiseNULLis returned. this matches the expected return value of->lookup. π― - cluster filesystems may call this function with a negative, hashed
dentry. in that case, we know that theinodewill be a regular file, and also this will only occur duringatomic_open. so we need to check for thedentrybeing already hashed only in the final case. π
πΈ SEE ALSO πΈ
Kernel file ./fs/dcache.c β the whole squad is: 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_add(9), d_ancestor(9), is_subdir(9). π«Ά
source/version ./fs, date October 2026 β thatβs the tea, bestie, mwah πβ¨
π¦ 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