commit 773d0eb4a7d496562522f8928f04edc6e3aa657b
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Thu May 3 22:20:59 2007 -0400

    cleanup: removed some unneeded rdstate code

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 41ad0ca..0a83793 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -634,7 +634,6 @@ int unionfs_file_release(struct inode *inode, struct file 
*file)
 {
        struct file *hidden_file = NULL;
        struct unionfs_file_info *fileinfo = UNIONFS_F(file);
-       struct unionfs_inode_info *inodeinfo = UNIONFS_I(inode);
        int bindex, bstart, bend;
        int fgen;
 
@@ -657,21 +656,6 @@ int unionfs_file_release(struct inode *inode, struct file 
*file)
        kfree(fileinfo->lower_files);
        kfree(fileinfo->saved_branch_ids);
 
-       if (fileinfo->rdstate) {
-               fileinfo->rdstate->access = jiffies;
-               printk(KERN_DEBUG "unionfs: saving rdstate with cookie "
-                      "%u [%d.%lld]\n",
-                      fileinfo->rdstate->cookie,
-                      fileinfo->rdstate->bindex,
-                      (long long)fileinfo->rdstate->dirpos);
-               spin_lock(&inodeinfo->rdlock);
-               inodeinfo->rdcount++;
-               list_add_tail(&fileinfo->rdstate->cache,
-                             &inodeinfo->readdircache);
-               mark_inode_dirty(inode);
-               spin_unlock(&inodeinfo->rdlock);
-               fileinfo->rdstate = NULL;
-       }
        kfree(fileinfo);
        unionfs_read_unlock(inode->i_sb);
        return 0;
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 0bef74f..21b2d91 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -297,18 +297,18 @@ out:
  * Moves the dentry to /odf/reclaim with the name of its inode no
  */
 int odf_reclaim(struct dentry *dentry)
-{                       
+{
        struct inode *old_dir, *new_dir;
        struct dentry *odf_dentry, *old_dentry, *new_dentry;
        struct odf_dentry_info *odi;
        char *new_name = NULL;
        int err = 0;
-       odf_dentry = UNIONFS_D(dentry)->odf_info->dentry; 
-       odi = UNIONFS_SB(dentry->d_sb)->odf->odi_rc; 
+       odf_dentry = UNIONFS_D(dentry)->odf_info->dentry;
+       odi = UNIONFS_SB(dentry->d_sb)->odf->odi_rc;
        new_name = kzalloc(ODF_INAME_LEN, GFP_KERNEL);
        if (!new_name){
                err = -ENOMEM;
-               goto out; 
+               goto out;
        }
        sprintf(new_name, "%lu", odf_dentry->d_inode->i_ino);
        /* lock new dir, the old dir should already be locked */
diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index f0525ff..ec12c3f 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@ -85,38 +85,6 @@ static int guesstimate_hash_size(struct inode *inode)
        return hashsize;
 }
 
-int init_rdstate(struct file *file)
-{
-       BUG_ON(sizeof(loff_t) !=
-              (sizeof(unsigned int) + sizeof(unsigned int)));
-       BUG_ON(UNIONFS_F(file)->rdstate != NULL);
-
-       UNIONFS_F(file)->rdstate = alloc_rdstate(file->f_dentry->d_inode,
-                                                fbstart(file));
-
-       return (UNIONFS_F(file)->rdstate ? 0 : -ENOMEM);
-}
-
-struct unionfs_dir_state *find_rdstate(struct inode *inode, loff_t fpos)
-{
-       struct unionfs_dir_state *rdstate = NULL;
-       struct list_head *pos;
-
-       spin_lock(&UNIONFS_I(inode)->rdlock);
-       list_for_each(pos, &UNIONFS_I(inode)->readdircache) {
-               struct unionfs_dir_state *r =
-                       list_entry(pos, struct unionfs_dir_state, cache);
-               if (fpos == rdstate2offset(r)) {
-                       UNIONFS_I(inode)->rdcount--;
-                       list_del(&r->cache);
-                       rdstate = r;
-                       break;
-               }
-       }
-       spin_unlock(&UNIONFS_I(inode)->rdlock);
-       return rdstate;
-}
-
 struct unionfs_dir_state *alloc_rdstate(struct inode *inode, int bindex)
 {
        int i = 0;
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 7a2da57..6257063 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -42,9 +42,7 @@ static void unionfs_read_inode(struct inode *inode)
        atomic_set(&info->generation,
                   atomic_read(&UNIONFS_SB(inode->i_sb)->generation));
        spin_lock_init(&info->rdlock);
-       info->rdcount = 1;
        info->hashsize = -1;
-       INIT_LIST_HEAD(&info->readdircache);
 
        size = sbmax(inode->i_sb) * sizeof(struct inode *);
        info->lower_inodes = kzalloc(size, GFP_KERNEL);
@@ -62,7 +60,7 @@ static void unionfs_read_inode(struct inode *inode)
 }
 
 #if 0
-/* This does not seem to apply anymore, it must have been true for 2.4.x 
+/* This does not seem to apply anymore, it must have been true for 2.4.x
  * kernels and it causes dirty pages not to be written on umounts
  */
 static void unionfs_put_inode(struct inode *inode)
@@ -829,14 +827,6 @@ static void unionfs_clear_inode(struct inode *inode)
 {
        int bindex, bstart, bend;
        struct inode *hidden_inode;
-       struct list_head *pos, *n;
-       struct unionfs_dir_state *rdstate;
-
-       list_for_each_safe(pos, n, &UNIONFS_I(inode)->readdircache) {
-               rdstate = list_entry(pos, struct unionfs_dir_state, cache);
-               list_del(&rdstate->cache);
-               free_rdstate(rdstate);
-       }
 
        /*
         * Decrement a reference to a hidden_inode, which was incremented
@@ -906,30 +896,6 @@ void unionfs_destroy_inode_cache(void)
 }
 
 /*
- * Called when we have a dirty inode, right here we only throw out
- * parts of our readdir list that are too old.
- */
-static int unionfs_write_inode(struct inode *inode, int sync)
-{
-       struct list_head *pos, *n;
-       struct unionfs_dir_state *rdstate;
-
-       spin_lock(&UNIONFS_I(inode)->rdlock);
-       list_for_each_safe(pos, n, &UNIONFS_I(inode)->readdircache) {
-               rdstate = list_entry(pos, struct unionfs_dir_state, cache);
-               /* We keep this list in LRU order. */
-               if ((rdstate->access + RDCACHE_JIFFIES) > jiffies)
-                       break;
-               UNIONFS_I(inode)->rdcount--;
-               list_del(&rdstate->cache);
-               free_rdstate(rdstate);
-       }
-       spin_unlock(&UNIONFS_I(inode)->rdlock);
-
-       return 0;
-}
-
-/*
  * Used only in nfs, to kill any pending RPC tasks, so that subsequent
  * code can actually succeed and won't leave tasks that need handling.
  */
@@ -1022,7 +988,6 @@ struct super_operations unionfs_sops = {
        .clear_inode    = unionfs_clear_inode,
        .umount_begin   = unionfs_umount_begin,
        .show_options   = unionfs_show_options,
-       .write_inode    = unionfs_write_inode,
        .alloc_inode    = unionfs_alloc_inode,
        .destroy_inode  = unionfs_destroy_inode,
 };
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 3b726c7..2d4a156 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -84,7 +84,6 @@ struct unionfs_file_info {
        int bend;
        atomic_t generation;
 
-       struct unionfs_dir_state *rdstate;
        struct file **lower_files;
        int *saved_branch_ids; /* IDs of branches when file was opened */
 };
@@ -123,9 +122,8 @@ struct unionfs_inode_info {
        atomic_t generation;
        int stale;
        /* Stuff for readdir over NFS. */
+       /* XXX: can I safely remove these? */
        spinlock_t rdlock;
-       struct list_head readdircache;
-       int rdcount;
        int hashsize;
        int cookie;
 
@@ -223,31 +221,13 @@ extern int unionfs_init_dentry_cache(void);
 extern void unionfs_destroy_dentry_cache(void);
 
 /* Initialize and free readdir-specific  state. */
-extern int init_rdstate(struct file *file);
 extern struct unionfs_dir_state *alloc_rdstate(struct inode *inode, int 
bindex);
-extern struct unionfs_dir_state *find_rdstate(struct inode *inode, loff_t 
fpos);
 extern void free_rdstate(struct unionfs_dir_state *state);
 extern int add_filldir_node(struct unionfs_dir_state *rdstate, const char 
*name,
                            int namelen, int bindex, int whiteout);
 extern struct filldir_node *find_filldir_node(struct unionfs_dir_state 
*rdstate,
                                              const char *name, int namelen);
-
-extern struct dentry **alloc_new_dentries(int objs);
-extern struct unionfs_data *alloc_new_data(int objs);
-
-/* We can only use 32-bits of offset for rdstate --- blech! */
-#define DIREOF (0xfffff)
-#define RDOFFBITS 20           /* This is the number of bits in DIREOF. */
 #define MAXRDCOOKIE (0xfff)
-/* Turn an rdstate into an offset. */
-static inline off_t rdstate2offset(struct unionfs_dir_state *buf)
-{
-       off_t tmp;
-
-       tmp = ((buf->cookie & MAXRDCOOKIE) << RDOFFBITS)
-               | (buf->offset & DIREOF);
-       return tmp;
-}
 
 #define unionfs_read_lock(sb)   down_read(&UNIONFS_SB(sb)->rwsem)
 #define unionfs_read_unlock(sb)         up_read(&UNIONFS_SB(sb)->rwsem)
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to