This patch moves the setup of the sblist and sysaufs into
 aufs_fill_super where it belongs. This allows aufs_get_sb to be
 simplified.

Signed-off-by: Jeff Mahoney <[EMAIL PROTECTED]>
---
 fs/aufs/super.c |   45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

--- a/fs/aufs/super.c
+++ b/fs/aufs/super.c
@@ -986,6 +986,15 @@ static int aufs_fill_super(struct super_
        //AuDbgDentry(root);
        aufs_write_unlock(root);
        vfsub_i_unlock(inode);
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
+       au_lock_sbilist();
+       au_sbilist_add(stosi(sb));
+       si_write_lock(sb);
+       sysaufs_sbinfo_add(sb);
+       si_write_unlock(sb);
+       au_unlock_sbilist();
+#endif
        //AuDbgSb(sb);
        goto out_opts; /* success */
 
@@ -1009,39 +1018,31 @@ static int aufs_fill_super(struct super_
 }
 
 /* ---------------------------------------------------------------------- */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
+#define get_sb_nodev(a,b,c,d,e)                get_sb_nodev(a,b,c,d)
+#define set_vfsmount(a,b)              do { } while(0)
+static int aufs_get_sb(struct file_system_type *fs_type, int flags,
+                      const char *dev_name, void *raw_data)
+{
+#else
+static inline void set_vfsmount(struct vfsmount *mnt)
+{
+       stosi(mnt->mnt_sb)->si_mnt = mnt;
+}
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
 static int aufs_get_sb(struct file_system_type *fs_type, int flags,
                       const char *dev_name, void *raw_data,
                       struct vfsmount *mnt)
 {
+#endif
        int err;
-
        /* all timestamps always follow the ones on the branch */
        /* mnt->mnt_flags |= MNT_NOATIME | MNT_NODIRATIME; */
        err = get_sb_nodev(fs_type, flags, raw_data, aufs_fill_super, mnt);
-       if (!err) {
-               struct super_block *sb = mnt->mnt_sb;
-               struct aufs_sbinfo *sbinfo = stosi(sb);
-               sbinfo->si_mnt = mnt;
-
-               au_lock_sbilist();
-               au_sbilist_add(sbinfo);
-               si_write_lock(sb);
-               sysaufs_sbinfo_add(sb);
-               si_write_unlock(sb);
-               au_unlock_sbilist();
-       }
+       if (!err)
+               set_vfsmount(mnt);
        return err;
 }
-#else
-static struct super_block *aufs_get_sb(struct file_system_type *fs_type,
-                                      int flags, const char *dev_name,
-                                      void *raw_data)
-{
-       return get_sb_nodev(fs_type, flags, raw_data, aufs_fill_super);
-}
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18) */
 
 struct file_system_type aufs_fs_type = {
        .name           = AUFS_FSTYPE,

-- 
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

Reply via email to