This patch updates aufs to the 2.6.25 API. It uses the new API where
possible and provides wrappers for the older versions to use.
Most of the changes are focused around the switch in struct nameidata
from a {mnt,dentry} pair to struct path. This is kind of ugly, since
it means declaring a struct path for each site.
The read_inode super_operation was also been eliminates, so the inode
reading code has been updated to follow current kernel conventions.
Signed-off-by: Jeff Mahoney <[EMAIL PROTECTED]>
---
fs/aufs/branch.c | 25 ++++++++++++----------
fs/aufs/compat.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
fs/aufs/dentry.c | 6 ++---
fs/aufs/export.c | 20 +++++++++++-------
fs/aufs/i_op.c | 9 ++++----
fs/aufs/inode.c | 20 +++++++++---------
fs/aufs/misc.c | 27 ++++++++++++------------
fs/aufs/opts.c | 14 ++++++------
fs/aufs/super.c | 34 ++++++++++++++++++++-----------
fs/aufs/super.h | 22 +-------------------
fs/aufs/sysaufs.c | 16 +++++++++-----
fs/aufs/vfsub.c | 2 -
fs/aufs/vfsub.h | 6 +++--
fs/aufs/xino.c | 15 ++-----------
14 files changed, 167 insertions(+), 108 deletions(-)
--- a/fs/aufs/branch.c
+++ b/fs/aufs/branch.c
@@ -310,7 +310,8 @@ static int test_add(struct super_block *
root = sb->s_root;
bend = sbend(sb);
- if (unlikely(bend >= 0 && au_find_dbindex(root, add->nd.dentry) >= 0)) {
+ if (unlikely(bend >= 0 &&
+ au_find_dbindex(root, nd_path(&add->nd).dentry) >= 0)) {
err = 1;
if (!remount) {
err = -EINVAL;
@@ -333,7 +334,7 @@ static int test_add(struct super_block *
goto out;
}
- inode = add->nd.dentry->d_inode;
+ inode = nd_path(&add->nd).dentry->d_inode;
AuDebugOn(!inode || !S_ISDIR(inode->i_mode));
err = -ENOENT;
if (unlikely(!inode->i_nlink)) {
@@ -362,7 +363,7 @@ static int test_add(struct super_block *
goto out;
}
- err = test_br(sb, add->nd.dentry->d_inode, add->perm, add->path);
+ err = test_br(sb, nd_path(&add->nd).dentry->d_inode, add->perm,
add->path);
if (unlikely(err))
goto out;
@@ -383,7 +384,7 @@ static int test_add(struct super_block *
err = -EINVAL;
for (bindex = 0; bindex <= bend; bindex++)
- if (unlikely(test_overlap(sb, add->nd.dentry,
+ if (unlikely(test_overlap(sb, nd_path(&add->nd).dentry,
au_h_dptr_i(root, bindex)))) {
AuErr("%s is overlapped\n", add->path);
goto out;
@@ -410,7 +411,7 @@ int br_add(struct super_block *sb, struc
struct aufs_hinode *hinodep;
LKTRTrace("b%d, %s, 0x%x, %.*s\n", add->bindex, add->path,
- add->perm, AuDLNPair(add->nd.dentry));
+ add->perm, AuDLNPair(nd_path(&add->nd).dentry));
SiMustWriteLock(sb);
root = sb->s_root;
DiMustWriteLock(root);
@@ -436,14 +437,15 @@ int br_add(struct super_block *sb, struc
add_branch->br_wh = NULL;
if (unlikely(br_writable(add->perm))) {
err = init_br_wh(sb, /*bindex*/-1, add_branch, add->perm,
- add->nd.dentry, add->nd.mnt);
+ nd_path(&add->nd).dentry,
+ nd_path(&add->nd).mnt);
if (unlikely(err)) {
kfree(add_branch);
goto out;
}
}
add_branch->br_xino = NULL;
- add_branch->br_mnt = mntget(add->nd.mnt);
+ add_branch->br_mnt = mntget(nd_path(&add->nd).mnt);
atomic_set(&add_branch->br_wh_running, 0);
add_branch->br_id = new_br_id(sb);
add_branch->br_perm = add->perm;
@@ -485,13 +487,14 @@ int br_add(struct super_block *sb, struc
dinfo->di_bstart = 0;
iinfo->ii_bstart = 0;
}
- set_h_dptr(root, add_bindex, dget(add->nd.dentry));
- set_h_iptr(root_inode, add_bindex, igrab(add->nd.dentry->d_inode), 0);
+ set_h_dptr(root, add_bindex, dget(nd_path(&add->nd).dentry));
+ set_h_iptr(root_inode, add_bindex,
+ igrab(nd_path(&add->nd).dentry->d_inode), 0);
if (!add_bindex)
au_cpup_attr_all(root_inode);
else
- au_add_nlink(root_inode, add->nd.dentry->d_inode);
- maxb = add->nd.dentry->d_sb->s_maxbytes;
+ au_add_nlink(root_inode, nd_path(&add->nd).dentry->d_inode);
+ maxb = nd_path(&add->nd).dentry->d_sb->s_maxbytes;
if (sb->s_maxbytes < maxb)
sb->s_maxbytes = maxb;
--- a/fs/aufs/compat.h
+++ b/fs/aufs/compat.h
@@ -1,6 +1,64 @@
#ifndef _AUFS_COMPAT_H_
#define _AUFS_COMPAT_H_
+#include <linux/version.h>
+#include <linux/fs.h>
+#include <linux/seq_file.h>
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
+#define nd_path(nd) ((nd)->path)
+static inline void path_release(struct nameidata *nd)
+{
+ path_put(&nd->path);
+}
+
+#define kobject_unregister(obj) kobject_put((obj))
+
+#else /* <= 2.6.24 */
+#define nd_path(nd) (*(nd))
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
+#define fs_kobj (&fs_subsys.kobj)
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+struct path {
+ struct vfsmount *mnt;
+ struct dentry *dentry;
+};
+#endif
+#define fs_kobj (&fs_subsys.kset.kobj)
+#endif
+
+static inline int compat_seq_path(struct seq_file *m, struct path *path,
+ char *esc)
+{
+ return seq_path(m, path->mnt, path->dentry, esc);
+}
+#define seq_path compat_seq_path
+
+static inline char *compat_d_path(struct path *path, char *buf, int buflen)
+{
+ return d_path(path->dentry, path->mnt, buf, buflen);
+}
+#define d_path compat_d_path
+
+static inline void iget_failed(struct inode *inode)
+{
+ make_bad_inode(inode);
+ unlock_new_inode(inode);
+ iput(inode);
+}
+
+/* This should be static inline since it accesses kobj more than once,
+ * but then varargs wouldn't work correctly. Just be careful. */
+#define kobject_init_and_add(kobj, _ktype, parent, fmt, args...) \
+ ({ \
+ kobject_init(kobj); \
+ (kobj)->ktype = (_ktype); \
+ kobject_set_name((kobj), (fmt), ## args); \
+ kobject_register(kobj); \
+ })
+
struct kobj_attribute {
struct attribute attr;
ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
@@ -8,4 +66,5 @@ struct kobj_attribute {
ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count);
};
+#endif /* <= 2.6.24 */
#endif /* _AUFS_COMPAT_H_ */
--- a/fs/aufs/dentry.c
+++ b/fs/aufs/dentry.c
@@ -648,7 +648,7 @@ static int h_d_revalidate(struct dentry
e = au_hin_after_reval(p, dentry, bindex,
nd->intent.open.file);
#ifndef TestingFuse
- au_update_fuse_h_inode(p->mnt, h_dentry);
+ au_update_fuse_h_inode(nd_path(p).mnt,
h_dentry);
/*ignore*/
#endif
if (unlikely(e && !err))
@@ -849,8 +849,8 @@ static int aufs_d_revalidate(struct dent
//todo: no more lower nameidata, only here. re-use it.
LKTRTrace("dentry %.*s\n", AuDLNPair(dentry));
- if (nd && nd->dentry)
- LKTRTrace("nd{%.*s, 0x%x}\n", AuDLNPair(nd->dentry), nd->flags);
+ if (nd && nd_path(nd).dentry)
+ LKTRTrace("nd{%.*s, 0x%x}\n", AuDLNPair(nd_path(nd).dentry),
nd->flags);
//dir case: AuDebugOn(dentry->d_parent != nd->dentry);
//remove failure case:AuDebugOn(!IS_ROOT(dentry) && d_unhashed(dentry));
AuDebugOn(!dentry->d_fsdata);
--- a/fs/aufs/export.c
+++ b/fs/aufs/export.c
@@ -314,13 +314,14 @@ decode_by_path(struct super_block *sb, a
{
struct dentry *dentry, *h_parent, *root, *h_root;
struct super_block *h_sb;
- char *path, *p;
+ char *pathname, *p;
struct vfsmount *h_mnt;
struct append_name arg;
int len, err;
struct file *h_file;
struct nameidata nd;
struct aufs_branch *br;
+ struct path path;
LKTRTrace("b%d\n", bindex);
SiMustAnyLock(sb);
@@ -347,8 +348,8 @@ decode_by_path(struct super_block *sb, a
}
dentry = ERR_PTR(-ENOMEM);
- path = __getname();
- if (unlikely(!path)) {
+ pathname = __getname();
+ if (unlikely(!pathname)) {
dput(h_parent);
goto out;
}
@@ -357,12 +358,15 @@ decode_by_path(struct super_block *sb, a
di_read_lock_parent(root, !AuLock_IR);
h_root = au_h_dptr_i(root, bindex);
di_read_unlock(root, !AuLock_IR);
- arg.h_path = d_path(h_root, h_mnt, path, PATH_MAX);
+ path.mnt = h_mnt;
+ path.dentry = h_root;
+ arg.h_path = d_path(&path, pathname, PATH_MAX);
dentry = (void *)arg.h_path;
if (unlikely(!arg.h_path || IS_ERR(arg.h_path)))
goto out_putname;
len = strlen(arg.h_path);
- arg.h_path = d_path(h_parent, h_mnt, path, PATH_MAX);
+ path.dentry = h_parent;
+ arg.h_path = d_path(&path, pathname, PATH_MAX);
dentry = (void *)arg.h_path;
if (unlikely(!arg.h_path || IS_ERR(arg.h_path)))
goto out_putname;
@@ -370,7 +374,7 @@ decode_by_path(struct super_block *sb, a
if (len != 1)
arg.h_path += len;
LKTRTrace("%p, %s, %ld\n",
- arg.h_path, arg.h_path, (long)(arg.h_path - path));
+ arg.h_path, arg.h_path, (long)(arg.h_path - pathname));
/* cf. fs/exportfs/expfs.c */
h_file = dentry_open(h_parent, NULL, au_dir_roflags);
@@ -386,7 +390,9 @@ decode_by_path(struct super_block *sb, a
} while (!err && !arg.found && arg.called);
LKTRTrace("%p, %s, %d\n", arg.h_path, arg.h_path, arg.len);
- p = d_path(root, stosi(sb)->si_mnt, path, PATH_MAX - arg.len);
+ path.mnt = stosi(sb)->si_mnt;
+ path.dentry = root;
+ p = d_path(&path, pathname, PATH_MAX - arg.len);
dentry = (void *)p;
if (unlikely(!p || IS_ERR(p)))
goto out_fput;
--- a/fs/aufs/i_op.c
+++ b/fs/aufs/i_op.c
@@ -39,8 +39,8 @@ static int h_permission(struct inode *h_
err = -EACCES;
if (unlikely((write_mask && IS_IMMUTABLE(h_inode))
|| ((mask & MAY_EXEC) && S_ISREG(h_inode->i_mode)
- && fake_nd && fake_nd->mnt
- && (fake_nd->mnt->mnt_flags & MNT_NOEXEC))
+ && fake_nd && nd_path(fake_nd).mnt
+ && (nd_path(fake_nd).mnt->mnt_flags & MNT_NOEXEC))
))
goto out;
@@ -151,7 +151,7 @@ static int aufs_permission(struct inode
LKTRTrace("ino %lu, mask 0x%x, nondir %d, write_mask %d, "
"nd %d{%d, %d}\n",
inode->i_ino, mask, nondir, write_mask,
- !!nd, nd ? !!nd->dentry : 0, nd ? !!nd->mnt : 0);
+ !!nd, nd ? !!nd_path(nd).dentry : 0, nd ? !!nd_path(nd).mnt :
0);
sb = inode->i_sb;
locked = silly_lock(inode, nd);
@@ -818,7 +818,8 @@ static void *aufs_follow_link(struct den
char *buf;
mm_segment_t old_fs;
- LKTRTrace("%.*s, nd %.*s\n", AuDLNPair(dentry), AuDLNPair(nd->dentry));
+ LKTRTrace("%.*s, nd %.*s\n", AuDLNPair(dentry),
+ AuDLNPair(nd_path(nd).dentry));
err = -ENOMEM;
buf = __getname();
--- a/fs/aufs/inode.c
+++ b/fs/aufs/inode.c
@@ -327,17 +327,17 @@ struct inode *au_new_inode(struct dentry
LKTRTrace("%lx, new %d\n", inode->i_state, !!(inode->i_state & I_NEW));
if (inode->i_state & I_NEW) {
- sb->s_op->read_inode(inode);
- if (!is_bad_inode(inode)) {
- ii_write_lock_new(inode);
- err = set_inode(inode, dentry);
- //err = -1;
+ err = aufs_read_inode(inode);
+ if (err)
+ goto out_iput;
+ ii_write_lock_new(inode);
+ err = set_inode(inode, dentry);
+ if (err) {
+ ii_write_unlock(inode);
+ goto out_iput;
}
unlock_new_inode(inode);
- if (!err)
- goto out; /* success */
- ii_write_unlock(inode);
- goto out_iput;
+ goto out;
} else {
err = reval_inode(inode, dentry, &match);
if (!err)
@@ -376,7 +376,7 @@ struct inode *au_new_inode(struct dentry
/* force noxino? */
out_iput:
- iput(inode);
+ iget_failed(inode);
inode = ERR_PTR(err);
out:
AuTraceErrPtr(inode);
--- a/fs/aufs/misc.c
+++ b/fs/aufs/misc.c
@@ -24,6 +24,7 @@
//#include <linux/namei.h>
//#include <linux/mm.h>
//#include <asm/uaccess.h>
+#include "compat.h"
#include "aufs.h"
void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp)
@@ -89,8 +90,8 @@ struct nameidata *au_fake_dm(struct name
if (!nd)
return NULL;
- fake_nd->dentry = NULL;
- fake_nd->mnt = NULL;
+ nd_path(fake_nd).dentry = NULL;
+ nd_path(fake_nd).mnt = NULL;
return fake_nd;
}
@@ -127,16 +128,16 @@ struct nameidata *au_fake_dm(struct name
DiMustAnyLock(nd->dentry);
- fake_nd->dentry = NULL;
- fake_nd->mnt = NULL;
+ nd_path(&fake_nd).dentry = NULL;
+ nd_path(&fake_nd).mnt = NULL;
- if (bindex <= dbend(nd->dentry))
- fake_nd->dentry = au_h_dptr_i(nd->dentry, bindex);
- if (fake_nd->dentry) {
- dget(fake_nd->dentry);
- fake_nd->mnt = sbr_mnt(sb, bindex);
- AuDebugOn(!fake_nd->mnt);
- mntget(fake_nd->mnt);
+ if (bindex <= dbend(nd_path(&nd).dentry))
+ nd_path(&fake_nd).dentry = au_h_dptr_i(nd_path(&nd).dentry,
bindex);
+ if (nd_path(&fake_nd).dentry) {
+ dget(nd_path(&fake_nd).dentry);
+ nd_path(&fake_nd).mnt = sbr_mnt(sb, bindex);
+ AuDebugOn(!nd_path(&fake_nd).mnt);
+ mntget(nd_path(&fake_nd).mnt);
} else
fake_nd = ERR_PTR(-ENOENT);
@@ -147,8 +148,8 @@ struct nameidata *au_fake_dm(struct name
void au_fake_dm_release(struct nameidata *fake_nd)
{
if (fake_nd) {
- mntput(fake_nd->mnt);
- dput(fake_nd->dentry);
+ mntput(nd_path(&fake_nd).mnt);
+ dput(nd_path(&fake_nd).dentry);
}
}
--- a/fs/aufs/opts.c
+++ b/fs/aufs/opts.c
@@ -456,7 +456,7 @@ static void dump_opts(struct au_opts *op
u.add = &opt->add;
LKTRTrace("add {b%d, %s, 0x%x, %p}\n",
u.add->bindex, u.add->path, u.add->perm,
- u.add->nd.dentry);
+ nd_path(&u.add->nd).dentry);
break;
case Opt_del:
case Opt_idel:
@@ -473,13 +473,13 @@ static void dump_opts(struct au_opts *op
u.add = &opt->add;
LKTRTrace("append {b%d, %s, 0x%x, %p}\n",
u.add->bindex, u.add->path, u.add->perm,
- u.add->nd.dentry);
+ nd_path(&u.add->nd).dentry);
break;
case Opt_prepend:
u.add = &opt->add;
LKTRTrace("prepend {b%d, %s, 0x%x, %p}\n",
u.add->bindex, u.add->path, u.add->perm,
- u.add->nd.dentry);
+ nd_path(&u.add->nd).dentry);
break;
case Opt_dirwh:
LKTRTrace("dirwh %d\n", opt->dirwh);
@@ -664,7 +664,7 @@ static int opt_add(struct au_opt *opt, c
if (!err) {
if (!p /* && add->perm == AuBr_Last */) {
add->perm = AuBr_RO;
- if (au_test_def_rr(add->nd.dentry->d_sb))
+ if (au_test_def_rr(nd_path(&add->nd).dentry->d_sb))
add->perm = AuBr_RR;
if (!bindex && !(sb->s_flags & MS_RDONLY))
add->perm = AuBr_RW;
@@ -764,7 +764,7 @@ int au_opts_parse(struct super_block *sb
u.del->path, err);
break;
}
- u.del->h_root = dget(nd.dentry);
+ u.del->h_root = dget(nd_path(&nd).dentry);
path_release(&nd);
opt->type = token;
break;
@@ -810,7 +810,7 @@ int au_opts_parse(struct super_block *sb
u.mod->path, err);
break;
}
- u.mod->h_root = dget(nd.dentry);
+ u.mod->h_root = dget(nd_path(&nd).dentry);
path_release(&nd);
opt->type = token;
break;
@@ -872,7 +872,7 @@ int au_opts_parse(struct super_block *sb
aufs_read_lock(root, AuLock_FLUSH);
bend = sbend(sb);
for (bindex = 0; bindex <= bend; bindex++) {
- if (au_h_dptr_i(root, bindex) == nd.dentry) {
+ if (au_h_dptr_i(root, bindex) ==
nd_path(&nd).dentry) {
u.xino_itrunc->bindex = bindex;
break;
}
--- a/fs/aufs/super.c
+++ b/fs/aufs/super.c
@@ -46,6 +46,7 @@ typedef struct namespace au_mnt_ns_t;
#define au_mnt_ns(tsk) (tsk)->namespace
#endif
+#include "compat.h"
#include "aufs.h"
/*
@@ -76,9 +77,8 @@ static void aufs_destroy_inode(struct in
vfs_inode));
}
-//todo: support 2.6.25, David Howell's patch
//todo: how about merge with alloc_inode()?
-static void aufs_read_inode(struct inode *inode)
+int aufs_read_inode(struct inode *inode)
{
int err;
#if 0
@@ -98,11 +98,11 @@ static void aufs_read_inode(struct inode
inode->i_fop = &aufs_file_fop;
inode->i_mapping->a_ops = &aufs_aop;
//inode->i_mapping->backing_dev_info = &bdi;
- return; /* success */
+ return err; /* success */
}
LKTRTrace("intializing inode info failed(%d)\n", err);
- make_bad_inode(inode);
+ return err;
}
//todo: make static
@@ -118,8 +118,9 @@ int au_show_brs(struct seq_file *seq, st
root = sb->s_root;
bend = sbend(sb);
for (bindex = 0; !err && bindex <= bend; bindex++) {
- err = seq_path(seq, sbr_mnt(sb, bindex),
- au_h_dptr_i(root, bindex), au_esc_chars);
+ struct path path = { .mnt = sbr_mnt(sb, bindex),
+ .dentry = au_h_dptr_i(root, bindex) };
+ err = seq_path(seq, &path, au_esc_chars);
if (err > 0)
err = seq_printf
(seq, "=%s",
@@ -148,11 +149,15 @@ static int aufs_show_options(struct seq_
aufs_read_lock(root, !AuLock_IR);
sbinfo = stosi(sb);
if (AuFlag(sbinfo, f_xino) == AuXino_XINO) {
+ struct path path;
err = seq_puts(m, ",xino=");
if (unlikely(err))
goto out;
xino = sbinfo->si_xib;
- err = seq_path(m, xino->f_vfsmnt, xino->f_dentry, au_esc_chars);
+ path.mnt = xino->f_vfsmnt;
+ path.dentry = xino->f_dentry;
+ /* In 2.6.25, this can just be passed as &xino->f_path */
+ err = seq_path(m, &path, au_esc_chars);
if (unlikely(err <= 0))
goto out;
err = 0;
@@ -748,7 +753,6 @@ static int aufs_remount_fs(struct super_
static struct super_operations aufs_sop = {
.alloc_inode = aufs_alloc_inode,
.destroy_inode = aufs_destroy_inode,
- .read_inode = aufs_read_inode,
//.dirty_inode = aufs_dirty_inode,
//.write_inode = aufs_write_inode,
//void (*put_inode) (struct inode *);
@@ -859,18 +863,24 @@ static int alloc_root(struct super_block
AuTraceEnter();
err = -ENOMEM;
- inode = iget(sb, AUFS_ROOT_INO);
+ inode = iget_locked(sb, AUFS_ROOT_INO);
//if (LktrCond) {iput(inode); inode = NULL;}
if (unlikely(!inode))
goto out;
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out;
- err = -ENOMEM;
- if (unlikely(is_bad_inode(inode)))
- goto out_iput;
+ err = -EINVAL;
+ if (inode->i_state & I_NEW) {
+ err = aufs_read_inode(inode);
+ if (err) {
+ iget_failed(inode);
+ goto out;
+ }
+ }
inode->i_mode = S_IFDIR;
+ unlock_new_inode(inode);
root = d_alloc_root(inode);
//if (LktrCond) {igrab(inode); dput(root); root = NULL;}
if (unlikely(!root))
--- a/fs/aufs/super.h
+++ b/fs/aufs/super.h
@@ -30,11 +30,7 @@
#include <linux/fs.h>
#include <linux/version.h>
#include <linux/cramfs_fs.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
#include <linux/magic.h>
-#else
-#include <linux/nfs_fs.h>
-#endif
#include <linux/aufs_type.h>
//#include "hinode.h"
#include "misc.h"
@@ -141,9 +137,7 @@ struct aufs_sbinfo {
spinlock_t si_plink_lock;
struct list_head si_plink;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
struct vfsmount *si_mnt; /* no get/put */
-#endif
/* sysfs */
/* super_blocks list is not exported */
@@ -190,6 +184,7 @@ static inline struct aufs_sbinfo *to_sbi
struct seq_file;
//todo: make static
int au_show_brs(struct seq_file *seq, struct super_block *sb);
+int aufs_read_inode(struct inode *inode);
extern struct file_system_type aufs_fs_type;
void aufs_sbinfo_release(struct kobject *kobj);
@@ -252,8 +247,7 @@ static inline int au_test_fuse(struct su
static inline int au_test_xfs(struct super_block *sb)
{
int ret = 0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) \
- && (defined(CONFIG_XFS_FS) || defined(CONFIG_XFS_FS_MODULE))
+#if (defined(CONFIG_XFS_FS) || defined(CONFIG_XFS_FS_MODULE))
#ifdef XFS_SB_MAGIC
BUILD_BUG_ON(XFS_SB_MAGIC != 0x58465342);
ret = (sb->s_magic == XFS_SB_MAGIC);
@@ -377,7 +371,6 @@ static inline void au_robr_lvma_init(str
/* ---------------------------------------------------------------------- */
/* limited support before 2.6.18 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
static inline void au_mntget(struct super_block *sb)
{
mntget(stosi(sb)->si_mnt);
@@ -387,17 +380,6 @@ static inline void au_mntput(struct supe
{
mntput(stosi(sb)->si_mnt);
}
-#else
-static inline void au_mntget(struct super_block *sb)
-{
- /* empty */
-}
-
-static inline void au_mntput(struct super_block *sb)
-{
- /* empty */
-}
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18) */
/* ---------------------------------------------------------------------- */
--- a/fs/aufs/sysaufs.c
+++ b/fs/aufs/sysaufs.c
@@ -313,9 +313,11 @@ static int sysaufs_sbi_xino(struct seq_f
static int sysaufs_sbi_mntpnt1(struct seq_file *seq, struct super_block *sb)
{
+ struct path path = { .mnt = stosi(sb)->si_mnt,
+ .dentry = sb->s_root };
AuTraceEnter();
- seq_path(seq, stosi(sb)->si_mnt, sb->s_root, au_esc_chars);
+ seq_path(seq, &path, au_esc_chars);
seq_putc(seq, '\n');
return 0;
@@ -328,6 +330,7 @@ static int sysaufs_sbi_br(struct seq_fil
int err;
struct dentry *root;
struct aufs_branch *br;
+ struct path path;
LKTRTrace("b%d\n", bindex);
@@ -339,7 +342,9 @@ static int sysaufs_sbi_br(struct seq_fil
root = sb->s_root;
di_read_lock_parent(root, !AuLock_IR);
br = stobr(sb, bindex);
- seq_path(seq, br->br_mnt, au_h_dptr_i(root, bindex), au_esc_chars);
+ path.mnt = br->br_mnt;
+ path.dentry = au_h_dptr_i(root, bindex);
+ seq_path(seq, &path, au_esc_chars);
di_read_unlock(root, !AuLock_IR);
seq_printf(seq, "=%s\n", au_optstr_br_perm(br->br_perm));
@@ -518,10 +523,9 @@ static struct kobj_type aufs_sbinfo_ktyp
int sysaufs_register(struct super_block *sb)
{
struct aufs_sbinfo *si = stosi(sb);
- si->si_kobj.ktype = &aufs_sbinfo_ktype;
- kobject_set_name(&si->si_kobj, "sbi_%p", si);
si->si_kobj.kset = &aufs_subsys;
- return kobject_register(&si->si_kobj);
+ return kobject_init_and_add(&si->si_kobj, &aufs_sbinfo_ktype,
+ NULL, "sbi_%p", si);
}
void sysaufs_unregister(struct super_block *sb)
@@ -533,7 +537,7 @@ int __init sysaufs_init(void)
{
int err;
- kobj_set_kset_s(&aufs_subsys, fs_subsys);
+ aufs_subsys.kobj.parent = fs_kobj;
kobject_set_name(&aufs_subsys.kobj, "aufs");
aufs_subsys.kobj.ktype = &kobj_ktype;
err = kset_register(&aufs_subsys);
--- a/fs/aufs/vfsub.c
+++ b/fs/aufs/vfsub.c
@@ -40,7 +40,7 @@ int do_vfsub_create(struct inode *dir, s
if (!err) {
mnt = NULL;
if (nd)
- mnt = nd->mnt;
+ mnt = nd_path(nd).mnt;
/* dir inode is locked */
au_update_fuse_h_inode(mnt, dentry->d_parent); /*ignore*/
au_update_fuse_h_inode(mnt, dentry); /*ignore*/
--- a/fs/aufs/vfsub.h
+++ b/fs/aufs/vfsub.h
@@ -38,6 +38,8 @@
#include <linux/inotify.h>
#endif
+#include "compat.h"
+
/* ---------------------------------------------------------------------- */
/* vfsub flags */
@@ -292,7 +294,7 @@ int vfsub_path_lookup(const char *name,
err = path_lookup(name, flags, nd);
/* lockdep_on(); */
if (!err)
- au_update_fuse_h_inode(nd->mnt, nd->dentry); /*ignore*/
+ au_update_fuse_h_inode(nd_path(nd).mnt, nd_path(nd).dentry);
/*ignore*/
return err;
}
@@ -344,7 +346,7 @@ int vfsub_vfs_path_lookup(struct dentry
err = vfs_path_lookup(parent, mnt, name, flags, nd);
lockdep_on();
if (!err)
- au_update_fuse_h_inode(mnt, nd->dentry); /*ignore*/
+ au_update_fuse_h_inode(mnt, nd_path(nd).dentry); /*ignore*/
AuTraceErr(err);
return err;
--- a/fs/aufs/xino.c
+++ b/fs/aufs/xino.c
@@ -135,7 +135,6 @@ static ssize_t xino_fwrite(writef_t func
/* ---------------------------------------------------------------------- */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
struct xino_do_trunc_args {
struct vfsmount *mnt;
struct aufs_branch *br;
@@ -210,18 +209,9 @@ static void xino_try_trunc(struct super_
out:
atomic_dec_return(&br->br_xino_running);
}
-#else
-static void xino_try_trunc(struct super_block *sb, struct aufs_branch *br)
-{
- /* nothing */
-}
-#endif
/* ---------------------------------------------------------------------- */
-#ifndef LLONG_MAX /* before linux-2.6.18 */
-#define LLONG_MAX ((long long)(~0ULL >> 1))
-#endif
#define Au_LOFF_MAX ((loff_t)LLONG_MAX)
/*
@@ -1193,14 +1183,15 @@ struct file *xino_def(struct super_block
}
if (bwr >= 0) {
+ struct path path = { .mnt = sbr_mnt(sb, bwr),
+ .dentry = au_h_dptr_i(sb->s_root, bwr) };
// todo: rewrite with au_lkup_one()
file = ERR_PTR(-ENOMEM);
page = __getname();
//if (LktrCond) {__putname(page); page = NULL;}
if (unlikely(!page))
goto out;
- p = d_path(au_h_dptr_i(sb->s_root, bwr), sbr_mnt(sb, bwr), page,
- PATH_MAX - sizeof(AUFS_XINO_FNAME));
+ p = d_path(&path, page, PATH_MAX - sizeof(AUFS_XINO_FNAME));
//if (LktrCond) p = ERR_PTR(-1);
file = (void *)p;
if (p && !IS_ERR(p)) {
--
Jeff Mahoney
SUSE Labs
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone