From b68425415c7ea12ec3ba3c05be892ff86c60deeb Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 24 Jul 2012 10:39:22 -0400 Subject: [PATCH] LU-812 replace get_sb with mount in struct file_system_type get_sb() has been removed from struct file_system_type since 2.6.39 and switched to mount(). Signed-off-by: James Simmons Signed-off-by: Wally Wang Signed-off-by: Bob Glossman Change-Id: I6b0762828b26f065732f7f0c528e0b20d41cb710 Reviewed-on: http://review.whamcloud.com/3661 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/autoconf/lustre-core.m4 | 22 ++++++++++++++++++++++ lustre/llite/llite_lib.c | 4 +++- lustre/obdclass/obd_mount.c | 16 +++++++++++----- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 101f741..2191032 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2246,6 +2246,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 +],[ + 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]) +]) +]) + # # LC_PROG_LINUX @@ -2408,6 +2427,9 @@ AC_DEFUN([LC_PROG_LINUX], LC_WALK_SPACE_HAS_DATA_SEM LC_SELINUX_IS_ENABLED + # 2.6.39 + LC_HAVE_FSTYPE_MOUNT + # if test x$enable_server = xyes ; then AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server]) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 275a7bc..0c14375 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -470,7 +470,9 @@ 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*/ && \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)) /*LU-1646*/ sb->s_export_op = &lustre_export_operations; #endif diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 6a8e2c7..24d4dc2 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -2220,17 +2220,19 @@ void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb)) /***************** FS registration ******************/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) -struct super_block * lustre_get_sb(struct file_system_type *fs_type, int flags, - const char *devname, void * data) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) || defined(HAVE_FSTYPE_MOUNT) +struct dentry *lustre_mount(struct file_system_type *fs_type, int flags, + const char *devname, void * data) { - return get_sb_nodev(fs_type, flags, data, lustre_fill_super); + 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); } @@ -2251,7 +2253,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 -- 1.8.3.1