commit ab21e69371aaed0140912bb5911e9308f86d9e9b
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Mon Feb 12 17:55:24 2007 -0500

    cleanup old code

diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index c48a2f7..b668fdd 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -18,115 +18,6 @@
 
 #include "union.h"
 
-/* Delete all of the whiteouts in a given directory for rmdir.
- *
- * hidden directory inode should be locked
- */
-int do_delete_whiteouts(struct dentry *dentry, int bindex,
-                    struct unionfs_dir_state *namelist)
-{
-       int err = 0;
-       struct dentry *hidden_dir_dentry = NULL;
-       struct dentry *hidden_dentry;
-       char *name = NULL, *p;
-       struct inode *hidden_dir;
-
-       int i;
-       struct list_head *pos;
-       struct filldir_node *cursor;
-
-       /* Find out hidden parent dentry */
-       hidden_dir_dentry = unionfs_lower_dentry_idx(dentry, bindex);
-       BUG_ON(!S_ISDIR(hidden_dir_dentry->d_inode->i_mode));
-       hidden_dir = hidden_dir_dentry->d_inode;
-       BUG_ON(!S_ISDIR(hidden_dir->i_mode));
-
-       err = -ENOMEM;
-       name = __getname();
-       if (!name)
-               goto out;
-       strcpy(name, UNIONFS_WHPFX);
-       p = name + UNIONFS_WHLEN;
-
-       err = 0;
-       for (i = 0; !err && i < namelist->size; i++) {
-               list_for_each(pos, &namelist->list[i]) {
-                       cursor =
-                           list_entry(pos, struct filldir_node, file_list);
-                       /* Only operate on whiteouts in this branch. */
-                       if (cursor->bindex != bindex)
-                               continue;
-                       if (!cursor->whiteout)
-                               continue;
-
-                       strcpy(p, cursor->name);
-                       hidden_dentry =
-                           lookup_one_len(name, hidden_dir_dentry,
-                                          cursor->namelen + UNIONFS_WHLEN);
-                       if (IS_ERR(hidden_dentry)) {
-                               err = PTR_ERR(hidden_dentry);
-                               break;
-                       }
-                       if (hidden_dentry->d_inode)
-                               err = vfs_unlink(hidden_dir, hidden_dentry);
-                       dput(hidden_dentry);
-                       if (err)
-                               break;
-               }
-       }
-
-       __putname(name);
-
-       /* After all of the removals, we should copy the attributes once. */
-       fsstack_copy_attr_times(dentry->d_inode, hidden_dir_dentry->d_inode);
-
-out:
-       return err;
-}
-
-/* delete whiteouts in a dir (for rmdir operation) using sioq if necessary */
-int delete_whiteouts(struct dentry *dentry, int bindex,
-                    struct unionfs_dir_state *namelist)
-{
-       int err;
-       struct super_block *sb;
-       struct dentry *hidden_dir_dentry;
-       struct inode *hidden_dir;
-
-       struct sioq_args args;
-
-       sb = dentry->d_sb;
-       unionfs_read_lock(sb);
-
-       BUG_ON(!S_ISDIR(dentry->d_inode->i_mode));
-       BUG_ON(bindex < dbstart(dentry));
-       BUG_ON(bindex > dbend(dentry));
-       err = is_robranch_super(sb, bindex);
-       if (err)
-               goto out;
-
-       hidden_dir_dentry = unionfs_lower_dentry_idx(dentry, bindex);
-       BUG_ON(!S_ISDIR(hidden_dir_dentry->d_inode->i_mode));
-       hidden_dir = hidden_dir_dentry->d_inode;
-       BUG_ON(!S_ISDIR(hidden_dir->i_mode));
-
-       mutex_lock(&hidden_dir->i_mutex);
-       if (!permission(hidden_dir, MAY_WRITE | MAY_EXEC, NULL))
-               err = do_delete_whiteouts(dentry, bindex, namelist);
-       else {
-               args.deletewh.namelist = namelist;
-               args.deletewh.dentry = dentry;
-               args.deletewh.bindex = bindex;
-               run_sioq(__delete_whiteouts, &args);
-               err = args.err;
-       }
-       mutex_unlock(&hidden_dir->i_mutex);
-
-out:
-       unionfs_read_unlock(sb);
-       return err;
-}
-
 #define RD_NONE 0
 #define RD_CHECK_EMPTY 1
 #define RD_CACHE_ODF 2
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 3467bd6..b14198d 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -23,8 +23,6 @@ static int unionfs_create(struct inode *parent, struct dentry 
*dentry,
 {
        int err = 0;
        struct dentry *hidden_dentry = NULL;
-       struct dentry *wh_dentry = NULL;
-       struct dentry *new_hidden_dentry;
        struct dentry *hidden_parent_dentry = NULL;
        int bindex = 0, bstart;
        char *name = NULL;
@@ -61,103 +59,6 @@ static int unionfs_create(struct inode *parent, struct 
dentry *dentry,
        bstart = dbstart(dentry);
        hidden_dentry = unionfs_lower_dentry(dentry);
 
-       /* check if whiteout exists in this branch, i.e. lookup .wh.foo first */
-       name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-       if (IS_ERR(name)) {
-               err = PTR_ERR(name);
-               goto out;
-       }
-
-       wh_dentry = lookup_one_len(name, hidden_dentry->d_parent,
-                          dentry->d_name.len + UNIONFS_WHLEN);
-       if (IS_ERR(wh_dentry)) {
-               err = PTR_ERR(wh_dentry);
-               wh_dentry = NULL;
-               goto out;
-       }
-
-       if (wh_dentry->d_inode) {
-               /* .wh.foo has been found. */
-               /* First truncate it and then rename it to foo (hence having
-                * the same overall effect as a normal create.
-                */
-               struct dentry *hidden_dir_dentry;
-               struct iattr newattrs;
-
-               mutex_lock(&wh_dentry->d_inode->i_mutex);
-               newattrs.ia_valid = ATTR_CTIME | ATTR_MODE | ATTR_ATIME
-                   | ATTR_MTIME | ATTR_UID | ATTR_GID | ATTR_FORCE
-                   | ATTR_KILL_SUID | ATTR_KILL_SGID;
-
-               newattrs.ia_mode = mode & ~current->fs->umask;
-               newattrs.ia_uid = current->fsuid;
-               newattrs.ia_gid = current->fsgid;
-
-               if (wh_dentry->d_inode->i_size != 0) {
-                       newattrs.ia_valid |= ATTR_SIZE;
-                       newattrs.ia_size = 0;
-               }
-
-               err = notify_change(wh_dentry, &newattrs);
-
-               mutex_unlock(&wh_dentry->d_inode->i_mutex);
-
-               if (err)
-                       printk(KERN_WARNING "unionfs: %s:%d: notify_change "
-                               "failed: %d, ignoring..\n",
-                               __FILE__, __LINE__, err);
-
-               new_hidden_dentry = unionfs_lower_dentry(dentry);
-               dget(new_hidden_dentry);
-
-               hidden_dir_dentry = dget_parent(wh_dentry);
-               lock_rename(hidden_dir_dentry, hidden_dir_dentry);
-
-               if (!(err = is_robranch_super(dentry->d_sb, bstart))) {
-                       err = vfs_rename(hidden_dir_dentry->d_inode,
-                                        wh_dentry,
-                                        hidden_dir_dentry->d_inode,
-                                        new_hidden_dentry);
-               }
-               if (!err) {
-                       fsstack_copy_attr_times(parent,
-                                       new_hidden_dentry->d_parent->d_inode);
-                       fsstack_copy_inode_size(parent,
-                                       new_hidden_dentry->d_parent->d_inode);
-                       parent->i_nlink = unionfs_get_nlinks(parent);
-               }
-
-               unlock_rename(hidden_dir_dentry, hidden_dir_dentry);
-               dput(hidden_dir_dentry);
-
-               dput(new_hidden_dentry);
-
-               if (err) {
-                       /* exit if the error returned was NOT -EROFS */
-                       if (!IS_COPYUP_ERR(err))
-                               goto out;
-                       /* We were not able to create the file in this
-                        * branch, so, we try to create it in one branch to
-                        * left
-                        */
-                       bstart--;
-               } else {
-                       /* reset the unionfs dentry to point to the .wh.foo
-                        * entry.
-                        */
-
-                       /* Discard any old reference. */
-                       dput(unionfs_lower_dentry(dentry));
-
-                       /* Trade one reference to another. */
-                       unionfs_set_lower_dentry_idx(dentry, bstart, wh_dentry);
-                       wh_dentry = NULL;
-
-                       err = unionfs_interpose(dentry, parent->i_sb, 0);
-                       goto out;
-               }
-       }
-
        for (bindex = bstart; bindex >= 0; bindex--) {
                hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
                if (!hidden_dentry) {
@@ -209,9 +110,6 @@ static int unionfs_create(struct inode *parent, struct 
dentry *dentry,
        }
 
 out:
-       dput(wh_dentry);
-       kfree(name);
-
        unionfs_unlock_dentry(dentry);
        unionfs_read_unlock(dentry->d_sb);
        return err;
@@ -249,8 +147,6 @@ static int unionfs_link(struct dentry *old_dentry, struct 
inode *dir,
        struct dentry *hidden_old_dentry = NULL;
        struct dentry *hidden_new_dentry = NULL;
        struct dentry *hidden_dir_dentry = NULL;
-       struct dentry *whiteout_dentry;
-       char *name = NULL;
 
        BUG_ON(!is_valid_dentry(new_dentry));
        BUG_ON(!is_valid_dentry(old_dentry));
@@ -259,42 +155,6 @@ static int unionfs_link(struct dentry *old_dentry, struct 
inode *dir,
 
        hidden_new_dentry = unionfs_lower_dentry(new_dentry);
 
-       /* check if whiteout exists in the branch of new dentry, i.e. lookup
-        * .wh.foo first. If present, delete it
-        */
-       name = alloc_whname(new_dentry->d_name.name, new_dentry->d_name.len);
-       if (IS_ERR(name)) {
-               err = PTR_ERR(name);
-               goto out;
-       }
-
-       whiteout_dentry = lookup_one_len(name, hidden_new_dentry->d_parent,
-                               new_dentry->d_name.len + UNIONFS_WHLEN);
-       if (IS_ERR(whiteout_dentry)) {
-               err = PTR_ERR(whiteout_dentry);
-               goto out;
-       }
-
-       if (!whiteout_dentry->d_inode) {
-               dput(whiteout_dentry);
-               whiteout_dentry = NULL;
-       } else {
-               /* found a .wh.foo entry, unlink it and then call vfs_link() */
-               hidden_dir_dentry = lock_parent(whiteout_dentry);
-               err = is_robranch_super(new_dentry->d_sb, dbstart(new_dentry));
-               if (!err)
-                       err = vfs_unlink(hidden_dir_dentry->d_inode,
-                                      whiteout_dentry);
-
-               fsstack_copy_attr_times(dir, hidden_dir_dentry->d_inode);
-               dir->i_nlink = unionfs_get_nlinks(dir);
-               unlock_dir(hidden_dir_dentry);
-               hidden_dir_dentry = NULL;
-               dput(whiteout_dentry);
-               if (err)
-                       goto out;
-       }
-
        if (dbstart(old_dentry) != dbstart(new_dentry)) {
                hidden_new_dentry =
                    create_parents(dir, new_dentry, dbstart(old_dentry));
@@ -360,8 +220,6 @@ out:
        if (!new_dentry->d_inode)
                d_drop(new_dentry);
 
-       kfree(name);
-
        unionfs_unlock_dentry(new_dentry);
        unionfs_unlock_dentry(old_dentry);
 
@@ -373,11 +231,9 @@ static int unionfs_symlink(struct inode *dir, struct 
dentry *dentry,
 {
        int err = 0;
        struct dentry *hidden_dentry = NULL;
-       struct dentry *whiteout_dentry = NULL;
        struct dentry *hidden_dir_dentry = NULL;
        umode_t mode;
        int bindex = 0, bstart;
-       char *name = NULL;
 
        BUG_ON(!is_valid_dentry(dentry));
 
@@ -388,51 +244,7 @@ static int unionfs_symlink(struct inode *dir, struct 
dentry *dentry,
 
        hidden_dentry = unionfs_lower_dentry(dentry);
 
-       /* check if whiteout exists in this branch, i.e. lookup .wh.foo
-        * first. If present, delete it
-        */
-       name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-       if (IS_ERR(name)) {
-               err = PTR_ERR(name);
-               goto out;
-       }
-
-       whiteout_dentry =
-           lookup_one_len(name, hidden_dentry->d_parent,
-                          dentry->d_name.len + UNIONFS_WHLEN);
-       if (IS_ERR(whiteout_dentry)) {
-               err = PTR_ERR(whiteout_dentry);
-               goto out;
-       }
-
-       if (!whiteout_dentry->d_inode) {
-               dput(whiteout_dentry);
-               whiteout_dentry = NULL;
-       } else {
-               /* found a .wh.foo entry, unlink it and then call vfs_symlink() 
*/
-               hidden_dir_dentry = lock_parent(whiteout_dentry);
-
-               if (!(err = is_robranch_super(dentry->d_sb, bstart)))
-                       err = vfs_unlink(hidden_dir_dentry->d_inode,
-                                      whiteout_dentry);
-               dput(whiteout_dentry);
-
-               fsstack_copy_attr_times(dir, hidden_dir_dentry->d_inode);
-               /* propagate number of hard-links */
-               dir->i_nlink = unionfs_get_nlinks(dir);
-
-               unlock_dir(hidden_dir_dentry);
-
-               if (err) {
-                       /* exit if the error returned was NOT -EROFS */
-                       if (!IS_COPYUP_ERR(err))
-                               goto out;
-                       /* should now try to create symlink in the another 
branch */
-                       bstart--;
-               }
-       }
-
-       /* deleted whiteout if it was present, now do a normal vfs_symlink()
+       /* do a normal vfs_symlink()
         * with possible recursive directory creation
         */
        for (bindex = bstart; bindex >= 0; bindex--) {
@@ -488,11 +300,9 @@ static int unionfs_symlink(struct inode *dir, struct 
dentry *dentry,
                }
        }
 
-out:
        if (!dentry->d_inode)
                d_drop(dentry);
 
-       kfree(name);
        unionfs_unlock_dentry(dentry);
        return err;
 }
@@ -583,11 +393,9 @@ static int unionfs_mknod(struct inode *dir, struct dentry 
*dentry, int mode,
                         dev_t dev)
 {
        int err = 0;
-       struct dentry *hidden_dentry = NULL, *whiteout_dentry = NULL;
+       struct dentry *hidden_dentry = NULL;
        struct dentry *hidden_parent_dentry = NULL;
        int bindex = 0, bstart;
-       char *name = NULL;
-       int whiteout_unlinked = 0;
 
        BUG_ON(!is_valid_dentry(dentry));
 
@@ -596,44 +404,6 @@ static int unionfs_mknod(struct inode *dir, struct dentry 
*dentry, int mode,
 
        hidden_dentry = unionfs_lower_dentry(dentry);
 
-       /* check if whiteout exists in this branch, i.e. lookup .wh.foo first */
-       name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-       if (IS_ERR(name)) {
-               err = PTR_ERR(name);
-               goto out;
-       }
-
-       whiteout_dentry = lookup_one_len(name, hidden_dentry->d_parent,
-                               dentry->d_name.len + UNIONFS_WHLEN);
-       if (IS_ERR(whiteout_dentry)) {
-               err = PTR_ERR(whiteout_dentry);
-               goto out;
-       }
-
-       if (!whiteout_dentry->d_inode) {
-               dput(whiteout_dentry);
-               whiteout_dentry = NULL;
-       } else {
-               /* found .wh.foo, unlink it */
-               hidden_parent_dentry = lock_parent(whiteout_dentry);
-
-               /* found a.wh.foo entry, remove it then do vfs_mkdir */
-               if (!(err = is_robranch_super(dentry->d_sb, bstart)))
-                       err = vfs_unlink(hidden_parent_dentry->d_inode,
-                                        whiteout_dentry);
-               dput(whiteout_dentry);
-
-               unlock_dir(hidden_parent_dentry);
-
-               if (err) {
-                       if (!IS_COPYUP_ERR(err))
-                               goto out;
-
-                       bstart--;
-               } else
-                       whiteout_unlinked = 1;
-       }
-
        for (bindex = bstart; bindex >= 0; bindex--) {
                if (is_robranch_super(dentry->d_sb, bindex))
                        continue;
@@ -684,8 +454,6 @@ out:
        if (!dentry->d_inode)
                d_drop(dentry);
 
-       kfree(name);
-
        unionfs_unlock_dentry(dentry);
        return err;
 }
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 46a9741..cbdf976 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -18,63 +18,12 @@
 
 #include "union.h"
 
-/* is the filename valid == !(whiteout for a file or opaque dir marker) */
-static int is_validname(const char *name)
-{
-       if (!strncmp(name, UNIONFS_WHPFX, UNIONFS_WHLEN))
-               return 0;
-       if (!strncmp(name, UNIONFS_DIR_OPAQUE_NAME,
-                    sizeof(UNIONFS_DIR_OPAQUE_NAME) - 1))
-               return 0;
-       return 1;
-}
-
 /* The rest of these are utility functions for lookup. */
-static noinline int is_opaque_dir(struct dentry *dentry, int bindex)
-{
-       int err = 0;
-       struct dentry *hidden_dentry;
-       struct dentry *wh_hidden_dentry;
-       struct inode *hidden_inode;
-       struct sioq_args args;
-
-       hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
-       hidden_inode = hidden_dentry->d_inode;
-
-       BUG_ON(!S_ISDIR(hidden_inode->i_mode));
-
-       mutex_lock(&hidden_inode->i_mutex);
-
-       if (!permission(hidden_inode, MAY_EXEC, NULL))
-               wh_hidden_dentry = lookup_one_len(UNIONFS_DIR_OPAQUE, 
hidden_dentry,
-                                       sizeof(UNIONFS_DIR_OPAQUE) - 1);
-       else {
-               args.is_opaque.dentry = hidden_dentry;
-               run_sioq(__is_opaque_dir, &args);
-               wh_hidden_dentry = args.ret;
-       }
-
-       mutex_unlock(&hidden_inode->i_mutex);
-
-       if (IS_ERR(wh_hidden_dentry)) {
-               err = PTR_ERR(wh_hidden_dentry);
-               goto out;
-       }
-
-       /* This is an opaque dir iff wh_hidden_dentry is positive */
-       err = !!wh_hidden_dentry->d_inode;
-
-       dput(wh_hidden_dentry);
-out:
-       return err;
-}
-
 struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata 
*nd,
                                      int lookupmode)
 {
        int err = 0;
        struct dentry *hidden_dentry = NULL;
-       struct dentry *wh_hidden_dentry = NULL;
        struct dentry *hidden_dir_dentry = NULL;
        struct dentry *parent_dentry = NULL;
        int bindex, bstart, bend, bopaque;
@@ -88,7 +37,6 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry, 
struct nameidata *n
        int allocated_new_info = 0;
 
        int opaque;
-       char *whname = NULL;
        const char *name;
        int namelen;
        
@@ -124,11 +72,6 @@ struct dentry *unionfs_lookup_backend(struct dentry 
*dentry, struct nameidata *n
 
        name = dentry->d_name.name;
        namelen = dentry->d_name.len;
-       /* No dentries should get created for possible whiteout names. */
-       if (!is_validname(name)) {
-               err = -EPERM;
-               goto out_free;
-       }
 
        /* Now start the actual lookup procedure. */
        bstart = dbstart(parent_dentry);
@@ -162,44 +105,6 @@ struct dentry *unionfs_lookup_backend(struct dentry 
*dentry, struct nameidata *n
                if (!S_ISDIR(hidden_dir_dentry->d_inode->i_mode))
                        continue;
 
-               /* Reuse the whiteout name because its value doesn't change. */
-               if (!whname) {
-                       whname = alloc_whname(name, namelen);
-                       if (IS_ERR(whname)) {
-                               err = PTR_ERR(whname);
-                               goto out_free;
-                       }
-               }
-
-               /* check if whiteout exists in this branch: lookup .wh.foo */
-               wh_hidden_dentry = lookup_one_len(whname, hidden_dir_dentry,
-                                                 namelen + UNIONFS_WHLEN);
-               if (IS_ERR(wh_hidden_dentry)) {
-                       dput(first_hidden_dentry);
-                       unionfs_mntput(first_dentry, first_dentry_offset);
-                       err = PTR_ERR(wh_hidden_dentry);
-                       goto out_free;
-               }
-
-               if (wh_hidden_dentry->d_inode) {
-                       /* We found a whiteout so lets give up. */
-                       if (S_ISREG(wh_hidden_dentry->d_inode->i_mode)) {
-                               set_dbend(dentry, bindex);
-                               set_dbopaque(dentry, bindex);
-                               dput(wh_hidden_dentry);
-                               break;
-                       }
-                       err = -EIO;
-                       printk(KERN_NOTICE "EIO: Invalid whiteout entry type"
-                              " %d.\n", wh_hidden_dentry->d_inode->i_mode);
-                       dput(wh_hidden_dentry);
-                       dput(first_hidden_dentry);
-                       unionfs_mntput(first_dentry, first_dentry_offset);
-                       goto out_free;
-               }
-
-               dput(wh_hidden_dentry);
-               wh_hidden_dentry = NULL;
 
                /* Now do regular lookup; lookup foo */
                nd->dentry = unionfs_lower_dentry_idx(dentry, bindex);
@@ -261,18 +166,6 @@ struct dentry *unionfs_lookup_backend(struct dentry 
*dentry, struct nameidata *n
                        
BUG_ON(!S_ISDIR(unionfs_lower_dentry(dentry)->d_inode->i_mode));
                        continue;
                }
-
-               opaque = is_opaque_dir(dentry, bindex);
-               if (opaque < 0) {
-                       dput(first_hidden_dentry);
-                       unionfs_mntput(first_dentry, first_dentry_offset);
-                       err = opaque;
-                       goto out_free;
-               } else if (opaque) {
-                       set_dbend(dentry, bindex);
-                       set_dbopaque(dentry, bindex);
-                       break;
-               }
        }
 
        if (dentry_count)
@@ -401,7 +294,6 @@ out:
                BUG_ON(dbend(dentry) > sbmax(dentry->d_sb));
                BUG_ON(dbstart(dentry) < 0);
        }
-       kfree(whname);
        if (locked_parent)
                unionfs_unlock_dentry(parent_dentry);
        dput(parent_dentry);
diff --git a/fs/unionfs/sioq.c b/fs/unionfs/sioq.c
index c0d89a3..06c13be 100644
--- a/fs/unionfs/sioq.c
+++ b/fs/unionfs/sioq.c
@@ -102,22 +102,3 @@ void __unionfs_unlink(struct work_struct *work)
        args->err = vfs_unlink(u->parent, u->dentry);
        complete(&args->comp);
 }
-
-void __delete_whiteouts(struct work_struct *work)
-{
-       struct sioq_args *args = container_of(work, struct sioq_args, work);
-       struct deletewh_args *d = &args->deletewh;
-
-       args->err = do_delete_whiteouts(d->dentry, d->bindex, d->namelist);
-       complete(&args->comp);
-}
-
-void __is_opaque_dir(struct work_struct *work)
-{
-       struct sioq_args *args = container_of(work, struct sioq_args, work);
-
-       args->ret = lookup_one_len(UNIONFS_DIR_OPAQUE, args->is_opaque.dentry,
-                               sizeof(UNIONFS_DIR_OPAQUE) - 1);
-       complete(&args->comp);
-}
-
diff --git a/fs/unionfs/sioq.h b/fs/unionfs/sioq.h
index 20e3b0c..24d171b 100644
--- a/fs/unionfs/sioq.h
+++ b/fs/unionfs/sioq.h
@@ -1,16 +1,6 @@
 #ifndef _SIOQ_H
 #define _SIOQ_H
 
-struct deletewh_args {
-       struct unionfs_dir_state *namelist;
-       struct dentry *dentry;
-       int bindex;
-};
-
-struct is_opaque_args {
-       struct dentry *dentry;
-};
-
 struct create_args {
        struct inode *parent;
        struct dentry *dentry;
@@ -51,8 +41,6 @@ struct sioq_args {
        void *ret;
 
        union {
-               struct deletewh_args deletewh;
-               struct is_opaque_args is_opaque;
                struct create_args create;
                struct mkdir_args mkdir;
                struct mknod_args mknod;
@@ -71,8 +59,6 @@ extern void __unionfs_mkdir(struct work_struct *work);
 extern void __unionfs_mknod(struct work_struct *work);
 extern void __unionfs_symlink(struct work_struct *work);
 extern void __unionfs_unlink(struct work_struct *work);
-extern void __delete_whiteouts(struct work_struct *work);
-extern void __is_opaque_dir(struct work_struct *work);
 
 #endif /* _SIOQ_H */
 
diff --git a/fs/unionfs/subr.c b/fs/unionfs/subr.c
index 8d1ce32..c8f12e8 100644
--- a/fs/unionfs/subr.c
+++ b/fs/unionfs/subr.c
@@ -18,89 +18,6 @@
 
 #include "union.h"
 
-/* Pass an unionfs dentry and an index.  It will try to create a whiteout
- * for the filename in dentry, and will try in branch 'index'.  On error,
- * it will proceed to a branch to the left.
- */
-int create_whiteout(struct dentry *dentry, int start)
-{
-       int bstart, bend, bindex;
-       struct dentry *hidden_dir_dentry;
-       struct dentry *hidden_dentry;
-       struct dentry *hidden_wh_dentry;
-       char *name = NULL;
-       int err = -EINVAL;
-       verify_locked(dentry);
-
-       bstart = dbstart(dentry);
-       bend = dbend(dentry);
-
-       /* odf whiteout */
-       err = odf_create_wh(dentry);
-       goto out;               /* FIXME: bypass the original whiteout code   */
-
-       /* create dentry's whiteout equivalent */
-       name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-       if (IS_ERR(name)) {
-               err = PTR_ERR(name);
-               goto out;
-       }
-
-       for (bindex = start; bindex >= 0; bindex--) {
-               hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
-
-               if (!hidden_dentry) {
-                       /* if hidden dentry is not present, create the entire
-                        * hidden dentry directory structure and go ahead.
-                        * Since we want to just create whiteout, we only want
-                        * the parent dentry, and hence get rid of this dentry.
-                        */
-                       hidden_dentry = create_parents(dentry->d_inode,
-                                                      dentry, bindex);
-                       if (!hidden_dentry || IS_ERR(hidden_dentry)) {
-                               printk(KERN_DEBUG "create_parents failed for "
-                                               "bindex = %d\n", bindex);
-                               continue;
-                       }
-               }
-
-               hidden_wh_dentry = lookup_one_len(name, hidden_dentry->d_parent,
-                                       dentry->d_name.len + UNIONFS_WHLEN);
-               if (IS_ERR(hidden_wh_dentry))
-                       continue;
-
-               /* The whiteout already exists. This used to be impossible, but
-                * now is possible because of opaqueness.
-                */
-               if (hidden_wh_dentry->d_inode) {
-                       dput(hidden_wh_dentry);
-                       err = 0;
-                       goto out;
-               }
-
-               hidden_dir_dentry = lock_parent(hidden_wh_dentry);
-               if (!(err = is_robranch_super(dentry->d_sb, bindex))) {
-                       err = vfs_create(hidden_dir_dentry->d_inode,
-                                      hidden_wh_dentry,
-                                      ~current->fs->umask & S_IRWXUGO, NULL);
-
-               }
-               unlock_dir(hidden_dir_dentry);
-               dput(hidden_wh_dentry);
-
-               if (!err || !IS_COPYUP_ERR(err))
-                       break;
-       }
-
-       /* set dbopaque  so that lookup will not proceed after this branch */
-       if (!err)
-               set_dbopaque(dentry, bindex);
-
-out:
-       kfree(name);
-       return err;
-}
-
 /* This is a helper function for rename, which ends up with hosed over dentries
  * when it needs to revert.
  */
@@ -142,37 +59,6 @@ out:
        return err;
 }
 
-int make_dir_opaque(struct dentry *dentry, int bindex)
-{
-       int err = 0;
-       struct dentry *hidden_dentry, *diropq;
-       struct inode *hidden_dir;
-
-       hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
-       hidden_dir = hidden_dentry->d_inode;
-       BUG_ON(!S_ISDIR(dentry->d_inode->i_mode) ||
-              !S_ISDIR(hidden_dir->i_mode));
-
-       mutex_lock(&hidden_dir->i_mutex);
-       diropq = lookup_one_len(UNIONFS_DIR_OPAQUE, hidden_dentry,
-                               sizeof(UNIONFS_DIR_OPAQUE) - 1);
-       if (IS_ERR(diropq)) {
-               err = PTR_ERR(diropq);
-               goto out;
-       }
-
-       if (!diropq->d_inode)
-               err = vfs_create(hidden_dir, diropq, S_IRUGO, NULL);
-       if (!err)
-               set_dbopaque(dentry, bindex);
-
-       dput(diropq);
-
-out:
-       mutex_unlock(&hidden_dir->i_mutex);
-       return err;
-}
-
 /* returns the sum of the n_link values of all the underlying inodes of the
  * passed inode
  */
@@ -218,19 +104,3 @@ int unionfs_get_nlinks(struct inode *inode)
 
        return (!dirs ? 0 : sum_nlinks + 2);
 }
-
-/* construct whiteout filename */
-char *alloc_whname(const char *name, int len)
-{
-       char *buf;
-
-       buf = kmalloc(len + UNIONFS_WHLEN + 1, GFP_KERNEL);
-       if (!buf)
-               return ERR_PTR(-ENOMEM);
-
-       strcpy(buf, UNIONFS_WHPFX);
-       strlcat(buf, name, len + UNIONFS_WHLEN + 1);
-
-       return buf;
-}
-
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 287cf4d..d5ec7ee 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -141,7 +141,6 @@ static int unionfs_statfs(struct dentry *dentry, struct 
kstatfs *buf)
        err = vfs_statfs(hidden_sb->s_root, buf);
 
        buf->f_type = UNIONFS_SUPER_MAGIC;
-       buf->f_namelen -= UNIONFS_WHLEN;
 
        memset(&buf->f_fsid, 0, sizeof(__kernel_fsid_t));
        memset(&buf->f_spare, 0, sizeof(buf->f_spare));
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 784a17e..20318fa 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -270,12 +270,6 @@ extern struct dentry *create_parents(struct inode *dir, 
struct dentry *dentry,
 /* partial lookup */
 extern int unionfs_partial_lookup(struct dentry *dentry);
 
-/* Pass an unionfs dentry and an index and it will try to create a whiteout
- * in branch 'index'.
- *
- * On error, it will proceed to a branch to the left
- */
-extern int create_whiteout(struct dentry *dentry, int start);
 /* copies a file from dbstart to newbindex branch */
 extern int copyup_file(struct inode *dir, struct file *file, int bstart,
                       int newbindex, loff_t size);
@@ -286,20 +280,11 @@ extern int copyup_named_file(struct inode *dir, struct 
file *file,
 extern int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
                         int new_bindex, struct file **copyup_file, loff_t len);
 
-extern int remove_whiteouts(struct dentry *dentry, struct dentry 
*hidden_dentry,
-                           int bindex);
-
-extern int do_delete_whiteouts(struct dentry *dentry, int bindex,
-                    struct unionfs_dir_state *namelist);
-
 extern int unionfs_get_nlinks(struct inode *inode);
 
 /* Is this directory empty: 0 if it is empty, -ENOTEMPTY if not. */
 extern int check_empty(struct dentry *dentry,
                       struct unionfs_dir_state **namelist);
-/* Delete whiteouts from this directory in branch bindex. */
-extern int delete_whiteouts(struct dentry *dentry, int bindex,
-                           struct unionfs_dir_state *namelist);
 
 /* Re-lookup a hidden dentry. */
 extern int unionfs_refresh_hidden_dentry(struct dentry *dentry, int bindex);
@@ -436,15 +421,6 @@ static inline int is_valid_dentry(struct dentry *dentry)
                atomic_read(&UNIONFS_SB(dentry->d_sb)->generation));
 }
 
-/* What do we use for whiteouts. */
-#define UNIONFS_WHPFX ".wh."
-#define UNIONFS_WHLEN 4
-/* If a directory contains this file, then it is opaque.  We start with the
- * .wh. flag so that it is blocked by lookup.
- */
-#define UNIONFS_DIR_OPAQUE_NAME "__dir_opaque"
-#define UNIONFS_DIR_OPAQUE UNIONFS_WHPFX UNIONFS_DIR_OPAQUE_NAME
-
 #ifndef DEFAULT_POLLMASK
 #define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
 #endif
@@ -452,7 +428,6 @@ static inline int is_valid_dentry(struct dentry *dentry)
 /*
  * EXTERNALS:
  */
-extern char *alloc_whname(const char *name, int len);
 extern int check_branch(struct nameidata *nd);
 extern int __parse_branch_mode(const char *name);
 extern int parse_branch_mode(const char *name);
@@ -474,7 +449,6 @@ static inline void unlock_dir(struct dentry *dir)
        dput(dir);
 }
 
-extern int make_dir_opaque(struct dentry *dir, int bindex);
 
 static inline struct vfsmount *unionfs_mntget(struct dentry *dentry, int 
bindex)
 {
diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c
index 05f01be..b46fdba 100644
--- a/fs/unionfs/unlink.c
+++ b/fs/unionfs/unlink.c
@@ -171,7 +171,7 @@ out:
 int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
 {
        int err = 0;
-       struct unionfs_dir_state *namelist = NULL; /* FIXME: dont need this now 
*/
+       struct unionfs_dir_state *namelist = NULL;
 
        BUG_ON(!is_valid_dentry(dentry));
 
@@ -187,25 +187,6 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
                goto out;
        /* FIXME: what if this fails? */
        err = odf_remove(dentry, ODF_RMV_NOTWH);
-       goto out; /* FIXME: bypass old code */
-       
-       /* create whiteout */
-       if (!err)
-               err = create_whiteout(dentry, dbstart(dentry));
-       else {
-               int new_err;
-
-               if (dbstart(dentry) == 0)
-                       goto out;
-
-               /* exit if the error returned was NOT -EROFS */
-               if (!IS_COPYUP_ERR(err))
-                       goto out;
-
-               new_err = create_whiteout(dentry, dbstart(dentry) - 1);
-               if (new_err != -EEXIST)
-                       err = new_err;
-       }
 
 out:
        /* call d_drop so the system "forgets" about us */
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to