Whamcloud - gitweb
LU-812 replace get_sb with mount in struct file_system_type
authorJames Simmons <uja.ornl@gmail.com>
Tue, 24 Jul 2012 14:39:22 +0000 (10:39 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 8 Aug 2012 19:45:18 +0000 (15:45 -0400)
get_sb() has been removed from struct file_system_type since
2.6.39 and switched to mount().

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Wally Wang <wang@cray.com>
Change-Id: I44fa30eb51c4444d9ef8e7b545f2b80088f127cc
Reviewed-on: http://review.whamcloud.com/1951
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bob Glossman <bogl@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/llite/llite_lib.c
lustre/obdclass/obd_mount.c

index ae02fd0..1168898 100644 (file)
@@ -1747,6 +1747,25 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 2.6.39 replace get_sb with mount in struct file_system_type
+#
+AC_DEFUN([LC_HAVE_FSTYPE_MOUNT],
+[AC_MSG_CHECKING([if file_system_type has mount field])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/fs.h>
+],[
+       struct file_system_type fst;
+       void *i = (void *) fst.mount;
+],[
+       AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
+               [struct file_system_type has mount field])
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
 # 2.6.38 generic_permission taken 4 parameters.
 # in fact, it means rcu-walk aware permission bring.
 #
@@ -1969,6 +1988,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
          # 2.6.39
          LC_REQUEST_QUEUE_UNPLUG_FN
+       LC_HAVE_FSTYPE_MOUNT
 
        # 3.3
        LC_HAVE_MIGRATE_HEADER
index e62cff7..bdb94d9 100644 (file)
@@ -463,7 +463,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
         CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid));
 
         sb->s_op = &lustre_super_operations;
-#if THREAD_SIZE >= 8192
+#if THREAD_SIZE >= 8192 /*b=17630*/ && !defined(HAVE_FSTYPE_MOUNT) /*LU-812*/
         sb->s_export_op = &lustre_export_operations;
 #endif
 
index 8588bef..e76dbf8 100644 (file)
@@ -2576,14 +2576,23 @@ void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb))
 EXPORT_SYMBOL(lustre_register_kill_super_cb);
 
 /***************** FS registration ******************/
+#ifdef HAVE_FSTYPE_MOUNT
+struct dentry *lustre_mount(struct file_system_type *fs_type, int flags,
+                               const char *devname, void *data)
+{
+       struct lustre_mount_data2 lmd2 = { data, NULL };
 
+       return mount_nodev(fs_type, flags, &lmd2, lustre_fill_super);
+}
+#else
 int lustre_get_sb(struct file_system_type *fs_type, int flags,
                   const char *devname, void * data, struct vfsmount *mnt)
 {
-        struct lustre_mount_data2 lmd2 = {data, mnt};
+       struct lustre_mount_data2 lmd2 = { data, mnt };
 
-        return get_sb_nodev(fs_type, flags, &lmd2, lustre_fill_super, mnt);
+       return get_sb_nodev(fs_type, flags, &lmd2, lustre_fill_super, mnt);
 }
+#endif
 
 void lustre_kill_super(struct super_block *sb)
 {
@@ -2600,7 +2609,11 @@ void lustre_kill_super(struct super_block *sb)
 struct file_system_type lustre_fs_type = {
         .owner        = THIS_MODULE,
         .name         = "lustre",
+#ifdef HAVE_FSTYPE_MOUNT
+       .mount        = lustre_mount,
+#else
         .get_sb       = lustre_get_sb,
+#endif
         .kill_sb      = lustre_kill_super,
         .fs_flags     = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV |
 #ifdef FS_HAS_FIEMAP