__d_move(): fold manipulations with ->d_child/->d_subdirs
list_del() + list_add() is a slightly pessimised list_move() list_del() + INIT_LIST_HEAD() is a slightly pessimised list_del_init() Interleaving those makes the resulting code even worse. And harder to follow... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
8527dd7187
commit
9d8cd306a8
@ -2506,8 +2506,6 @@ static void __d_move(struct dentry *dentry, struct dentry *target,
|
|||||||
d_hash(dentry->d_parent, dentry->d_name.hash));
|
d_hash(dentry->d_parent, dentry->d_name.hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
list_del(&dentry->d_u.d_child);
|
|
||||||
list_del(&target->d_u.d_child);
|
|
||||||
|
|
||||||
/* Switch the names.. */
|
/* Switch the names.. */
|
||||||
switch_names(dentry, target);
|
switch_names(dentry, target);
|
||||||
@ -2517,15 +2515,15 @@ static void __d_move(struct dentry *dentry, struct dentry *target,
|
|||||||
if (IS_ROOT(dentry)) {
|
if (IS_ROOT(dentry)) {
|
||||||
dentry->d_parent = target->d_parent;
|
dentry->d_parent = target->d_parent;
|
||||||
target->d_parent = target;
|
target->d_parent = target;
|
||||||
INIT_LIST_HEAD(&target->d_u.d_child);
|
list_del_init(&target->d_u.d_child);
|
||||||
} else {
|
} else {
|
||||||
swap(dentry->d_parent, target->d_parent);
|
swap(dentry->d_parent, target->d_parent);
|
||||||
|
|
||||||
/* And add them back to the (new) parent lists */
|
/* And add them back to the (new) parent lists */
|
||||||
list_add(&target->d_u.d_child, &target->d_parent->d_subdirs);
|
list_move(&target->d_u.d_child, &target->d_parent->d_subdirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
|
list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
|
||||||
|
|
||||||
write_seqcount_end(&target->d_seq);
|
write_seqcount_end(&target->d_seq);
|
||||||
write_seqcount_end(&dentry->d_seq);
|
write_seqcount_end(&dentry->d_seq);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user