commit 62f8e376458effc97eae02b3762583dcb936db1e
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Fri May 25 14:55:35 2007 -0400

    changed unionfs_sb_info to contain a unionfs_sb_info instead of a pointer 
to one

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 0b727eb..b460525 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -179,7 +179,7 @@ int unionfs_silly_rename(struct dentry *dentry, struct 
dentry *hidden_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);
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index 21f8f3c..ba6c619 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -66,13 +66,13 @@ static int unionfs_readdir(struct file *file, void *dirent, 
filldir_t filldir)
        }
 
        dget(odi->dentry);
-       mntget(UNIONFS_SB(file->f_dentry->d_sb)->odf->mnt);
+       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,
+                       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);
+               mntput(UNIONFS_SB(file->f_dentry->d_sb)->odf.mnt);
                dput(odi->dentry);
                odf_file = NULL;
                goto out;
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index 020ebcc..62f71ba 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -153,7 +153,7 @@ static int readdir_util_callback(void *dirent, const char 
*name, int namelen,
        }
 
        /* 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)){
@@ -318,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) {
@@ -329,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;
        }
@@ -419,7 +419,7 @@ out:
 
        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;
        }
 
diff --git a/fs/unionfs/export.c b/fs/unionfs/export.c
index 84ec97a..9846c6b 100644
--- a/fs/unionfs/export.c
+++ b/fs/unionfs/export.c
@@ -120,7 +120,7 @@ static struct dentry *unionfs_get_parent(struct dentry 
*child)
        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)
@@ -201,11 +201,11 @@ static int unionfs_get_name(struct dentry *dentry, char 
*name, struct dentry *ch
        }
 
        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);
+       mntget(UNIONFS_SB(dentry->d_sb)->odf.mnt);
+       file = dentry_open(odi->dentry, 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);
+               mntput(UNIONFS_SB(dentry->d_sb)->odf.mnt);
                dput(odi->dentry);
                file = NULL;
                goto out;
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 5a36cef..0b9cad5 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -615,14 +615,12 @@ static int unionfs_read_super(struct super_block *sb, 
void *raw_data,
         * 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;
+       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
@@ -734,7 +732,7 @@ static int unionfs_read_super(struct super_block *sb, void 
*raw_data,
 
        /* save odf root dentry */
        UNIONFS_D(sb->s_root)->odf_info =
-               odf_fill_info(NULL, UNIONFS_SB(sb)->odf, 
UNIONFS_SB(sb)->odf->ns);
+               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);
@@ -778,13 +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;
-               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 78af658..6957173 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -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 *options)
        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);
@@ -193,20 +187,24 @@ struct odf_sb_info* odf_read_super(char *options)
 
 out_free:
        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)
 {
+       dput(osi->ns);
+       osi->ns = NULL;
        dput(osi->rc);
+       osi->rc = NULL;
        dput(osi->ic);
+       osi->ic = NULL;
        dput(osi->sr);
-       dput(osi->ns);
-       dput(osi->mnt->mnt_sb->s_root);
+       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);
@@ -320,9 +327,9 @@ int odf_reclaim(struct dentry *dentry, int sr)
        odf_dentry = UNIONFS_D(dentry)->odf_info->dentry;
 
        if (sr)
-               new_dir = UNIONFS_SB(dentry->d_sb)->odf->sr;
+               new_dir = UNIONFS_SB(dentry->d_sb)->odf.sr;
        else
-               new_dir = UNIONFS_SB(dentry->d_sb)->odf->rc;
+               new_dir = UNIONFS_SB(dentry->d_sb)->odf.rc;
        new_name = kzalloc(ODF_INAME_LEN, GFP_KERNEL);
        if (!new_name){
                err = -ENOMEM;
@@ -361,8 +368,8 @@ int odf_release_sr(struct inode *inode)
        uid_t olduid = current->fsuid;
        gid_t oldgid = current->fsgid;
 
-       sr = UNIONFS_SB(inode->i_sb)->odf->sr;
-       rc = UNIONFS_SB(inode->i_sb)->odf->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;
@@ -644,7 +651,7 @@ int odf_copyup_link(struct super_block *sb, struct dentry 
*old_dentry, struct de
 {
        char *name, *uuid;
        struct odf_dentry_info *links = NULL;
-       struct odf_sb_info *osi = UNIONFS_SB(sb)->odf;
+       struct odf_sb_info *osi = &UNIONFS_SB(sb)->odf;
        struct file *link_file = NULL;
        mm_segment_t oldfs;
        int err = 0;
@@ -891,7 +898,7 @@ 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_sb_info *osi = &UNIONFS_SB(dentry->d_sb)->odf;
        struct odf_dentry_info *links = NULL;
        struct dentry *lower_dentry = NULL;
        struct file *link_file = NULL;
@@ -954,7 +961,7 @@ int odf_lookup(struct dentry *parent, struct dentry 
*dentry, int flags)
        }
 
        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,
@@ -1095,7 +1102,7 @@ struct odf_dentry_info *odf_ic_cache_dentry(struct dentry 
*dir)
        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);
 }
 
@@ -1326,7 +1333,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_SB(dentry->d_sb)->odf, 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);
@@ -1377,7 +1384,7 @@ int odf_remove(struct dentry *dentry, int flags)
        if (!odi)
                goto out;
        /* should we remove? */
-       if (__odf_is_wh(UNIONFS_SB(dentry->d_sb)->odf, odi->dentry)) {
+       if (__odf_is_wh(&UNIONFS_SB(dentry->d_sb)->odf, odi->dentry)) {
                if (flags & ODF_RMV_WH)
                        rmv = 1;
        }
diff --git a/fs/unionfs/odf.h b/fs/unionfs/odf.h
index 4e52470..934094e 100644
--- a/fs/unionfs/odf.h
+++ b/fs/unionfs/odf.h
@@ -41,7 +41,7 @@
 #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);
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index c70af70..38fbb7b 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -87,7 +87,7 @@ static void unionfs_put_super(struct super_block *sb)
        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 super_block *sb, int 
*flags,
        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 824dd64..2822fed 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -165,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