提交 9a8d5bb4 编写于 作者: W Wu Fengguang 提交者: Linus Torvalds

generic swap(): dcache: use swap() instead of private do_switch()

Use the new generic implementation.
Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 df4927bf
...@@ -1567,10 +1567,6 @@ void d_rehash(struct dentry * entry) ...@@ -1567,10 +1567,6 @@ void d_rehash(struct dentry * entry)
spin_unlock(&dcache_lock); spin_unlock(&dcache_lock);
} }
#define do_switch(x,y) do { \
__typeof__ (x) __tmp = x; \
x = y; y = __tmp; } while (0)
/* /*
* When switching names, the actual string doesn't strictly have to * When switching names, the actual string doesn't strictly have to
* be preserved in the target - because we're dropping the target * be preserved in the target - because we're dropping the target
...@@ -1589,7 +1585,7 @@ static void switch_names(struct dentry *dentry, struct dentry *target) ...@@ -1589,7 +1585,7 @@ static void switch_names(struct dentry *dentry, struct dentry *target)
/* /*
* Both external: swap the pointers * Both external: swap the pointers
*/ */
do_switch(target->d_name.name, dentry->d_name.name); swap(target->d_name.name, dentry->d_name.name);
} else { } else {
/* /*
* dentry:internal, target:external. Steal target's * dentry:internal, target:external. Steal target's
...@@ -1620,7 +1616,7 @@ static void switch_names(struct dentry *dentry, struct dentry *target) ...@@ -1620,7 +1616,7 @@ static void switch_names(struct dentry *dentry, struct dentry *target)
return; return;
} }
} }
do_switch(dentry->d_name.len, target->d_name.len); swap(dentry->d_name.len, target->d_name.len);
} }
/* /*
...@@ -1680,7 +1676,7 @@ static void d_move_locked(struct dentry * dentry, struct dentry * target) ...@@ -1680,7 +1676,7 @@ static void d_move_locked(struct dentry * dentry, struct dentry * target)
/* Switch the names.. */ /* Switch the names.. */
switch_names(dentry, target); switch_names(dentry, target);
do_switch(dentry->d_name.hash, target->d_name.hash); swap(dentry->d_name.hash, target->d_name.hash);
/* ... and switch the parents */ /* ... and switch the parents */
if (IS_ROOT(dentry)) { if (IS_ROOT(dentry)) {
...@@ -1688,7 +1684,7 @@ static void d_move_locked(struct dentry * dentry, struct dentry * target) ...@@ -1688,7 +1684,7 @@ static void d_move_locked(struct dentry * dentry, struct dentry * target)
target->d_parent = target; target->d_parent = target;
INIT_LIST_HEAD(&target->d_u.d_child); INIT_LIST_HEAD(&target->d_u.d_child);
} else { } else {
do_switch(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_add(&target->d_u.d_child, &target->d_parent->d_subdirs);
...@@ -1789,7 +1785,7 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) ...@@ -1789,7 +1785,7 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
struct dentry *dparent, *aparent; struct dentry *dparent, *aparent;
switch_names(dentry, anon); switch_names(dentry, anon);
do_switch(dentry->d_name.hash, anon->d_name.hash); swap(dentry->d_name.hash, anon->d_name.hash);
dparent = dentry->d_parent; dparent = dentry->d_parent;
aparent = anon->d_parent; aparent = anon->d_parent;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册