-/*
- * Prepare an anonymous dentry for life in the superblock's dentry tree as a
- * named dentry in place of the dentry to be replaced.
- */
-static void __d_materialise_dentry(struct dentry *dentry, struct dentry *target)
-{
- dentry_lock_for_move(dentry, target);
-
- write_seqcount_begin(&dentry->d_seq);
- write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED);
-
- switch_names(dentry, target);
- swap(dentry->d_name.hash, target->d_name.hash);
-
- dentry->d_parent = target->d_parent;
- target->d_parent = target;
- list_del_init(&target->d_u.d_child);
- list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
- if (likely(!d_unhashed(dentry))) {
- hlist_bl_lock(&dentry->d_sb->s_anon);
- __hlist_bl_del(&dentry->d_hash);
- dentry->d_hash.pprev = NULL;
- hlist_bl_unlock(&dentry->d_sb->s_anon);
- }
- __d_rehash(dentry, d_hash(dentry->d_parent, dentry->d_name.hash));
-
- write_seqcount_end(&target->d_seq);
- write_seqcount_end(&dentry->d_seq);
-
- dentry_unlock_parents_for_move(dentry, target);
- spin_unlock(&target->d_lock);
- spin_unlock(&dentry->d_lock);
-}
-