summaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2008-10-16 07:50:27 +0900
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-23 05:13:16 -0400
commit871c0067d53ba2dc35897c7da1da675bf4c70511 (patch)
treea76e6888d180a747df04155998bf8e595715da99 /fs/dcache.c
parent9fbb76ce0fe96c07c44ba2aec3dc99f4b8d2b9c6 (diff)
downloadop-kernel-dev-871c0067d53ba2dc35897c7da1da675bf4c70511.zip
op-kernel-dev-871c0067d53ba2dc35897c7da1da675bf4c70511.tar.gz
[PATCH vfs-2.6 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT()
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 1710d24..c6fd1f2 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -174,9 +174,12 @@ static struct dentry *d_kill(struct dentry *dentry)
dentry_stat.nr_dentry--; /* For d_free, below */
/*drops the locks, at that point nobody can reach this dentry */
dentry_iput(dentry);
- parent = dentry->d_parent;
+ if (IS_ROOT(dentry))
+ parent = NULL;
+ else
+ parent = dentry->d_parent;
d_free(dentry);
- return dentry == parent ? NULL : parent;
+ return parent;
}
/*
@@ -666,11 +669,12 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
BUG();
}
- parent = dentry->d_parent;
- if (parent == dentry)
+ if (IS_ROOT(dentry))
parent = NULL;
- else
+ else {
+ parent = dentry->d_parent;
atomic_dec(&parent->d_count);
+ }
list_del(&dentry->d_u.d_child);
detached++;
@@ -1723,7 +1727,7 @@ static int d_isparent(struct dentry *p1, struct dentry *p2)
{
struct dentry *p;
- for (p = p2; p->d_parent != p; p = p->d_parent) {
+ for (p = p2; !IS_ROOT(p); p = p->d_parent) {
if (p->d_parent == p1)
return 1;
}
@@ -2168,10 +2172,9 @@ int is_subdir(struct dentry * new_dentry, struct dentry * old_dentry)
seq = read_seqbegin(&rename_lock);
for (;;) {
if (new_dentry != old_dentry) {
- struct dentry * parent = new_dentry->d_parent;
- if (parent == new_dentry)
+ if (IS_ROOT(new_dentry))
break;
- new_dentry = parent;
+ new_dentry = new_dentry->d_parent;
continue;
}
result = 1;
OpenPOWER on IntegriCloud