Skip to content

Commit 63cf427

Browse files
author
Al Viro
committed
kill __d_materialise_dentry()
it folds into __d_move() now Signed-off-by: Al Viro <[email protected]>
1 parent 4453641 commit 63cf427

File tree

1 file changed

+10
-44
lines changed

1 file changed

+10
-44
lines changed

fs/dcache.c

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,28 +2511,28 @@ static void __d_move(struct dentry *dentry, struct dentry *target,
25112511
switch_names(dentry, target);
25122512
swap(dentry->d_name.hash, target->d_name.hash);
25132513

2514-
/* ... and switch the parents */
2514+
/* ... and switch them in the tree */
25152515
if (IS_ROOT(dentry)) {
2516+
/* splicing a tree */
25162517
dentry->d_parent = target->d_parent;
25172518
target->d_parent = target;
25182519
list_del_init(&target->d_u.d_child);
2520+
list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
25192521
} else {
2522+
/* swapping two dentries */
25202523
swap(dentry->d_parent, target->d_parent);
2521-
2522-
/* And add them back to the (new) parent lists */
25232524
list_move(&target->d_u.d_child, &target->d_parent->d_subdirs);
2525+
list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
2526+
if (exchange)
2527+
fsnotify_d_move(target);
2528+
fsnotify_d_move(dentry);
25242529
}
25252530

2526-
list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
2527-
25282531
write_seqcount_end(&target->d_seq);
25292532
write_seqcount_end(&dentry->d_seq);
25302533

25312534
dentry_unlock_parents_for_move(dentry, target);
2532-
if (exchange)
2533-
fsnotify_d_move(target);
25342535
spin_unlock(&target->d_lock);
2535-
fsnotify_d_move(dentry);
25362536
spin_unlock(&dentry->d_lock);
25372537
}
25382538

@@ -2631,40 +2631,6 @@ static struct dentry *__d_unalias(struct inode *inode,
26312631
return ret;
26322632
}
26332633

2634-
/*
2635-
* Prepare an anonymous dentry for life in the superblock's dentry tree as a
2636-
* named dentry in place of the dentry to be replaced.
2637-
*/
2638-
static void __d_materialise_dentry(struct dentry *dentry, struct dentry *target)
2639-
{
2640-
dentry_lock_for_move(dentry, target);
2641-
2642-
write_seqcount_begin(&dentry->d_seq);
2643-
write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED);
2644-
2645-
switch_names(dentry, target);
2646-
swap(dentry->d_name.hash, target->d_name.hash);
2647-
2648-
dentry->d_parent = target->d_parent;
2649-
target->d_parent = target;
2650-
list_del_init(&target->d_u.d_child);
2651-
list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
2652-
if (likely(!d_unhashed(dentry))) {
2653-
hlist_bl_lock(&dentry->d_sb->s_anon);
2654-
__hlist_bl_del(&dentry->d_hash);
2655-
dentry->d_hash.pprev = NULL;
2656-
hlist_bl_unlock(&dentry->d_sb->s_anon);
2657-
}
2658-
__d_rehash(dentry, d_hash(dentry->d_parent, dentry->d_name.hash));
2659-
2660-
write_seqcount_end(&target->d_seq);
2661-
write_seqcount_end(&dentry->d_seq);
2662-
2663-
dentry_unlock_parents_for_move(dentry, target);
2664-
spin_unlock(&target->d_lock);
2665-
spin_unlock(&dentry->d_lock);
2666-
}
2667-
26682634
/**
26692635
* d_splice_alias - splice a disconnected dentry into the tree if one exists
26702636
* @inode: the inode which may have a disconnected dentry
@@ -2710,7 +2676,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
27102676
return ERR_PTR(-EIO);
27112677
}
27122678
write_seqlock(&rename_lock);
2713-
__d_materialise_dentry(new, dentry);
2679+
__d_move(new, dentry, false);
27142680
write_sequnlock(&rename_lock);
27152681
spin_unlock(&inode->i_lock);
27162682
security_d_instantiate(new, inode);
@@ -2771,7 +2737,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
27712737
} else if (IS_ROOT(alias)) {
27722738
/* Is this an anonymous mountpoint that we
27732739
* could splice into our tree? */
2774-
__d_materialise_dentry(alias, dentry);
2740+
__d_move(alias, dentry, false);
27752741
write_sequnlock(&rename_lock);
27762742
goto found;
27772743
} else {

0 commit comments

Comments
 (0)