commit fae306cbdf31897cd5325e4f2432dfeb658a5f06
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date: Tue Apr 3 16:56:40 2007 -0400
removed recursive cleanup function
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index ba37ec9..f4cfb0d 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -23,9 +23,6 @@
#define RD_CACHE_ODF 2
#define RD_CHECK_HD_EMPTY 3
-#define RM_ALL 0
-#define RM_LEAF 1
-
#define STACK_SIZE 64 /* initial size of the dentry stack */
/* a stack for dentries */
@@ -59,15 +56,6 @@ struct unionfs_rdutil_callback {
int mode;
};
-struct unionfs_rmdir_callback {
- int err;
- int filldir_called;
- struct dentry *dir;
- struct vfsmount *mnt;
- int isleaf;
- int mode;
-};
-
/* callback structure for odf_cleanup*/
struct unionfs_cleanup_callback {
int err;
@@ -80,40 +68,6 @@ struct unionfs_cleanup_callback {
u64 inodes;
};
-static int rmdir_util_callback(void *dirent, const char *name, int namelen,
- loff_t offset, u64 ino, unsigned int d_type)
-{
- int err = 0;
- struct unionfs_rmdir_callback *buf = dirent;
- struct dentry *dentry;
-
- buf->filldir_called++;
-
- if (name[0] == '.' &&
- (namelen == 1 || (name[1] == '.' && namelen == 2)))
- goto out;
-
- dentry = lookup_one_len(name, buf->dir, namelen);
- if (IS_ERR(dentry)) {
- err = PTR_ERR(dentry);
- goto out;
- }
- else if (!dentry->d_inode)
- BUG_ON(1); /*can this ever happen?*/
-
- if (d_type == DT_DIR) {
- buf->isleaf = 0;
- err = unionfs_force_rmdir(buf->mnt, dentry,
- buf->mode == RM_LEAF ? FRMV_LEAF : FRMV_ALL);
- }
- else
- err = vfs_unlink(buf->dir->d_inode, dentry);
- dput(dentry);
-out:
- buf->err = err;
- return err;
-}
-
/* odf_cleanup callback */
static int cleanup_util_callback(void *dirent, const char *name, int namelen,
loff_t offset, u64 ino, unsigned int d_type)
@@ -486,72 +440,6 @@ out:
return err;
}
-/* This function recursively rermoves all the entries of a lower directory
- * at a specific branch and then the directory itself. It does not cross
- * branches, and does nothing visible to the union. It should only be used
- * when both a whiteout and a dir at top branch exists and we need to create
- * create a new dentry or in the odf for cleanup
- * Flags: RMV_ALL : removes all entries
- * RMV_LEAF : removes dirs only if they are leaves (dont have
subdirs)
- * RMV_NOTPARENT : can be set with both flags above, does not rmv
base dir
- */
-int unionfs_force_rmdir(struct vfsmount *mnt, struct dentry *hidden_dentry,
int flags)
-{
- int err = 0;
- struct file *hidden_file;
- struct unionfs_rmdir_callback *buf = NULL;
-
- buf = kmalloc(sizeof(struct unionfs_rmdir_callback), GFP_KERNEL);
- if (!buf) {
- err = -ENOMEM;
- goto out;
- }
- buf->err = 0;
- buf->dir = hidden_dentry;
- buf->mnt = mnt;
- buf->isleaf = 1;
- if (flags & FRMV_LEAF)
- buf->mode = RM_LEAF;
- else
- buf->mode = RM_ALL;
-
- if (!hidden_dentry->d_inode)
- goto out;
- if (!S_ISDIR(hidden_dentry->d_inode->i_mode))
- goto out;
-
- dget(hidden_dentry);
- mntget(mnt);
- hidden_file = dentry_open(hidden_dentry, mnt, O_RDONLY);
- if (IS_ERR(hidden_file)) {
- err = PTR_ERR(hidden_file);
- dput(hidden_dentry);
- goto out;
- }
-
- do {
- buf->filldir_called = 0;
- err = vfs_readdir(hidden_file, rmdir_util_callback, buf);
- if (buf->err)
- err = buf->err;
- } while ((err >= 0) && buf->filldir_called);
-
- /* fput calls dput for hidden_dentry */
- fput(hidden_file);
-
- if (err < 0)
- goto out;
-
- if ((flags & FRMV_NOTPARENT) || ((flags & FRMV_LEAF) && !buf->isleaf))
- goto out;
- err = vfs_rmdir(hidden_dentry->d_parent->d_inode, hidden_dentry);
-
-out:
- kfree(buf);
-
- return err;
-}
-
/* Remove the hidden dentry by:
* a) rmdir if its a physically empty dir
* b) silly rename if its not physically empty
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 6493f49..05dd8b2 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -316,15 +316,9 @@ int unionfs_unlink(struct inode *dir, struct dentry
*dentry);
int unionfs_rmdir(struct inode *dir, struct dentry *dentry);
int __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd);
-int unionfs_force_rmdir(struct vfsmount *mnt, struct dentry *hidden_dentry,
int flags);
int unionfs_force_rm(struct dentry *dentry, struct dentry **hidden_dentry, int
bindex);
int unionfs_silly_rename(struct dentry *dentry, struct dentry *hidden_dentry);
-/* Force rmv flags */
-#define FRMV_ALL 0
-#define FRMV_NOTPARENT 1
-#define FRMV_LEAF 2
-
/* The values for unionfs_interpose's flag. */
#define INTERPOSE_DEFAULT 0
#define INTERPOSE_LOOKUP 1
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs