commit e094add2388ba8064ab063e1e2e2e1cce0edbdbf
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Sat May 19 17:03:20 2007 -0400

    cleanup: eliminate wrapper function create_parents
    
    Eliminate simple wrapper function create_parents which trivially called
    create_parents_named with one more arg derived from the caller.  Instead,
    remove the wrapper, rename create_parents_named to create_parents, and make
    everyone call create_parents directly.  This clarifies the code a bit more
    and saves a bit on stack space.
    
    Conflicts:
    
        fs/unionfs/inode.c
        fs/unionfs/subr.c

diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index 4528f9d..9cf5d44 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -23,11 +23,6 @@
  * Documentation/filesystems/unionfs/concepts.txt
  */
 
-/* forward definitions */
-static struct dentry *create_parents_named(struct inode *dir,
-                                          struct dentry *dentry,
-                                          const char *name, int bindex);
-
 #ifdef CONFIG_UNION_FS_XATTR
 /* copyup all extended attrs for a given dentry */
 static int copyup_xattrs(struct dentry *old_hidden_dentry,
@@ -368,8 +363,7 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, 
int bstart,
                goto out;
 
        /* Create the directory structure above this dentry. */
-       new_hidden_dentry =
-               create_parents_named(dir, dentry, name, new_bindex);
+       new_hidden_dentry = create_parents(dir, dentry, name, new_bindex);
        if (IS_ERR(new_hidden_dentry)) {
                err = PTR_ERR(new_hidden_dentry);
                goto out;
@@ -553,17 +547,6 @@ int copyup_file(struct inode *dir, struct file *file, int 
bstart,
        return err;
 }
 
-/*
- * This function replicates the directory structure up-to given dentry in the
- * bindex branch. Can create directory structure recursively to the right
- * also.
- */
-struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
-                             int bindex)
-{
-       return create_parents_named(dir, dentry, dentry->d_name.name, bindex);
-}
-
 /* purge a dentry's lower-branch states (dput/mntput, etc.) */
 static void __cleanup_dentry(struct dentry *dentry, int bindex,
                             int old_bstart, int old_bend)
@@ -643,9 +626,8 @@ static void __set_dentry(struct dentry *upper, struct 
dentry *lower,
  * This function replicates the directory structure up-to given dentry
  * in the bindex branch.
  */
-static struct dentry *create_parents_named(struct inode *dir,
-                                          struct dentry *dentry,
-                                          const char *name, int bindex)
+struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
+                             const char *name, int bindex)
 {
        int err;
        struct dentry *child_dentry;
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 6573adb..932ac1a 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -64,7 +64,9 @@ static int unionfs_create(struct inode *parent, struct dentry 
*dentry,
                 * hidden_dentry will NOT be null when bindex == bstart
                 * because lookup passed as a negative unionfs dentry
                 * pointing to a lone negative underlying dentry */
-               hidden_dentry = create_parents(parent, dentry, bstart);
+               hidden_dentry = create_parents(parent, dentry,
+                                              dentry->d_name.name,
+                                              bstart);
                if (!hidden_dentry || IS_ERR(hidden_dentry)) {
                        if (IS_ERR(hidden_dentry))
                                err = PTR_ERR(hidden_dentry);
@@ -109,7 +111,6 @@ static int unionfs_create(struct inode *parent, struct 
dentry *dentry,
                unlock_dir(hidden_parent_dentry);
        }
 
-
 out:
        if (!err)
                unionfs_inherit_mnt(dentry);
@@ -184,8 +185,9 @@ static int unionfs_link(struct dentry *old_dentry, struct 
inode *dir,
                }
        }
        if (dbstart(old_dentry) != dbstart(new_dentry) || create_p) {
-               hidden_new_dentry =
-                       create_parents(dir, new_dentry, dbstart(old_dentry));
+               hidden_new_dentry = create_parents(dir, new_dentry,
+                                                  new_dentry->d_name.name,
+                                                  dbstart(old_dentry));
                err = PTR_ERR(hidden_new_dentry);
                if (IS_COPYUP_ERR(err))
                        goto docopyup;
@@ -220,7 +222,8 @@ docopyup:
                                NULL, old_dentry->d_inode->i_size);
                if (!err) {
                        hidden_new_dentry =
-                               create_parents(dir, new_dentry, bindex);
+                               create_parents(dir, new_dentry, 
+                                       new_dentry->d_name.name, bindex);
                        hidden_old_dentry = unionfs_lower_dentry(old_dentry);
                        if (hidden_new_dentry->d_inode &&
                                        
UNIONFS_D(new_dentry)->odf_info->whiteout) {
@@ -301,7 +304,9 @@ static int unionfs_symlink(struct inode *dir, struct dentry 
*dentry,
                 * unionfs dentry pointing to a lone negative
                 * underlying dentry
                 */
-               hidden_dentry = create_parents(dir, dentry, bstart);
+               hidden_dentry = create_parents(dir, dentry, 
+                                               dentry->d_name.name,
+                                               bstart);
                if (!hidden_dentry || IS_ERR(hidden_dentry)) {
                        if (IS_ERR(hidden_dentry))
                                err = PTR_ERR(hidden_dentry);
@@ -380,7 +385,9 @@ static int unionfs_mkdir(struct inode *parent, struct 
dentry *dentry, int mode)
        }
        hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
        if (!hidden_dentry) {
-               hidden_dentry = create_parents(parent, dentry, bindex);
+               hidden_dentry = create_parents(parent, dentry, 
+                                               dentry->d_name.name,
+                                               bindex);
                if (!hidden_dentry || IS_ERR(hidden_dentry)) {
                        printk(KERN_DEBUG "hidden dentry NULL for "
                                "bindex = %d\n", bindex);
@@ -473,7 +480,9 @@ static int unionfs_mknod(struct inode *dir, struct dentry 
*dentry, int mode,
 
        hidden_dentry = unionfs_lower_dentry_idx(dentry, bstart);
        if (!hidden_dentry) {
-               hidden_dentry = create_parents(dir, dentry, bstart);
+               hidden_dentry = create_parents(dir, dentry,
+                                               dentry->d_name.name,
+                                               bstart);
                if (IS_ERR(hidden_dentry)) {
                        printk(KERN_DEBUG
                               "failed to create parents on %d, err = %ld\n",
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index 2c72d89..f952b8d 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -84,7 +84,8 @@ static int __unionfs_rename(struct inode *old_dir, struct 
dentry *old_dentry,
        if (!hidden_new_dentry) {
                hidden_new_dentry =
                        create_parents(new_dentry->d_parent->d_inode,
-                                      new_dentry, bindex);
+                                      new_dentry, new_dentry->d_name.name,
+                                      bindex);
                if (IS_ERR(hidden_new_dentry)) {
                        printk(KERN_DEBUG "unionfs: error creating directory "
                               "tree for rename, bindex = %d, err = %ld\n",
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 3195201..c082bd4 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -261,7 +261,7 @@ extern void update_bstart(struct dentry *dentry);
 
 /* replicates the directory structure up to given dentry in given branch */
 extern struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
-                                    int bindex);
+                                    const char *name, int bindex);
 extern int make_dir_opaque(struct dentry *dir, int bindex);
 
 /* partial lookup */
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to