commit 463ae1c8e7f38d97c3a756245e9cd22af8fcf749
Merge: f354bf3... 2f8cbae...
Author: Erez_Zadok <[EMAIL PROTECTED]>
Date:   Fri May 25 16:36:43 2007 -0400

    Merge branch 'master' of story:/home/git/unionfs-odf

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 
c0550b970880276688556b533c1ad4b0ede23f45..8ad5ed690dbe2efbc872cda53793fff0421244a2
 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -154,7 +154,7 @@ int unionfs_silly_rename(struct dentry *
                goto out;
 
        /* create a whiteout */
-       odi = odf_lookup_name(UNIONFS_SB(dentry->d_sb)->odf,
+       odi = odf_lookup_name(&UNIONFS_SB(dentry->d_sb)->odf,
                                UNIONFS_D(dentry->d_parent)->odf_info,
                                name, strlen(name), ODF_LOOKUP_WH, odi);
        BUG_ON(IS_ERR(odi) || odi == NULL);
@@ -470,7 +470,7 @@ static int __open_dir(struct inode *inod
        struct dentry *hidden_dentry;
        struct file *hidden_file;
        int bindex, bstart, bend;
-       struct odf_dentry_info *odi;
+       struct dentry *odf_cache;
        struct timespec *newest;
        int err;
        bstart = fbstart(file) = dbstart(file->f_dentry);
@@ -506,12 +506,12 @@ static int __open_dir(struct inode *inod
                unionfs_read_unlock(inode->i_sb);
        }
 
-       odi = odf_ic_cache_dentry(file->f_dentry);
-       if (IS_ERR(odi))
-               return PTR_ERR(odi);
-       err = odf_cache_dir(file->f_dentry, odi->dentry, newest);
+       odf_cache = odf_ic_cache_dentry(file->f_dentry);
+       if (IS_ERR(odf_cache))
+               return PTR_ERR(odf_cache);
+       err = odf_cache_dir(file->f_dentry, odf_cache, newest);
        /* FIXME: store the dentry somewhere */
-       odf_put_info(odi);
+       dput(odf_cache);
        return err;
 }
 
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index 
21f8f3cb783e52ede5429ec1043a37154affd86a..d39e1c3f4da112de2b59d7b59de7a95b005808ea
 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -23,7 +23,7 @@ static int unionfs_readdir(struct file *
        int err = 0;
        struct file *odf_file = NULL;
        struct inode *inode = NULL;
-       struct odf_dentry_info *odi = NULL;
+       struct dentry *odf_cache = NULL;
        loff_t size, pos;
        int overflow = 0;
        /* dirent */
@@ -40,19 +40,19 @@ static int unionfs_readdir(struct file *
 
        /* Get the odf/ic file */
        /* FIXME: this should be saved somewhere, also check mtime */
-       odi = odf_ic_cache_dentry(file->f_dentry);
-       if (IS_ERR(odi)){
-               err = PTR_ERR(odi);
-               odi = NULL;
+       odf_cache = odf_ic_cache_dentry(file->f_dentry);
+       if (IS_ERR(odf_cache)){
+               err = PTR_ERR(odf_cache);
+               odf_cache = NULL;
                goto out;
        }
 
        /* check if cached dir does not exist */
-       if (!odi->dentry->d_inode || !odi->dentry->d_inode->i_size) {
+       if (!odf_cache->d_inode || !odf_cache->d_inode->i_size) {
 
                /* odf cache dir calls partial lookup wich expects a locked 
dentry */
                unionfs_lock_dentry(file->f_dentry);
-               err = odf_cache_dir(file->f_dentry, odi->dentry, 
&file->f_dentry->d_inode->i_mtime);
+               err = odf_cache_dir(file->f_dentry, odf_cache, 
&file->f_dentry->d_inode->i_mtime);
                unionfs_unlock_dentry(file->f_dentry);
                if (err)
                        goto out;
@@ -65,15 +65,15 @@ static int unionfs_readdir(struct file *
                file->f_pos = 0;
        }
 
-       dget(odi->dentry);
-       mntget(UNIONFS_SB(file->f_dentry->d_sb)->odf->mnt);
-       odf_file = dentry_open(odi->dentry,
-                       UNIONFS_SB(file->f_dentry->d_sb)->odf->mnt,
-                       O_RDONLY);
+       dget(odf_cache);
+       mntget(UNIONFS_SB(file->f_dentry->d_sb)->odf.mnt);
+       odf_file = dentry_open(odf_cache,
+                              UNIONFS_SB(file->f_dentry->d_sb)->odf.mnt,
+                              O_RDONLY);
        if (IS_ERR(odf_file)){
                err = PTR_ERR(odf_file);
-               mntput(UNIONFS_SB(file->f_dentry->d_sb)->odf->mnt);
-               dput(odi->dentry);
+               mntput(UNIONFS_SB(file->f_dentry->d_sb)->odf.mnt);
+               dput(odf_cache);
                odf_file = NULL;
                goto out;
        }
@@ -84,7 +84,7 @@ static int unionfs_readdir(struct file *
 
        odf_file->f_pos = file->f_pos;
 
-       size = odi->dentry->d_inode->i_size;
+       size = odf_cache->d_inode->i_size;
        while (odf_file->f_pos < size && !overflow) {
 
                pos = odf_file->f_pos;
@@ -100,7 +100,7 @@ static int unionfs_readdir(struct file *
        }
 
        /* Copy the atime. */
-       fsstack_copy_attr_atime(inode, odi->dentry->d_inode);
+       fsstack_copy_attr_atime(inode, odf_cache->d_inode);
 
        /* save the file position */
        file->f_pos = odf_file->f_pos;
@@ -117,7 +117,7 @@ out:
        kfree(name);
        if (odf_file)
                filp_close(odf_file, NULL);
-       odf_put_info(odi);
+       dput(odf_cache);
        unionfs_read_unlock(file->f_dentry->d_sb);
        return err;
 }
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index 
b8cf4bf782eaa3f5ab1fe8303952a6973e8cccb8..62f71ba1b664f25a7d127d6fc801d40b17d0139f
 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -153,7 +153,7 @@ static int readdir_util_callback(void *d
        }
 
        /* check odf */
-       odi = odf_lookup_name(UNIONFS_SB(buf->dir->d_sb)->odf,
+       odi = odf_lookup_name(&UNIONFS_SB(buf->dir->d_sb)->odf,
                        UNIONFS_D(buf->dir)->odf_info,
                        name, namelen, ODF_LOOKUP_LOCKED, NULL);
        if (IS_ERR(odi)){
@@ -180,7 +180,7 @@ find:
                goto out;
 
        if (odi)
-               ino = odi->inum;
+               ino = odi->dentry->d_inode->i_ino;
        err = odf_write_dirent(buf->filp, name, namelen, ino, d_type);
 out:
        odf_put_info(odi);
@@ -308,7 +308,6 @@ int odf_cache_dir(struct dentry *d_upper
                goto out_sb;
 
 retry:
-       odf_lock(UNIONFS_SB(sb)->odf->odi_ic);
        BUG_ON(!S_ISDIR(d_upper->d_inode->i_mode));
 
        i_odf = d_odf->d_inode;
@@ -319,7 +318,7 @@ retry:
                        goto out;
        }
        dget(d_odf);
-       mntget(UNIONFS_SB(sb)->odf->mnt);
+       mntget(UNIONFS_SB(sb)->odf.mnt);
 
        /* force truncate if file exists */
        if (i_odf) {
@@ -330,12 +329,12 @@ retry:
                        goto out;
        }
        odf_file = dentry_open(d_odf,
-                       UNIONFS_SB(sb)->odf->mnt,
+                       UNIONFS_SB(sb)->odf.mnt,
                        O_TRUNC|O_CREAT|O_WRONLY);
        if (IS_ERR(odf_file)){
                err = PTR_ERR(odf_file);
                dput(d_odf);
-               mntput(UNIONFS_SB(sb)->odf->mnt);
+               mntput(UNIONFS_SB(sb)->odf.mnt);
                odf_file = NULL;
                goto out;
        }
@@ -360,7 +359,7 @@ retry:
        }
 
        /* lock to prevent concurrent writes */
-       odf_lock(UNIONFS_D(d_upper)->odf_info);
+       /* LOCK: need to lock ic? */
        /* Process the hidden directories with rdutil_callback as a filldir. */
        for (bindex = bstart; bindex <= bend; bindex++) {
                hidden_dentry = unionfs_lower_dentry_idx(d_upper, bindex);
@@ -380,7 +379,7 @@ retry:
                        err = PTR_ERR(hidden_file);
                        dput(hidden_dentry);
                        branchput(sb, bindex);
-                       goto out_unlock;
+                       goto out;
                }
 
                do {
@@ -399,9 +398,8 @@ retry:
                branchput(sb, bindex);
 
                if (err < 0)
-                       goto out_unlock;
+                       goto out;
        }
-       odf_unlock(UNIONFS_D(d_upper)->odf_info);
 
        /* set mtime of odf file to that of higher file */
        attr.ia_mtime = *mtime;
@@ -409,9 +407,6 @@ retry:
        err = notify_change(d_odf, &attr);
        goto out;
 
-out_unlock:
-       odf_unlock(UNIONFS_D(d_upper)->odf_info);
-
 out:
        if (buf && buf->rdstate)
                free_rdstate(buf->rdstate);
@@ -422,11 +417,9 @@ out:
                filp_close(odf_file, NULL);
        odf_file = NULL;
 
-       odf_unlock(UNIONFS_SB(sb)->odf->odi_ic);
-
        if (err == -ENOSPC && !cleaned) {
                cleaned = 1;
-               wake_up_and_wait_sioa(UNIONFS_SB(sb)->odf->cleanup);
+               wake_up_and_wait_sioa(UNIONFS_SB(sb)->odf.cleanup);
                goto retry;
        }
 
@@ -578,8 +571,8 @@ int odf_cleanup(struct odf_sb_info *odf,
        buf->stack = &stack;
 
        /* first cleanup odf/ic */
-       dget(odf->odi_ic->dentry);
-       stack.item[stack.n++] = odf->odi_ic->dentry;
+       dget(odf->ic);
+       stack.item[stack.n++] = odf->ic;
 
 
 cleanup_loop:
@@ -619,8 +612,7 @@ cleanup_loop:
                         * is entirely flat, ie only odf/reclaim contains
                         * subdirectories
                         */
-                       if (dentry != odf->odi_rc->dentry &&
-                                       dentry != odf->odi_sr->dentry) {
+                       if (dentry != odf->rc && dentry != odf->sr) {
                                blocks = dentry->d_inode->i_blocks;
                                bytes = blocks * dentry->d_sb->s_blocksize;
                                isize = i_size_read(dentry->d_inode);
@@ -650,8 +642,8 @@ cleanup_loop:
                /* cleanup odf/sr as well */
                reclaim = 1;
                buf->reclaim = 1;
-               dget(odf->odi_sr->dentry);
-               stack.item[stack.n++] = odf->odi_sr->dentry;
+               dget(odf->sr);
+               stack.item[stack.n++] = odf->sr;
                goto cleanup_loop;
        }
        else if (mode == ODF_CLEAN_CACHE && reclaim)
@@ -664,8 +656,8 @@ cleanup_loop:
                if (!reclaim) {
                        reclaim = 1;
                        buf->reclaim = 1;
-                       dget(odf->odi_rc->dentry);
-                       stack.item[stack.n++] = odf->odi_rc->dentry;
+                       dget(odf->rc);
+                       stack.item[stack.n++] = odf->rc;
                        goto cleanup_loop;
                }
        }
diff --git a/fs/unionfs/export.c b/fs/unionfs/export.c
index 
2f7d0b9efd99216a8faf58152eb539db8727284a..828622ec514dddfe12afb0abcc9ae3ceb1a64eb6
 100644
--- a/fs/unionfs/export.c
+++ b/fs/unionfs/export.c
@@ -6,7 +6,7 @@ extern struct export_operations export_o
 
 static struct dentry *__get_parent(struct super_block *sb, struct dentry 
*odf_dentry)
 {
-       struct dentry *odf_root = UNIONFS_SB(sb)->odf->odi_ns->dentry;
+       struct dentry *odf_root = UNIONFS_D(sb->s_root)->odf_info->dentry;
        struct dentry *d, *d_parent, *parent, *child = NULL;
        struct dentry_stack stack;
        char *name = NULL;
@@ -120,7 +120,7 @@ static struct dentry *unionfs_get_parent
        BUG_ON(!S_ISDIR(child->d_inode->i_mode));
 
        res = ERR_PTR(-EACCES);
-       odf = UNIONFS_SB(child->d_sb)->odf;
+       odf = &UNIONFS_SB(child->d_sb)->odf;
        odf_sb = odf->sb->d_sb;
 
        if (!odf_sb->s_export_op || !odf_sb->s_export_op->get_parent)
@@ -165,7 +165,7 @@ static int unionfs_get_name(struct dentr
 {
        int err;
        struct inode *dir = dentry->d_inode;
-       struct odf_dentry_info *odi = NULL;
+       struct dentry *odf_cache = NULL;
        struct file *file = NULL;
        /* dirent */
        u64 ino;
@@ -184,29 +184,29 @@ static int unionfs_get_name(struct dentr
        if (!UNIONFS_D(dentry) || !UNIONFS_D(dentry)->odf_info)
                goto out;
 
-       odi = odf_ic_cache_dentry(dentry);
-       if (IS_ERR(odi)){
-               err = PTR_ERR(odi);
-               odi = NULL;
+       odf_cache = odf_ic_cache_dentry(dentry);
+       if (IS_ERR(odf_cache)){
+               err = PTR_ERR(odf_cache);
+               odf_cache = NULL;
                goto out;
        }
 
        /* reconstruct the cached dir if necessary */
-       if (!odi->dentry->d_inode || !odi->dentry->d_inode->i_size) {
+       if (!odf_cache->d_inode || !odf_cache->d_inode->i_size) {
                unionfs_lock_dentry(dentry);
-               err = odf_cache_dir(dentry, odi->dentry, 
&dentry->d_inode->i_mtime);
+               err = odf_cache_dir(dentry, odf_cache, 
&dentry->d_inode->i_mtime);
                unionfs_unlock_dentry(dentry);
                if (err)
                        goto out;
        }
 
-       dget(odi->dentry);
-       mntget(UNIONFS_SB(dentry->d_sb)->odf->mnt);
-       file = dentry_open(odi->dentry, UNIONFS_SB(dentry->d_sb)->odf->mnt, 
O_RDONLY);
+       dget(odf_cache);
+       mntget(UNIONFS_SB(dentry->d_sb)->odf.mnt);
+       file = dentry_open(odf_cache, UNIONFS_SB(dentry->d_sb)->odf.mnt, 
O_RDONLY);
        if (IS_ERR(file)){
                err = PTR_ERR(file);
-               mntput(UNIONFS_SB(dentry->d_sb)->odf->mnt);
-               dput(odi->dentry);
+               mntput(UNIONFS_SB(dentry->d_sb)->odf.mnt);
+               dput(odf_cache);
                file = NULL;
                goto out;
        }
@@ -236,7 +236,7 @@ out:
        tmp_name = NULL;
        if (file)
                filp_close(file, NULL);
-       odf_put_info(odi);
+       dput(odf_cache);
        return err;
 }
 
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 
b2f0e7dbab72bf6cb939fd3873d8d8f028f6e941..0b9cad508b1f8a746c23a818fa394eb57dc25a75
 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -96,7 +96,7 @@ struct dentry *unionfs_interpose(struct 
                if (opaque >= 0)
                        set_dbend(dentry, opaque);
 
-               ino = UNIONFS_D(dentry)->odf_info->inum;
+               ino = UNIONFS_D(dentry)->odf_info->dentry->d_inode->i_ino;
 
                inode = iget(sb, ino);
                if (!inode) {
@@ -590,10 +590,6 @@ static int unionfs_read_super(struct sup
        int bindex, bstart, bend;
        char *odf_options = NULL;
        int *bid = NULL, high_bid;
-       int put_ns = 0; /* we dget the ns dentry in odf_read_super but do not
-                        * put it in odf_put_super since it is also assigned to 
s_root
-                        * and will be put by s_root. put_ns decides if we got
-                        * the ns dentry but not yet assigned it to s_root */
 
        if (!raw_data) {
                printk(KERN_WARNING
@@ -619,15 +615,12 @@ static int unionfs_read_super(struct sup
         * Try to extract the odf option from the mount time options and
         * then initialize odf sb data
         */
-       UNIONFS_SB(sb)->odf = odf_read_super(raw_data);
-       if (IS_ERR(UNIONFS_SB(sb)->odf)) {
+       err = odf_read_super(sb, raw_data);
+       if (err) {
                printk(KERN_WARNING "unionfs_read_super: odf error\n");
-               err = PTR_ERR(UNIONFS_SB(sb)->odf);
-               UNIONFS_SB(sb)->odf = NULL;
                goto out_free;
        }
-       odf = UNIONFS_SB(sb)->odf;
-       put_ns = 1;
+       odf = &UNIONFS_SB(sb)->odf;
 
        /* if this is an old odf reconstruct the dirs part of the mount time 
options
         * from the odf data on disk and discard the old options
@@ -738,8 +731,8 @@ static int unionfs_read_super(struct sup
        set_dbend(sb->s_root, bend);
 
        /* save odf root dentry */
-       UNIONFS_D(sb->s_root)->odf_info = UNIONFS_SB(sb)->odf->odi_ns;
-       put_ns = 0;
+       UNIONFS_D(sb->s_root)->odf_info =
+               odf_fill_info(NULL, &UNIONFS_SB(sb)->odf, 
UNIONFS_SB(sb)->odf.ns);
 
        /* Set the generation number to one, since this is for the mount. */
        atomic_set(&UNIONFS_D(sb->s_root)->generation, 1);
@@ -783,15 +776,12 @@ out_dput:
        }
 
 out_free:
-       if (UNIONFS_SB(sb)->odf) {
-               /* cleanup thread is not started,free it here so
-                * odf_put_super doesnt wait for it */
-               kfree(UNIONFS_SB(sb)->odf->cleanup);
-               UNIONFS_SB(sb)->odf->cleanup = NULL;
-               if (put_ns)
-                       odf_put_info(UNIONFS_SB(sb)->odf->odi_ns);
-               odf_put_super(UNIONFS_SB(sb)->odf);
-       }
+       /* cleanup thread is not started,free it here so
+        * odf_put_super doesnt wait for it */
+       kfree(UNIONFS_SB(sb)->odf.cleanup);
+       UNIONFS_SB(sb)->odf.cleanup = NULL;
+       odf_put_super(&UNIONFS_SB(sb)->odf);
+
        kfree(UNIONFS_SB(sb)->data);
        kfree(UNIONFS_SB(sb));
        sb->s_fs_info = NULL;
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 
7a45279dc18f31d5e3e7e19477d9ffb5d54f2847..95dd2454300eb6782de2c95745d55268b97c6a84
 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -12,8 +12,8 @@ static inline struct dentry * __odf_crea
        if (IS_ERR(dentry))
                goto out;
        if (unlikely(dentry->d_inode)) {
-               dput(dentry);
-               dentry = ERR_PTR(-EEXIST);
+       //      dput(dentry);
+       //      dentry = ERR_PTR(-EEXIST);
                goto out;
        }
        err = vfs_mkdir(parent->d_inode, dentry, S_IRWXUGO);
@@ -68,7 +68,7 @@ int __odf_create_hierarchy(struct dentry
                goto out;
        }
        if (unlikely(dentry->d_inode)){
-               err = -EEXIST;
+       //      err = -EEXIST;
                goto out;
        }
        err = vfs_create(odf_root->d_inode, dentry, S_IRWXUGO, NULL);
@@ -83,10 +83,10 @@ out:
  * Initialize any odf data we might need
  * Reads the odf file from the options
  */
-struct odf_sb_info* odf_read_super(char *options)
+int odf_read_super(struct super_block *sb, char *options)
 {
        struct nameidata nd;
-       struct odf_sb_info *osi = NULL;
+       struct odf_sb_info *osi = &UNIONFS_SB(sb)->odf;
        char *odffile = NULL;
        struct sioa_args *sioa;
        int err, odfforce;
@@ -111,12 +111,6 @@ struct odf_sb_info* odf_read_super(char 
        if (nd.dentry->d_sb->s_root != nd.dentry)
                printk(KERN_WARNING "unionfs: warning: odf is not root\n");
 
-       osi = kzalloc(sizeof(struct odf_sb_info), GFP_KERNEL);
-       if (!osi) {
-               err = -ENOMEM;
-               goto out_release;
-       }
-
        osi->sb = lookup_one_len(ODF_SB, nd.dentry, sizeof(ODF_SB) - 1);
        if (IS_ERR(osi->sb)) {
                err = PTR_ERR(osi->sb);
@@ -135,31 +129,31 @@ struct odf_sb_info* odf_read_super(char 
                        goto out_free;
        }
 
-       osi->odi_ns = odf_getpath(nd.dentry, osi, ODF_NS);
-       if (IS_ERR(osi->odi_ns)){
-               err = PTR_ERR(osi->odi_ns);
-               osi->odi_ns = NULL;
+       osi->ns = odf_getdir(nd.dentry, ODF_NS, sizeof(ODF_NS) - 1);
+       if (IS_ERR(osi->ns)){
+               err = PTR_ERR(osi->ns);
+               osi->ns = NULL;
                goto out_free;
        }
 
-       osi->odi_rc = odf_getpath(nd.dentry, osi, ODF_RC);
-       if (IS_ERR(osi->odi_rc)){
-               err = PTR_ERR(osi->odi_rc);
-               osi->odi_rc = NULL;
+       osi->rc = odf_getdir(nd.dentry, ODF_RC, sizeof(ODF_RC) - 1);
+       if (IS_ERR(osi->rc)){
+               err = PTR_ERR(osi->rc);
+               osi->rc = NULL;
                goto out_free;
        }
 
-       osi->odi_ic = odf_getpath(nd.dentry, osi, ODF_IC);
-       if (IS_ERR(osi->odi_ic)){
-               err = PTR_ERR(osi->odi_ic);
-               osi->odi_ic = NULL;
+       osi->ic = odf_getdir(nd.dentry, ODF_IC, sizeof(ODF_IC) - 1);
+       if (IS_ERR(osi->ic)){
+               err = PTR_ERR(osi->ic);
+               osi->ic = NULL;
                goto out_free;
        }
 
-       osi->odi_sr = odf_getpath(nd.dentry, osi, ODF_SR);
-       if (IS_ERR(osi->odi_sr)){
-               err = PTR_ERR(osi->odi_sr);
-               osi->odi_sr = NULL;
+       osi->sr = odf_getdir(nd.dentry, ODF_SR, sizeof(ODF_SR) - 1);
+       if (IS_ERR(osi->sr)){
+               err = PTR_ERR(osi->sr);
+               osi->sr = NULL;
                goto out_free;
        }
 
@@ -192,21 +186,25 @@ struct odf_sb_info* odf_read_super(char 
        goto out;
 
 out_free:
-       odf_put_info(osi->odi_ns);
-       odf_put_info(osi->odi_rc);
-       odf_put_info(osi->odi_ic);
-       odf_put_info(osi->odi_sr);
+       dput(osi->ns);
+       osi->ns = NULL;
+       dput(osi->rc);
+       osi->rc = NULL;
+       dput(osi->ic);
+       osi->ic = NULL;
+       dput(osi->sr);
+       osi->sr = NULL;
        dput(osi->sb);
+       osi->sb = NULL;
        dput(osi->whiteout);
+       osi->whiteout = NULL;
        kfree(osi->branch_uuids);
-       kfree(osi);
+       osi->branch_uuids = NULL;
 out_release:
        path_release(&nd);
 out:
-       if (err)
-               osi = ERR_PTR(err);
        kfree(odffile);
-       return osi;
+       return err;
 
 }
 
@@ -215,13 +213,22 @@ out:
  */
 void odf_put_super(struct odf_sb_info *osi)
 {
-       /* do not put ns here, as it will be put by root of unionfs*/
-       odf_put_info(osi->odi_rc);
-       odf_put_info(osi->odi_ic);
-       odf_put_info(osi->odi_sr);
-       dput(osi->mnt->mnt_sb->s_root);
+       dput(osi->ns);
+       osi->ns = NULL;
+       dput(osi->rc);
+       osi->rc = NULL;
+       dput(osi->ic);
+       osi->ic = NULL;
+       dput(osi->sr);
+       osi->sr = NULL;
        dput(osi->sb);
+       osi->sb = NULL;
        dput(osi->whiteout);
+       osi->whiteout = NULL;
+       kfree(osi->branch_uuids);
+       osi->branch_uuids = NULL;
+
+       dput(osi->mnt->mnt_sb->s_root);
        mntput(osi->mnt);
        if (osi->cleanup)
                complete_sioa(osi->cleanup);
@@ -233,25 +240,22 @@ void odf_put_super(struct odf_sb_info *o
  * This is to be used for accessing whatever is in the root of the
  * odf, ie /odf/ic, /odf/ns, etc
  */
-struct odf_dentry_info* odf_getpath(struct dentry *d_odf, struct odf_sb_info 
*osi, const char *name)
+struct dentry* odf_getdir(struct dentry *d_odf, const char *name, int len)
 {
        struct dentry *dentry;
-       struct odf_dentry_info* odi = NULL;
 
-       dentry = lookup_one_len(name, d_odf, strlen(name));
-       if (IS_ERR(dentry) || !dentry) {
-               odi = ERR_PTR(-EINVAL);
-               goto out;
-       }
+       dentry = lookup_one_len(name, d_odf, len);
+       if (IS_ERR(dentry))
+               ;
        else if (!dentry->d_inode) {
-               odi = ERR_PTR(-EINVAL);
                dput(dentry);
-               goto out;
+               dentry = ERR_PTR(-EINVAL);
        }
-       odi = odf_fill_info(NULL, osi, dentry);
-       dput(dentry);
-out:
-       return odi;
+       else if (!S_ISDIR(dentry->d_inode->i_mode)) {
+               dput(dentry);
+               dentry = ERR_PTR(-EINVAL);
+       }
+       return dentry;
 }
 
 /* returns 1 if odfforce found, 0 if not */
@@ -315,44 +319,37 @@ out:
  */
 int odf_reclaim(struct dentry *dentry, int sr)
 {
-       struct inode *old_dir, *new_dir;
-       struct dentry *odf_dentry, *old_dentry, *new_dentry;
-       struct odf_dentry_info *odi;
+       struct inode *old_dir;
+       struct dentry *odf_dentry, *old_dentry, *new_dentry, *new_dir;
        char *new_name = NULL;
        int err = 0;
 
        odf_dentry = UNIONFS_D(dentry)->odf_info->dentry;
 
        if (sr)
-               odi = UNIONFS_SB(dentry->d_sb)->odf->odi_sr;
+               new_dir = UNIONFS_SB(dentry->d_sb)->odf.sr;
        else
-               odi = UNIONFS_SB(dentry->d_sb)->odf->odi_rc;
+               new_dir = UNIONFS_SB(dentry->d_sb)->odf.rc;
        new_name = kzalloc(ODF_INAME_LEN, GFP_KERNEL);
        if (!new_name){
                err = -ENOMEM;
                goto out;
        }
        sprintf(new_name, "%lu", odf_dentry->d_inode->i_ino);
-       /* lock new dir, the old dir should already be locked */
-       odf_lock(odi);
 
        old_dentry = odf_dentry;
        old_dir = odf_dentry->d_parent->d_inode;
-       new_dir = odi->dentry->d_inode;
-       new_dentry = lookup_one_len(new_name, odi->dentry, strlen(new_name));
+       new_dentry = lookup_one_len(new_name, new_dir, strlen(new_name));
        if (IS_ERR(new_dentry)) {
                err = PTR_ERR(new_dentry);
-               goto out_unlock;
+               goto out;
        }
 
        lock_rename(old_dentry->d_parent, new_dentry->d_parent);
-       err = vfs_rename(old_dir, old_dentry, new_dir, new_dentry);
+       err = vfs_rename(old_dir, old_dentry, new_dir->d_inode, new_dentry);
        unlock_rename(old_dentry->d_parent, new_dentry->d_parent);
        dput(new_dentry);
 
-out_unlock:
-       odf_unlock(odi); /* unlock new dir */
-
 out:
        kfree(new_name);
        return err;
@@ -364,14 +361,15 @@ out:
 int odf_release_sr(struct inode *inode)
 {
        struct dentry *old_dentry = NULL, *new_dentry = NULL;
-       struct odf_dentry_info *odi_sr, *odi_rc;
+       struct dentry *sr, *rc;
        char name[ODF_INAME_LEN];
        int err = 0;
+
        uid_t olduid = current->fsuid;
        gid_t oldgid = current->fsgid;
 
-       odi_sr = UNIONFS_SB(inode->i_sb)->odf->odi_sr;
-       odi_rc = UNIONFS_SB(inode->i_sb)->odf->odi_rc;
+       sr = UNIONFS_SB(inode->i_sb)->odf.sr;
+       rc = UNIONFS_SB(inode->i_sb)->odf.rc;
        memset(name, 0, ODF_INAME_LEN);
        if (!name){
                err = -ENOMEM;
@@ -379,11 +377,10 @@ int odf_release_sr(struct inode *inode)
        }
        sprintf(name, "%lu", inode->i_ino);
 
-       odf_lock(odi_sr);
-       odf_lock(odi_rc);
+       /* LOCK: need to lock sr? */
 
        /* check for an entry in /odf/sr */
-       old_dentry = lookup_one_len(name, odi_sr->dentry, strlen(name));
+       old_dentry = lookup_one_len(name, sr, strlen(name));
        if (IS_ERR(old_dentry)) {
                err = PTR_ERR(old_dentry);
                old_dentry = NULL;
@@ -393,7 +390,7 @@ int odf_release_sr(struct inode *inode)
                goto out_unlock;
 
        /* move it to /odf/rc with the same name */
-       new_dentry = lookup_one_len(name, odi_rc->dentry, strlen(name));
+       new_dentry = lookup_one_len(name, rc, strlen(name));
        if (IS_ERR(new_dentry)) {
                err = PTR_ERR(new_dentry);
                new_dentry = NULL;
@@ -410,8 +407,6 @@ int odf_release_sr(struct inode *inode)
        unlock_rename(old_dentry->d_parent, new_dentry->d_parent);
 
 out_unlock:
-       odf_unlock(odi_rc);
-       odf_unlock(odi_sr);
        dput(old_dentry);
        dput(new_dentry);
 out:
@@ -449,9 +444,6 @@ int odf_rename(struct dentry *old_dentry
        if (UNIONFS_D(new_dentry)->odf_info)
                err = odf_remove(new_dentry, ODF_RMV_ANY);
 
-       odf_lock(UNIONFS_D(old_dentry)->odf_info);
-       odf_lock(UNIONFS_D(new_dentry->d_parent)->odf_info);
-
        old_odfdentry = UNIONFS_D(old_dentry)->odf_info->dentry;
        old_dir = old_odfdentry->d_parent;
        new_dir = (UNIONFS_D(new_dentry->d_parent))->odf_info->dentry;
@@ -479,8 +471,6 @@ int odf_rename(struct dentry *old_dentry
        dput(new_odfdentry);
 
 out_unlock:
-       odf_unlock(UNIONFS_D(old_dentry)->odf_info);
-       odf_unlock(UNIONFS_D(new_dentry->d_parent)->odf_info);
        err = odf_lookup(old_dentry->d_parent, old_dentry, 0);
 out:
        return err;
@@ -507,8 +497,6 @@ int odf_link(struct dentry *old_dentry, 
        if (UNIONFS_D(new_dentry)->odf_info)
                err = odf_remove(new_dentry, ODF_RMV_ANY);
 
-       odf_lock(UNIONFS_D(old_dentry)->odf_info);
-       odf_lock(UNIONFS_D(new_dentry->d_parent)->odf_info);
        old_odfdentry = UNIONFS_D(old_dentry)->odf_info->dentry;
        old_dir = old_odfdentry->d_parent;
        new_dir = (UNIONFS_D(new_dentry->d_parent))->odf_info->dentry;
@@ -518,7 +506,7 @@ int odf_link(struct dentry *old_dentry, 
                                new_dentry->d_name.len);
        if (IS_ERR(new_odfdentry)) {
                err = PTR_ERR(new_odfdentry);
-               goto out_unlock;
+               goto out;
        }
 
        /* this should never happen */
@@ -531,9 +519,6 @@ int odf_link(struct dentry *old_dentry, 
        current->fsgid = oldgid;
 
        dput(new_odfdentry);
-out_unlock:
-       odf_unlock(UNIONFS_D(old_dentry)->odf_info);
-       odf_unlock(UNIONFS_D(new_dentry->d_parent)->odf_info);
 out:
        return err;
 }
@@ -665,8 +650,8 @@ int odf_copyup_link(struct super_block *
                        int old_branch, int new_branch)
 {
        char *name, *uuid;
-       struct odf_dentry_info *links = NULL;
-       struct odf_sb_info *osi = UNIONFS_SB(sb)->odf;
+       struct dentry *links = NULL;
+       struct odf_sb_info *osi = &UNIONFS_SB(sb)->odf;
        struct file *link_file = NULL;
        mm_segment_t oldfs;
        int err = 0;
@@ -698,13 +683,13 @@ int odf_copyup_link(struct super_block *
        }
 
        /* open the file */
-       dget(links->dentry);
+       dget(links);
        mntget(osi->mnt);
-       link_file = dentry_open(links->dentry, osi->mnt, O_RDWR);
+       link_file = dentry_open(links, osi->mnt, O_RDWR);
        if (IS_ERR(link_file)) {
                err = PTR_ERR(link_file);
                link_file = NULL;
-               dput(links->dentry);
+               dput(links);
                mntput(osi->mnt);
                goto out;
        }
@@ -737,7 +722,7 @@ int odf_copyup_link(struct super_block *
 
        set_fs(oldfs);
        err = 0;
-       odf_put_info(links);
+       dput(links);
        links = NULL;
        filp_close(link_file, NULL);
        link_file = NULL;
@@ -749,7 +734,7 @@ int odf_copyup_link(struct super_block *
 out:
        if (link_file)
                filp_close(link_file, NULL);
-       odf_put_info(links);
+       dput(links);
        kfree(name);
        return err;
 }
@@ -808,8 +793,6 @@ skip:
        if (branch_dst >= 0)
                dst_ro = is_robranch_super(dentry->d_sb, branch_dst);
 
-       odf_lock(UNIONFS_D(dentry->d_parent)->odf_info);
-
        /* case 0:
         * - dest branch id has changed because of remounts
         * - do not copyup, remove copyup info from link info file
@@ -825,7 +808,7 @@ skip:
                if (err != sizeof(__le32)){
                        set_fs(oldfs);
                        err = -EIO;
-                       goto out_unlock;
+                       goto out;
                }
 
                le64 = 0;
@@ -834,7 +817,7 @@ skip:
                if (err != sizeof(__le64)){
                        set_fs(oldfs);
                        err = -EIO;
-                       goto out_unlock;
+                       goto out;
                }
 
                set_fs(oldfs);
@@ -860,7 +843,7 @@ skip:
                if (!lower_dentry || IS_ERR(lower_dentry)) {
                        if (IS_ERR(lower_dentry))
                                err = PTR_ERR(lower_dentry);
-                       goto out_unlock;
+                       goto out;
                }
                /* now link */
        }
@@ -891,10 +874,6 @@ skip:
                ;
        }
 
-
-out_unlock:
-       odf_unlock(UNIONFS_D(dentry->d_parent)->odf_info);
-       goto out;
 out_fs:
        set_fs(oldfs);
 out:
@@ -919,8 +898,8 @@ out:
  */
 int odf_lookup(struct dentry *parent, struct dentry *dentry, int flags)
 {
-       struct odf_sb_info *osi = UNIONFS_SB(dentry->d_sb)->odf;
-       struct odf_dentry_info *links = NULL;
+       struct odf_sb_info *osi = &UNIONFS_SB(dentry->d_sb)->odf;
+       struct dentry *links = NULL;
        struct dentry *lower_dentry = NULL;
        struct file *link_file = NULL;
        char *name, *uuid;
@@ -961,13 +940,13 @@ int odf_lookup(struct dentry *parent, st
                }
 
                /* open the file */
-               dget(links->dentry);
+               dget(links);
                mntget(osi->mnt);
-               link_file = dentry_open(links->dentry, osi->mnt, O_RDWR);
+               link_file = dentry_open(links, osi->mnt, O_RDWR);
                if (IS_ERR(link_file)) {
                        err = PTR_ERR(link_file);
                        link_file = NULL;
-                       dput(links->dentry);
+                       dput(links);
                        mntput(osi->mnt);
                        goto out;
                }
@@ -982,7 +961,7 @@ int odf_lookup(struct dentry *parent, st
        }
 
        UNIONFS_D(dentry)->odf_info = __odf_lookup(
-                               UNIONFS_SB(dentry->d_sb)->odf,
+                               &UNIONFS_SB(dentry->d_sb)->odf,
                                UNIONFS_D(parent)->odf_info,
                                dentry->d_name.name,
                                dentry->d_name.len,
@@ -998,7 +977,7 @@ int odf_lookup(struct dentry *parent, st
                goto out;
 
 out:
-       odf_put_info(links);
+       dput(links);
        if (link_file)
                filp_close(link_file, NULL);
        return err;
@@ -1050,14 +1029,6 @@ struct odf_dentry_info *__odf_lookup(str
                        BUG_ON(len==1 || (name[1]=='.'&&len==2));
 retry:
                /* FIXME need to check hardlinks before create */
-               if (!(flags & ODF_LOOKUP_LOCKED)){
-                       if (osi->odi_ic != parent)
-                               odf_lock(osi->odi_ic);
-                       odf_lock(parent); /* lock parent */
-               }
-               else if (cleaned)
-                       odf_lock(osi->odi_ic);
-
                if (link && (flags & (ODF_LOOKUP_FILE | ODF_LOOKUP_LINK))) {
                        /* link to the given dentry */
                        vfs_link(link, odf_dentry->d_parent->d_inode, 
odf_dentry);
@@ -1079,22 +1050,10 @@ retry:
                }
                else {
                        dput(odf_dentry);
-                       if (!(flags & ODF_LOOKUP_LOCKED)){
-                               odf_unlock(parent);
-                               if (osi->odi_ic != parent)
-                                       odf_unlock(osi->odi_ic);
-                       }
                        odf_put_info(old_odi);
                        odi = NULL;
                        goto out;
                }
-               if (!(flags & ODF_LOOKUP_LOCKED)){
-                       odf_unlock(parent);
-                       if (osi->odi_ic != parent)
-                               odf_unlock(osi->odi_ic);
-               }
-               else if (cleaned)
-                       odf_unlock(osi->odi_ic);
 
                current->fsuid = olduid;
                current->fsgid = oldgid;
@@ -1102,8 +1061,6 @@ retry:
                if (err) {
                        if (err == -ENOSPC && !cleaned) {
                                /* let the cleanup thread do its work and retry 
once */
-                               if (flags & ODF_LOOKUP_LOCKED)
-                                       odf_unlock(osi->odi_ic);
                                cleaned = 1;
                                wake_up_and_wait_sioa(osi->cleanup);
                                goto retry;
@@ -1134,7 +1091,7 @@ out:
  * Returns odf_dentry_info pointing to the location in the odf
  * for the given directory's cached contents
  */
-struct odf_dentry_info *odf_ic_cache_dentry(struct dentry *dir)
+struct dentry *odf_ic_cache_dentry(struct dentry *dir)
 {
        struct odf_dentry_info *odi_dir;
 
@@ -1145,7 +1102,7 @@ struct odf_dentry_info *odf_ic_cache_den
        if (!S_ISDIR(dir->d_inode->i_mode))
                return ERR_PTR(-ENOTDIR);
 
-       return odf_ic_dentry(UNIONFS_SB(dir->d_sb)->odf,
+       return odf_ic_dentry(&UNIONFS_SB(dir->d_sb)->odf,
                dir->d_inode->i_ino, ODF_CONTENT, ODF_CONTENT_LEN);
 }
 
@@ -1153,54 +1110,79 @@ struct odf_dentry_info *odf_ic_cache_den
  * Returns odf_dentry_info pointing to the location in odf/ic
  * for the requested file name
  */
-struct odf_dentry_info *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char 
*name, int namelen)
+struct dentry *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char *name, int 
namelen)
 {
-       struct odf_dentry_info *odis[4], *odi_ic, *odi_ret = NULL;
+       struct dentry *dirs[4], *ic, *ret = NULL;
        int breakdown[4];
        char tmp_name[6];
        int i, err = 0;
+       uid_t olduid = current->fsuid;
+       gid_t oldgid = current->fsgid;
 
-       odi_ic = osi->odi_ic;
+       ic = osi->ic;
 
        for (i = 3; i >= 0; i--) {
                breakdown[i] = ino & 0xFFFF;
                ino >>= 16;
-               odis[i] = NULL;
+               dirs[i] = NULL;
        }
 
+       current->fsuid = olduid;
+       current->fsgid = oldgid;
+       
        memset(tmp_name,0,6);
        sprintf(tmp_name, "%x", breakdown[0]);
-       odis[0] = odf_lookup_name(osi, odi_ic, tmp_name, strlen(tmp_name), 
ODF_LOOKUP_DIR, NULL);
-       if (IS_ERR(odis[0])) {
-               err = PTR_ERR(odis[0]);
-               odis[0] = NULL;
+
+       /* look for/create the ##/##/##/## hiearachy */
+       dirs[0] = lookup_one_len(tmp_name, ic, strlen(tmp_name));
+       if (IS_ERR(dirs[0])) {
+               err = PTR_ERR(dirs[0]);
+               dirs[0] = NULL;
                goto out;
        }
+       if (!dirs[0]->d_inode) {
+               err = vfs_mkdir(ic->d_inode, dirs[0], S_IRWXUGO);
+               if (err)
+                       goto out;
+       }
        for (i = 1; i < 4; i++) {
                memset(tmp_name,0,6);
                sprintf(tmp_name, "%x", breakdown[i]);
-               odis[i] = odf_lookup_name(osi, odis[i-1], tmp_name, 
strlen(tmp_name), ODF_LOOKUP_DIR, NULL);
-               if (IS_ERR(odis[i])) {
-                       err = PTR_ERR(odis[i]);
-                       odis[i] = NULL;
+               dirs[i] = lookup_one_len(tmp_name, dirs[i-1], strlen(tmp_name));
+               if (IS_ERR(dirs[i])) {
+                       err = PTR_ERR(dirs[i]);
+                       dirs[i] = NULL;
                        goto out;
                }
+               if (!dirs[i]->d_inode) {
+                       err = vfs_mkdir(dirs[i-1]->d_inode, dirs[i], S_IRWXUGO);
+                       if (err)
+                               goto out;
+               }
        }
 
-       odi_ret = odf_lookup_name(osi, odis[3], name, namelen, ODF_LOOKUP_FILE, 
NULL);
-       if (IS_ERR(odi_ret)) {
-               err = PTR_ERR(odi_ret);
-               odi_ret = NULL;
+       /* now we can look for our target */
+       ret = lookup_one_len(name, dirs[3], namelen);
+       if (IS_ERR(ret)) {
+               err = PTR_ERR(ret);
                goto out;
        }
+       if (!ret->d_inode) {
+               err = vfs_create(dirs[3]->d_inode, ret, S_IRWXUGO, 0 );
+               if (err)
+                       dput(ret);
+       }
+
 out:
+       current->fsuid = olduid;
+       current->fsgid = oldgid;
+       
        for (i = 0; i < 4; i++)
-               odf_put_info(odis[i]);
+               dput(dirs[i]);
 
        if (err)
                return ERR_PTR(err);
-
-       return odi_ret;
+       return ret;
 }
 /*
  * Write a dirent to the given file
@@ -1344,24 +1326,24 @@ out:
 int odf_purge_dir_cache(struct dentry *dentry)
 {
        int err = 0;
-       struct odf_dentry_info *odi = NULL;
+       struct dentry *odf_cache = NULL;
        uid_t olduid = current->fsuid;
        gid_t oldgid = current->fsgid;
 
-       odi = odf_ic_cache_dentry(dentry);
-       if (IS_ERR(odi)){
-               err = PTR_ERR(odi);
-               odi = NULL;
+       odf_cache = odf_ic_cache_dentry(dentry);
+       if (IS_ERR(odf_cache)){
+               err = PTR_ERR(odf_cache);
+               odf_cache = NULL;
                goto out;
        }
 
        current->fsuid = 0;
        current->fsgid = 0;
-       err = vfs_unlink(odi->dentry->d_parent->d_inode, odi->dentry);
+       err = vfs_unlink(odf_cache->d_parent->d_inode, odf_cache);
        current->fsuid = olduid;
        current->fsgid = oldgid;
 out:
-       odf_put_info(odi);
+       dput(odf_cache);
        return err;
 }
 
@@ -1375,7 +1357,7 @@ int odf_create_wh(struct dentry *dentry)
        struct dentry *odf_dentry;
        if (UNIONFS_D(dentry)->odf_info) {
                odf_dentry = UNIONFS_D(dentry)->odf_info->dentry;
-               if (__odf_is_wh(UNIONFS_D(dentry)->odf_info->osi, odf_dentry))
+               if (__odf_is_wh(&UNIONFS_SB(dentry->d_sb)->odf, odf_dentry))
                        goto out;       /* nothing to be done */
                /* remove entry if existed */
                err = odf_remove(dentry, ODF_RMV_ANY);
@@ -1417,8 +1399,7 @@ int odf_remove(struct dentry *dentry, in
 
        /* refresh odi */
        err = odf_lookup(dentry->d_parent, dentry, 0);
-       if (IS_ERR(odi)) {
-               err = PTR_ERR(odi);
+       if (err) {
                odi = NULL;
                goto out;
        }
@@ -1427,7 +1408,7 @@ int odf_remove(struct dentry *dentry, in
        if (!odi)
                goto out;
        /* should we remove? */
-       if (__odf_is_wh(odi->osi, odi->dentry)) {
+       if (__odf_is_wh(&UNIONFS_SB(dentry->d_sb)->odf, odi->dentry)) {
                if (flags & ODF_RMV_WH)
                        rmv = 1;
        }
@@ -1439,13 +1420,13 @@ int odf_remove(struct dentry *dentry, in
                goto out;
 
        odf_dir = UNIONFS_D(dentry->d_parent)->odf_info;
-       odf_lock(odf_dir);
 
        /* remove */
        current->fsuid = 0;
        current->fsgid = 0;
-       if (S_ISDIR(odi->dentry->d_inode->i_mode))
+       if (S_ISDIR(odi->dentry->d_inode->i_mode)) {
                err = odf_reclaim(dentry, 0);
+       }
        else {
                if (atomic_read(&dentry->d_inode->i_count) <= 1)
                        err = vfs_unlink(odi->dentry->d_parent->d_inode, 
odi->dentry);
@@ -1458,13 +1439,11 @@ int odf_remove(struct dentry *dentry, in
        current->fsuid = olduid;
        current->fsgid = oldgid;
        if (err)
-               goto out_unlock;
+               goto out;
 
        /* clean up */
        odf_put_info(odi);
        UNIONFS_D(dentry)->odf_info = NULL;
-out_unlock:
-       odf_unlock(odf_dir);
 out:
        return err;
 }
@@ -1899,10 +1878,7 @@ struct odf_dentry_info *odf_alloc_info(s
        odi->whiteout = __odf_is_wh(osi, odf_dentry);
        odi->opaque = __odf_get_opaque(odf_dentry->d_inode);
        odi->dentry = odf_dentry;
-       odi->inum = odf_dentry->d_inode->i_ino;
-       odi->osi = osi;
        dget(odf_dentry);
-       mutex_init(&odi->lock);
        return odi;
 }
 struct odf_dentry_info *odf_fill_info(struct odf_dentry_info *odi, struct 
odf_sb_info *osi, struct dentry *odf_dentry)
@@ -1914,8 +1890,6 @@ struct odf_dentry_info *odf_fill_info(st
        dget(odf_dentry);
        dput(odi->dentry);
        odi->dentry = odf_dentry;
-       odi->inum = odf_dentry->d_inode->i_ino;
-       odi->osi = osi;
        return odi;
 }
 
@@ -1946,8 +1920,7 @@ void __odf_cleanup(void *args)
        /* update timeout */
        sioa_args->timeout = msecs_to_jiffies(cl->attr->timeout->val * 1000);
 
-       odf_lock(cl->odf->odi_ic);
-       odf_lock(cl->odf->odi_rc);
+       /* LOCK: need to lock ic/reclaim/sr? */
 
        vfs_statfs(cl->odf->sb, &stat);
        if (cl->force) {
@@ -1977,6 +1950,4 @@ void __odf_cleanup(void *args)
                }
                cl->success = err;
        }
-       odf_unlock(cl->odf->odi_ic);
-       odf_unlock(cl->odf->odi_rc);
 }
diff --git a/fs/unionfs/odf.h b/fs/unionfs/odf.h
index 
0301ba4700b6f68beb52e07449b31a75b6ba474e..02bd94233b29222c07210a06fbfab059a3a19c69
 100644
--- a/fs/unionfs/odf.h
+++ b/fs/unionfs/odf.h
@@ -41,7 +41,7 @@ #define ODF_CLEAN_INODES 3
 #define ODF_CLEAN_BLOCKS 4
 
 /* super */
-struct odf_sb_info* odf_read_super(char *options);
+int odf_read_super(struct super_block *sb, char *options);
 void odf_put_super(struct odf_sb_info *osi);
 int odf_is_new(struct odf_sb_info *osi);
 char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid);
@@ -66,15 +66,15 @@ static inline struct odf_dentry_info *od
 {
        return __odf_lookup(osi, parent, name, len, flags, old_odi, NULL);
 }
-struct odf_dentry_info *odf_getpath(struct dentry *d_odf, struct odf_sb_info 
*osi, const char *name);
+struct dentry* odf_getdir(struct dentry *d_odf, const char *name, int len);
 struct odf_dentry_info *odf_fill_info(struct odf_dentry_info *odi,
                struct odf_sb_info *osi, struct dentry *odf_dentry);
 struct odf_dentry_info *odf_alloc_info(struct odf_sb_info *osi, struct dentry 
*odf_dentry);
 void odf_put_info(struct odf_dentry_info *odi);
 
 /* dirents & dir cache */
-struct odf_dentry_info *odf_ic_cache_dentry(struct dentry *dir);
-struct odf_dentry_info *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char 
*name, int namelen);
+struct dentry *odf_ic_cache_dentry(struct dentry *dir);
+struct dentry *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char *name, int 
namelen);
 int odf_write_dirent(struct file *filp, const char *name, int namelen, u64 
ino, unsigned int d_type);
 int odf_read_dirent(struct file *filp, char **name, int *namelen, u64 *ino, 
unsigned int *d_type);
 int odf_purge_dir_cache(struct dentry *dentry);
@@ -108,17 +108,6 @@ #define __odf_get_opaque(i) (i->i_gid -1
 extern void __odf_cleanup(void *args);
 int odf_cleanup(struct odf_sb_info *odf, int mode, u64 size);
 
-/* Macros for locking an odf dentry info. */
-static inline void odf_lock(struct odf_dentry_info *odi)
-{
-       mutex_lock(&odi->lock);
-}
-
-static inline void odf_unlock(struct odf_dentry_info *odi)
-{
-       mutex_unlock(&odi->lock);
-}
-
 extern void generate_random_uuid(unsigned char uuid_out[16]);
 
 #endif /* _ODF_H_ */
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 
c70af703d4408433d1e131556f7d293b60842d92..38fbb7b9b133d339649ba67f7d5374d96c601d5d
 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -87,7 +87,7 @@ static void unionfs_put_super(struct sup
        if (!spd)
                return;
 
-       odf_put_super(UNIONFS_SB(sb)->odf);
+       odf_put_super(&UNIONFS_SB(sb)->odf);
 
        bstart = sbstart(sb);
        bend = sbend(sb);
@@ -424,7 +424,7 @@ static int unionfs_remount_fs(struct sup
        struct path *new_lower_paths = NULL, *tmp_lower_paths = NULL;
        struct inode **new_lower_inodes = NULL;
        int new_high_branch_id; /* new high branch ID */
-       struct odf_sb_info *odf = UNIONFS_SB(sb)->odf;
+       struct odf_sb_info *odf = &UNIONFS_SB(sb)->odf;
        int odfforce = 0 ;      /* whether the odfforce option was provided */
        int old_ibstart, old_ibend;
        int size;               /* memory allocation size, temp var */
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 
0c7ebc7bb2909ca699bdcacb25bd4ba6c313bc77..2822fed78004c0028c45ed832be635d9d4091466
 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -95,26 +95,23 @@ struct odf_dentry_info {
         * the data in the odf file. Right now i keep a dentry for easy
         * lookup in the underlying ext2
         */
-       struct mutex lock;
-       u64 inum;
        int whiteout;
        int opaque;
        struct dentry *dentry;
-       struct odf_sb_info *osi;
 };
 
 /* odf sb data */
 struct odf_sb_info {
        struct vfsmount *mnt;           /* odf vmsmount */
-       struct odf_dentry_info *odi_ns; /* namespace (/ns) */
-       struct odf_dentry_info *odi_rc; /* reclaim (/reclaim) */
-       struct odf_dentry_info *odi_ic; /* inode cache (/ic) */
-       struct odf_dentry_info *odi_sr; /* silly renamed files (/sr) */
+       struct dentry *ns;              /* namespace (/odf/ns) */
+       struct dentry *rc;              /* reclaim (/odf/reclaim) */
+       struct dentry *ic;              /* inode cache (/odf/ic) */
+       struct dentry *sr;              /* silly renamed files (/odf/sr) */
+       struct dentry *sb;              /* superblock file (/odf/sb) */
+       struct dentry *whiteout;        /* file whiteouts are linked to */
        struct sioa_args *cleanup;      /* our cleanup thread */
-       char *branch_uuids;   /* not null terminated string of all branch 
uuids*/
+       char *branch_uuids;   /* not null terminated string of all branch uuids 
*/
        int opaque_branch_id; /* should always be the branch id of branch 0*/
-       struct dentry *sb;              /* superblock (/sb) */
-       struct dentry *whiteout;
 };
 
 /* unionfs inode data in memory */
@@ -168,7 +165,7 @@ struct unionfs_sb_info {
        atomic_t generation;
        struct rw_semaphore rwsem; /* protects access to data+id fields */
        int high_branch_id;     /* last unique branch ID given */
-       struct odf_sb_info *odf;
+       struct odf_sb_info odf;
        struct unionfs_data *data;
 };
 
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to