commit 069fb558122622dcfc5dbe1f388dec9c580e5542
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date: Fri May 25 23:50:10 2007 -0400
changed unionfs_dentry_info to contain an odf_dentry_info instead of a
pointer to one
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index
a8119455a553a39b56b5eadff50c1577ec8d00d7..d4a89fac89b1f4627455979038b22750d18de7c3
100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -187,7 +187,7 @@ find:
ino = odf_dentry->d_inode->i_ino;
err = odf_write_dirent(buf->filp, name, namelen, ino, d_type);
out:
- odf_put_info(odi);
+ dput(odf_dentry);
buf->err = err;
return err;
}
diff --git a/fs/unionfs/export.c b/fs/unionfs/export.c
index
828622ec514dddfe12afb0abcc9ae3ceb1a64eb6..1c27ba6e070d081571d34bd760fe2a1b192274c4
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_D(sb->s_root)->odf_info->dentry;
+ struct dentry *odf_root = UNIONFS_D(sb->s_root)->odf.dentry;
struct dentry *d, *d_parent, *parent, *child = NULL;
struct dentry_stack stack;
char *name = NULL;
@@ -77,11 +77,11 @@ static struct dentry *__get_parent(struc
BUG_ON(d == odf_root);
if (odf_root->d_sb->s_export_op->get_name)
res = odf_root->d_sb->s_export_op->get_name(
- UNIONFS_D(parent)->odf_info->dentry,
+ UNIONFS_D(parent)->odf.dentry,
name, d);
else
res = export_op_default.get_name(
- UNIONFS_D(parent)->odf_info->dentry,
+ UNIONFS_D(parent)->odf.dentry,
name, d);
}
else
@@ -181,7 +181,7 @@ static int unionfs_get_name(struct dentr
if (!dir->i_fop)
goto out;
- if (!UNIONFS_D(dentry) || !UNIONFS_D(dentry)->odf_info)
+ if (!UNIONFS_D(dentry) || !UNIONFS_D(dentry)->odf.dentry)
goto out;
odf_cache = odf_ic_cache_dentry(dentry);
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index
b279cc0174ba3fc45de218874b02fccbfdf30cc0..4ddf9b862dc521f8b9fcfae93423b423483dfd4c
100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -74,7 +74,7 @@ static int unionfs_create(struct inode *
}
}
- if (hidden_dentry->d_inode && UNIONFS_D(dentry)->odf_info->whiteout) {
+ if (hidden_dentry->d_inode && UNIONFS_D(dentry)->odf.whiteout) {
err = unionfs_force_rm(dentry, &hidden_dentry, bstart);
if (err)
goto out;
@@ -207,7 +207,7 @@ static int unionfs_link(struct dentry *o
hidden_new_dentry = unionfs_lower_dentry(new_dentry);
hidden_old_dentry = unionfs_lower_dentry(old_dentry);
- if (hidden_new_dentry->d_inode &&
UNIONFS_D(new_dentry)->odf_info->whiteout) {
+ if (hidden_new_dentry->d_inode && UNIONFS_D(new_dentry)->odf.whiteout) {
err = unionfs_force_rm(new_dentry, &hidden_new_dentry,
dbstart(old_dentry));
if (err)
goto out;
@@ -236,7 +236,7 @@ docopyup:
new_dentry->d_name.name, bindex);
hidden_old_dentry = unionfs_lower_dentry(old_dentry);
if (hidden_new_dentry->d_inode &&
-
UNIONFS_D(new_dentry)->odf_info->whiteout) {
+ UNIONFS_D(new_dentry)->odf.whiteout) {
err = unionfs_force_rm(new_dentry,
&hidden_new_dentry,
dbstart(old_dentry));
@@ -327,7 +327,7 @@ static int unionfs_symlink(struct inode
}
}
- if (hidden_dentry->d_inode && UNIONFS_D(dentry)->odf_info->whiteout) {
+ if (hidden_dentry->d_inode && UNIONFS_D(dentry)->odf.whiteout) {
err = unionfs_force_rm(dentry, &hidden_dentry, bstart);
if (err)
goto out;
@@ -406,7 +406,7 @@ static int unionfs_mkdir(struct inode *p
}
}
- if (hidden_dentry->d_inode && UNIONFS_D(dentry)->odf_info->whiteout) {
+ if (hidden_dentry->d_inode && UNIONFS_D(dentry)->odf.whiteout) {
err = unionfs_force_rm(dentry, &hidden_dentry, bindex);
if (err)
goto out;
@@ -501,7 +501,7 @@ static int unionfs_mknod(struct inode *d
}
}
- if (hidden_dentry->d_inode && UNIONFS_D(dentry)->odf_info->whiteout) {
+ if (hidden_dentry->d_inode && UNIONFS_D(dentry)->odf.whiteout) {
err = unionfs_force_rm(dentry, &hidden_dentry, bstart);
if (err)
goto out;
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index
cf92d6450da3eab1e1aa3125789953e62968884d..f8e4eb09f1b94b26aeb0ffdf80c2d5e47f64ae41
100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -85,8 +85,8 @@ struct dentry *unionfs_lookup_backend(st
goto out;
/* return negative dentry if a whiteout */
- if (UNIONFS_D(dentry)->odf_info &&
- UNIONFS_D(dentry)->odf_info->whiteout){
+ if (UNIONFS_D(dentry)->odf.dentry &&
+ UNIONFS_D(dentry)->odf.whiteout){
bindex = 0;
goto out_negative;
}
@@ -248,7 +248,7 @@ out_negative:
/* This part of the code is for positive dentries. */
out_positive:
BUG_ON(dentry_count <= 0);
- BUG_ON(UNIONFS_D(dentry)->odf_info &&
UNIONFS_D(dentry)->odf_info->whiteout);
+ BUG_ON(UNIONFS_D(dentry)->odf.dentry &&
UNIONFS_D(dentry)->odf.whiteout);
/*
* If we're holding onto the first negative dentry & corresponding
@@ -260,8 +260,8 @@ out_positive:
/* Partial lookups need to re-interpose, or throw away older negs. */
if (lookupmode == INTERPOSE_PARTIAL) {
err = odf_lookup(parent_dentry, dentry, 0);
- if (UNIONFS_D(dentry)->odf_info &&
- UNIONFS_D(dentry)->odf_info->whiteout){
+ if (UNIONFS_D(dentry)->odf.dentry &&
+ UNIONFS_D(dentry)->odf.whiteout){
err = -ENOENT;
goto out_drop;
}
@@ -292,8 +292,8 @@ out_positive:
goto out_drop;
/* check for whiteout && opaqueness */
- if (UNIONFS_D(dentry)->odf_info) {
- if (UNIONFS_D(dentry)->odf_info->whiteout){
+ if (UNIONFS_D(dentry)->odf.dentry) {
+ if (UNIONFS_D(dentry)->odf.whiteout){
err = -ENOENT;
goto out_drop;
}
@@ -361,13 +361,13 @@ int unionfs_partial_lookup(struct dentry
tmp = unionfs_lookup_backend(dentry, &nd, INTERPOSE_PARTIAL);
if (!tmp) {
int err = 0;
- if (UNIONFS_D(dentry) && !UNIONFS_D(dentry)->odf_info) {
+ if (UNIONFS_D(dentry) && !UNIONFS_D(dentry)->odf.dentry) {
tmp = unionfs_lower_dentry_idx(dentry, 0);
if (dentry->d_inode || (tmp && tmp->d_inode)) {
err = odf_lookup(dentry->d_parent, dentry, 0);
if (err)
return err;
- BUG_ON(!UNIONFS_D(dentry)->odf_info);
+ BUG_ON(!UNIONFS_D(dentry)->odf.dentry);
}
}
@@ -402,7 +402,8 @@ void free_dentry_private_data(struct uni
{
if (!udi)
return;
- odf_put_info(udi->odf_info);
+ dput(udi->odf.dentry);
+ udi->odf.dentry = NULL;
kmem_cache_free(unionfs_dentry_cachep, udi);
}
@@ -429,7 +430,7 @@ int new_dentry_private_data(struct dentr
info->bstart = info->bend = -1;
info->bcount = sbmax(dentry->d_sb);
- info->odf_info = NULL;
+ info->odf.dentry = NULL;
atomic_set(&info->generation,
atomic_read(&UNIONFS_SB(dentry->d_sb)->generation));
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index
fbb5ab59c3498fdad1254e2cc071f880b3eaf35f..9741e9445422ae66e07b6b18ecab1ba0fce6877d
100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -80,7 +80,7 @@ struct dentry *unionfs_interpose(struct
} else {
ino_t ino;
/* get unique inode number for unionfs */
- if (!UNIONFS_D(dentry)->odf_info)
+ if (!UNIONFS_D(dentry)->odf.dentry)
err = odf_lookup(dentry->d_parent, dentry, odf_flag);
if (err){
printk("unionfs_interpose: odf failed to create dentry:
%s, %d\n",
@@ -88,7 +88,7 @@ struct dentry *unionfs_interpose(struct
goto out;
}
/* check whiteouts and opaqueness */
- if (UNIONFS_D(dentry)->odf_info->whiteout){
+ if (UNIONFS_D(dentry)->odf.whiteout){
err = -ENOENT;
goto out;
}
@@ -96,7 +96,7 @@ struct dentry *unionfs_interpose(struct
if (opaque >= 0)
set_dbend(dentry, opaque);
- ino = UNIONFS_D(dentry)->odf_info->dentry->d_inode->i_ino;
+ ino = UNIONFS_D(dentry)->odf.dentry->d_inode->i_ino;
inode = iget(sb, ino);
if (!inode) {
@@ -734,9 +734,11 @@ static int unionfs_read_super(struct sup
set_dbstart(sb->s_root, bstart);
set_dbend(sb->s_root, bend);
- /* save odf root dentry */
- UNIONFS_D(sb->s_root)->odf_info =
- odf_fill_info(NULL, &UNIONFS_SB(sb)->odf,
UNIONFS_SB(sb)->odf.ns);
+ /* save /odf/ns as odf dentry for root */
+ dget(UNIONFS_SB(sb)->odf.ns);
+ UNIONFS_D(sb->s_root)->odf.dentry = UNIONFS_SB(sb)->odf.ns;
+ UNIONFS_D(sb->s_root)->odf.opaque = -1; /* root can never be opq */
+ UNIONFS_D(sb->s_root)->odf.whiteout = 0; /* nor a whiteout */
/* Set the generation number to one, since this is for the mount. */
atomic_set(&UNIONFS_D(sb->s_root)->generation, 1);
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index
fdbf681de6c14df3e1a9575038bd768bc118b05f..9bbd9cfc47f1ee112b26bd1e695919d16193a0cc
100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -324,7 +324,7 @@ int odf_reclaim(struct dentry *dentry, i
char *new_name = NULL;
int err = 0;
- odf_dentry = UNIONFS_D(dentry)->odf_info->dentry;
+ odf_dentry = UNIONFS_D(dentry)->odf.dentry;
if (sr)
new_dir = UNIONFS_SB(dentry->d_sb)->odf.sr;
@@ -430,7 +430,7 @@ int odf_rename(struct dentry *old_dentry
if (err)
goto out;
- if (UNIONFS_D(old_dentry)->odf_info == NULL) {
+ if (UNIONFS_D(old_dentry)->odf.dentry == NULL) {
printk("rename attempt %s to %s not in odf\n",
old_dentry->d_name.name,
new_dentry->d_name.name);
@@ -441,12 +441,12 @@ int odf_rename(struct dentry *old_dentry
goto out;
/* if new exists, remove it */
- if (UNIONFS_D(new_dentry)->odf_info)
+ if (UNIONFS_D(new_dentry)->odf.dentry)
err = odf_remove(new_dentry, ODF_RMV_ANY);
- old_odfdentry = UNIONFS_D(old_dentry)->odf_info->dentry;
+ old_odfdentry = UNIONFS_D(old_dentry)->odf.dentry;
old_dir = old_odfdentry->d_parent;
- new_dir = (UNIONFS_D(new_dentry->d_parent))->odf_info->dentry;
+ new_dir = (UNIONFS_D(new_dentry->d_parent))->odf.dentry;
new_odfdentry = lookup_one_len(
new_dentry->d_name.name,
new_dir,
@@ -494,12 +494,12 @@ int odf_link(struct dentry *old_dentry,
goto out;
/* if new exists, remove it */
- if (UNIONFS_D(new_dentry)->odf_info)
+ if (UNIONFS_D(new_dentry)->odf.dentry)
err = odf_remove(new_dentry, ODF_RMV_ANY);
- old_odfdentry = UNIONFS_D(old_dentry)->odf_info->dentry;
+ old_odfdentry = UNIONFS_D(old_dentry)->odf.dentry;
old_dir = old_odfdentry->d_parent;
- new_dir = (UNIONFS_D(new_dentry->d_parent))->odf_info->dentry;
+ new_dir = (UNIONFS_D(new_dentry->d_parent))->odf.dentry;
new_odfdentry = lookup_one_len(
new_dentry->d_name.name,
new_dir,
@@ -962,9 +962,13 @@ int odf_lookup(struct dentry *parent, st
ret = __odf_lookup(parent, dentry, dentry->d_name.name,
dentry->d_name.len, flags, NULL);
- if (IS_ERR(ret))
+ if (IS_ERR(ret)) {
+ BUG_ON(UNIONFS_D(dentry)->odf.dentry);
err = PTR_ERR(ret);
+ }
+ if (err == -ENOENT)
+ err = 0;
out:
dput(links);
if (link_file)
@@ -1109,17 +1113,15 @@ out:
*/
struct dentry *odf_ic_cache_dentry(struct dentry *dir)
{
- struct odf_dentry_info *odi_dir;
-
- odi_dir = UNIONFS_D(dir)->odf_info;
- if (!odi_dir)
+ if (!UNIONFS_D(dir)->odf.dentry)
return ERR_PTR(-ENOENT);
if (!S_ISDIR(dir->d_inode->i_mode))
return ERR_PTR(-ENOTDIR);
return odf_ic_dentry(&UNIONFS_SB(dir->d_sb)->odf,
- dir->d_inode->i_ino, ODF_CONTENT, ODF_CONTENT_LEN);
+ dir->d_inode->i_ino,
+ ODF_CONTENT, ODF_CONTENT_LEN);
}
/*
@@ -1371,8 +1373,8 @@ int odf_create_wh(struct dentry *dentry)
{
int err = 0;
struct dentry *odf_dentry;
- if (UNIONFS_D(dentry)->odf_info) {
- odf_dentry = UNIONFS_D(dentry)->odf_info->dentry;
+ if (UNIONFS_D(dentry)->odf.dentry) {
+ odf_dentry = UNIONFS_D(dentry)->odf.dentry;
if (__odf_is_wh(&UNIONFS_SB(dentry->d_sb)->odf, odf_dentry))
goto out; /* nothing to be done */
/* remove entry if existed */
@@ -1385,8 +1387,8 @@ int odf_create_wh(struct dentry *dentry)
if (err)
goto out;
- odf_put_info(UNIONFS_D(dentry)->odf_info);
- UNIONFS_D(dentry)->odf_info = NULL;
+ dput(UNIONFS_D(dentry)->odf.dentry);
+ UNIONFS_D(dentry)->odf.dentry = NULL;
out:
return err;
}
@@ -1404,8 +1406,7 @@ out:
*/
int odf_remove(struct dentry *dentry, int flags)
{
- struct odf_dentry_info *odf_dir;
- struct odf_dentry_info *odi = NULL;
+ struct dentry *odf_dentry = NULL;
int err = 0, rmv = 0;
uid_t olduid = current->fsuid;
gid_t oldgid = current->fsgid;
@@ -1415,37 +1416,32 @@ int odf_remove(struct dentry *dentry, in
/* refresh odi */
err = odf_lookup(dentry->d_parent, dentry, 0);
- if (err) {
- odi = NULL;
- goto out;
- }
- BUG_ON(!UNIONFS_D(dentry)->odf_info);
- odi = UNIONFS_D(dentry)->odf_info;
- if (!odi)
+ if (err)
goto out;
+
+ BUG_ON(!UNIONFS_D(dentry)->odf.dentry);
+ odf_dentry = UNIONFS_D(dentry)->odf.dentry;
+
/* 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, odf_dentry)) {
if (flags & ODF_RMV_WH)
rmv = 1;
}
- else {
- if (flags & ODF_RMV_NOTWH)
+ else if (flags & ODF_RMV_NOTWH)
rmv = 1;
- }
+
if (!rmv)
goto out;
- odf_dir = UNIONFS_D(dentry->d_parent)->odf_info;
-
/* remove */
current->fsuid = 0;
current->fsgid = 0;
- if (S_ISDIR(odi->dentry->d_inode->i_mode)) {
+ if (S_ISDIR(odf_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);
+ err = vfs_unlink(odf_dentry->d_parent->d_inode,
odf_dentry);
else
/* silly rename open files, so their ino does
* not get recycled while still open
@@ -1458,8 +1454,8 @@ int odf_remove(struct dentry *dentry, in
goto out;
/* clean up */
- odf_put_info(odi);
- UNIONFS_D(dentry)->odf_info = NULL;
+ dput(odf_dentry);
+ UNIONFS_D(dentry)->odf.dentry = NULL;
out:
return err;
}
@@ -1472,9 +1468,9 @@ int odf_get_opaque(struct super_block *s
{
int i, opaque;
- BUG_ON(!UNIONFS_D(dentry)->odf_info);
+ BUG_ON(!UNIONFS_D(dentry)->odf.dentry);
- opaque = UNIONFS_D(dentry)->odf_info->opaque;
+ opaque = UNIONFS_D(dentry)->odf.opaque;
if (opaque == -1)
return -1;
@@ -1496,10 +1492,10 @@ int odf_get_opaque(struct super_block *s
*/
int odf_set_opaque(struct dentry *dentry, int branch)
{
- struct odf_dentry_info *odi = UNIONFS_D(dentry)->odf_info;
- int err = __odf_set_opaque(odi->dentry, branch);
+ struct dentry *odf_dentry = UNIONFS_D(dentry)->odf.dentry;
+ int err = __odf_set_opaque(odf_dentry, branch);
if (!err)
- odi->opaque = branch;
+ UNIONFS_D(dentry)->odf.opaque = branch;
return err;
}
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index
f0896bc3a5ffbe3b8e04cf0ec1da6abd668b8dbe..cce4d51fc3f0400cad1d3dd833d24772cf6f68fd
100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -365,7 +365,7 @@ int unionfs_rename(struct inode *old_dir
* since it will cause us problems when we copyup */
hidden = unionfs_lower_dentry_idx(new_dentry, 0);
if (hidden && hidden->d_inode ) {
- if (UNIONFS_D(new_dentry)->odf_info->whiteout) {
+ if (UNIONFS_D(new_dentry)->odf.whiteout) {
err = unionfs_force_rm(new_dentry, &hidden, 0);
if (err)
goto out;
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index
2822fed78004c0028c45ed832be635d9d4091466..614d23332f4a0ab3ffeb06b83fa545fb96b30712
100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -146,7 +146,7 @@ struct unionfs_dentry_info {
int bend;
int bcount;
atomic_t generation;
- struct odf_dentry_info *odf_info;
+ struct odf_dentry_info odf;
struct path *lower_paths;
};
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs