Skip to contentSkip to conversation

VFS: Remove lives_below_in_same_fs()

PATCH In review Jan Blunck 2 participants 2 messages Mar 14, 2008 VFS

lore
Share & tools
lore

Jan Blunck

author
#0 lore raw

PATCH 1/1 VFS: Remove lives_below_in_same_fs()

Remove lives_below_in_same_fs() since is_subdir() from fs/dcache.c is providing the same functionality.

---
 fs/namespace.c |   13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
fs/namespace.c +1 -12
Index: b/fs/namespace.c
===================================================================
@@ -729,17 +729,6 @@ static int mount_is_safe(struct nameidat
 #endif
 }
 
-static int lives_below_in_same_fs(struct dentry *d, struct dentry *dentry)
-{
-	while (1) {
-		if (d == dentry)
-			return 1;
-		if (d == NULL || d == d->d_parent)
-			return 0;
-		d = d->d_parent;
-	}
-}
-
 struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
 					int flag)
 {
@@ -756,7 +745,7 @@ struct vfsmount *copy_tree(struct vfsmou
 
 	p = mnt;
 	list_for_each_entry(r, &mnt->mnt_mounts, mnt_child) {
-		if (!lives_below_in_same_fs(r->mnt_mountpoint, dentry))
+		if (!is_subdir(r->mnt_mountpoint, dentry))
 			continue;
 
 		for (s = r; s; s = next_mnt(s, r)) {
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines

Remove lives_below_in_same_fs() since is_subdir() from fs/dcache.c is providing the same functionality.

Quoted 36 lines
---
 fs/namespace.c |   13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

Index: b/fs/namespace.c
===================================================================

fs/namespace.c +1 -12
@@ -729,17 +729,6 @@ static int mount_is_safe(struct nameidat
 #endif
 }
 
-static int lives_below_in_same_fs(struct dentry *d, struct dentry *dentry)
-{
-	while (1) {
-		if (d == dentry)
-			return 1;
-		if (d == NULL || d == d->d_parent)
-			return 0;
-		d = d->d_parent;
-	}
-}
-
 struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
 					int flag)
 {
@@ -756,7 +745,7 @@ struct vfsmount *copy_tree(struct vfsmou
 
 	p = mnt;
 	list_for_each_entry(r, &mnt->mnt_mounts, mnt_child) {
-		if (!lives_below_in_same_fs(r->mnt_mountpoint, dentry))
+		if (!is_subdir(r->mnt_mountpoint, dentry))
 			continue;
 
 		for (s = r; s; s = next_mnt(s, r)) {