commit 4e9a70a97329fc8dcc3649176c187cd264d77804
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
0b727eba343cfad4bde37432bc230b7643f6f7be..b46052571e2edc2704a87afcb1767ef9d4ed9727
100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -179,7 +179,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);
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index
21f8f3cb783e52ede5429ec1043a37154affd86a..ba6c619a8953805791817b277304297e1796e2bd
100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -66,13 +66,13 @@ static int unionfs_readdir(struct file *
}
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
020ebccbb1865d3a2eb6d76713c05c172f4be12f..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)){
@@ -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
84ec97aa02a726109c896831f1ca3215f6033dec..9846c6bc59ce86dc2de2656f0188fdbbb662122b
100644
--- a/fs/unionfs/export.c
+++ b/fs/unionfs/export.c
@@ -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)
@@ -201,11 +201,11 @@ static int unionfs_get_name(struct dentr
}
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
5a36cefef92f9cc02451d54095c8336074e6875e..0b9cad508b1f8a746c23a818fa394eb57dc25a75
100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -615,14 +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;
+ 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 sup
/* 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
78af658470fd48a0de140d99a988754fb0cb9b3c..69571732f613da2486f8e4d352611abbecdd3804
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
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
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, i
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 *
{
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, 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,
@@ -1095,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);
}
@@ -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, in
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
4e524701453075e740c555eb66da3dff3373af24..934094e8538116079a0b83cf689588a620c15594
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);
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
824dd643abcade8cee31e190bd8e880b13d07c01..2822fed78004c0028c45ed832be635d9d4091466
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