public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT()
@ 2008-10-15 13:58 OGAWA Hirofumi
  2008-10-15 13:58 ` [PATCH 2/6] vfs: add d_ancestor() OGAWA Hirofumi
  2008-10-15 19:45 ` [PATCH 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() Christoph Hellwig
  0 siblings, 2 replies; 21+ messages in thread
From: OGAWA Hirofumi @ 2008-10-15 13:58 UTC (permalink / raw)
  To: viro; +Cc: akpm, linux-kernel, hirofumi



Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 fs/dcache.c |   21 ++++++++++++---------
 fs/namei.c  |    4 ++--
 2 files changed, 14 insertions(+), 11 deletions(-)

diff -puN fs/dcache.c~dcache-cleanup-1 fs/dcache.c
--- linux-2.6/fs/dcache.c~dcache-cleanup-1	2008-09-30 05:24:32.000000000 +0900
+++ linux-2.6-hirofumi/fs/dcache.c	2008-09-30 05:24:32.000000000 +0900
@@ -174,9 +174,12 @@ static struct dentry *d_kill(struct dent
 	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_sub
 				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++;
@@ -1721,7 +1725,7 @@ static int d_isparent(struct dentry *p1,
 {
 	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;
 	}
@@ -2166,10 +2170,9 @@ int is_subdir(struct dentry * new_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;
diff -puN fs/namei.c~dcache-cleanup-1 fs/namei.c
--- linux-2.6/fs/namei.c~dcache-cleanup-1	2008-09-30 05:24:32.000000000 +0900
+++ linux-2.6-hirofumi/fs/namei.c	2008-09-30 05:24:32.000000000 +0900
@@ -1470,7 +1470,7 @@ struct dentry *lock_rename(struct dentry
 
 	mutex_lock(&p1->d_inode->i_sb->s_vfs_rename_mutex);
 
-	for (p = p1; p->d_parent != p; p = p->d_parent) {
+	for (p = p1; !IS_ROOT(p); p = p->d_parent) {
 		if (p->d_parent == p2) {
 			mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_PARENT);
 			mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_CHILD);
@@ -1478,7 +1478,7 @@ struct dentry *lock_rename(struct dentry
 		}
 	}
 
-	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) {
 			mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT);
 			mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_CHILD);
_

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2008-10-15 21:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-15 13:58 [PATCH 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 2/6] vfs: add d_ancestor() OGAWA Hirofumi
2008-10-15 13:58   ` [PATCH 3/6] vfs: add __d_instantiate() helper OGAWA Hirofumi
2008-10-15 13:58     ` [PATCH 4/6] vfs: remove unnecessary fsnotify_d_instantiate() OGAWA Hirofumi
2008-10-15 13:58       ` [PATCH 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup OGAWA Hirofumi
2008-10-15 13:58         ` [PATCH 6/6] vfs: add LOOKUP_RENAME_NEW intent OGAWA Hirofumi
2008-10-15 19:37           ` Christoph Hellwig
2008-10-15 20:13             ` OGAWA Hirofumi
2008-10-15 19:44         ` [PATCH 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup Christoph Hellwig
2008-10-15 21:43           ` OGAWA Hirofumi
2008-10-15 19:43       ` [PATCH 4/6] vfs: remove unnecessary fsnotify_d_instantiate() Christoph Hellwig
2008-10-15 20:16         ` OGAWA Hirofumi
2008-10-15 20:20           ` Christoph Hellwig
2008-10-15 19:41     ` [PATCH 3/6] vfs: add __d_instantiate() helper Christoph Hellwig
2008-10-15 20:39       ` OGAWA Hirofumi
2008-10-15 20:47         ` Trond Myklebust
2008-10-15 21:31           ` OGAWA Hirofumi
2008-10-15 19:53   ` [PATCH 2/6] vfs: add d_ancestor() Christoph Hellwig
2008-10-15 21:42     ` OGAWA Hirofumi
2008-10-15 19:45 ` [PATCH 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() Christoph Hellwig
2008-10-15 20:24   ` OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox