GIT: unionfs2-2.6.27.y: Unionfs: move a rename helper closer to rename code

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:18:01 EDT 2010


commit e181f34140fbf9d2abd607facbf8b70a7025e62a
Author: Erez Zadok <ezk at cs.sunysb.edu>
Date:   Mon Jul 28 00:25:46 2008 -0400

    Unionfs: move a rename helper closer to rename code
    
    Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index fe8d877..5b3f1a3 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -18,6 +18,48 @@
 
 #include "union.h"
 
+/*
+ * This is a helper function for rename, used when rename ends up with hosed
+ * over dentries and we need to revert.
+ */
+static int unionfs_refresh_lower_dentry(struct dentry *dentry, int bindex)
+{
+	struct dentry *lower_dentry;
+	struct dentry *lower_parent;
+	int err = 0;
+
+	verify_locked(dentry);
+
+	unionfs_lock_dentry(dentry->d_parent, UNIONFS_DMUTEX_CHILD);
+	lower_parent = unionfs_lower_dentry_idx(dentry->d_parent, bindex);
+	unionfs_unlock_dentry(dentry->d_parent);
+
+	BUG_ON(!S_ISDIR(lower_parent->d_inode->i_mode));
+
+	lower_dentry = lookup_one_len(dentry->d_name.name, lower_parent,
+				      dentry->d_name.len);
+	if (IS_ERR(lower_dentry)) {
+		err = PTR_ERR(lower_dentry);
+		goto out;
+	}
+
+	dput(unionfs_lower_dentry_idx(dentry, bindex));
+	iput(unionfs_lower_inode_idx(dentry->d_inode, bindex));
+	unionfs_set_lower_inode_idx(dentry->d_inode, bindex, NULL);
+
+	if (!lower_dentry->d_inode) {
+		dput(lower_dentry);
+		unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
+	} else {
+		unionfs_set_lower_dentry_idx(dentry, bindex, lower_dentry);
+		unionfs_set_lower_inode_idx(dentry->d_inode, bindex,
+					    igrab(lower_dentry->d_inode));
+	}
+
+out:
+	return err;
+}
+
 static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			    struct inode *new_dir, struct dentry *new_dentry,
 			    int bindex, struct dentry **wh_old)
diff --git a/fs/unionfs/subr.c b/fs/unionfs/subr.c
index b76fa7a..1f1db3d 100644
--- a/fs/unionfs/subr.c
+++ b/fs/unionfs/subr.c
@@ -114,48 +114,6 @@ out:
 	return err;
 }
 
-/*
- * This is a helper function for rename, which ends up with hosed over
- * dentries when it needs to revert.
- */
-int unionfs_refresh_lower_dentry(struct dentry *dentry, int bindex)
-{
-	struct dentry *lower_dentry;
-	struct dentry *lower_parent;
-	int err = 0;
-
-	verify_locked(dentry);
-
-	unionfs_lock_dentry(dentry->d_parent, UNIONFS_DMUTEX_CHILD);
-	lower_parent = unionfs_lower_dentry_idx(dentry->d_parent, bindex);
-	unionfs_unlock_dentry(dentry->d_parent);
-
-	BUG_ON(!S_ISDIR(lower_parent->d_inode->i_mode));
-
-	lower_dentry = lookup_one_len(dentry->d_name.name, lower_parent,
-				      dentry->d_name.len);
-	if (IS_ERR(lower_dentry)) {
-		err = PTR_ERR(lower_dentry);
-		goto out;
-	}
-
-	dput(unionfs_lower_dentry_idx(dentry, bindex));
-	iput(unionfs_lower_inode_idx(dentry->d_inode, bindex));
-	unionfs_set_lower_inode_idx(dentry->d_inode, bindex, NULL);
-
-	if (!lower_dentry->d_inode) {
-		dput(lower_dentry);
-		unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
-	} else {
-		unionfs_set_lower_dentry_idx(dentry, bindex, lower_dentry);
-		unionfs_set_lower_inode_idx(dentry->d_inode, bindex,
-					    igrab(lower_dentry->d_inode));
-	}
-
-out:
-	return err;
-}
-
 int make_dir_opaque(struct dentry *dentry, int bindex)
 {
 	int err = 0;
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 7420cb0..9520a00 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -353,9 +353,6 @@ extern int check_empty(struct dentry *dentry,
 extern int delete_whiteouts(struct dentry *dentry, int bindex,
 			    struct unionfs_dir_state *namelist);
 
-/* Re-lookup a lower dentry. */
-extern int unionfs_refresh_lower_dentry(struct dentry *dentry, int bindex);
-
 extern void unionfs_reinterpose(struct dentry *this_dentry);
 extern struct super_block *unionfs_duplicate_super(struct super_block *sb);
 


More information about the unionfs-cvs mailing list