Linux 3.6 compat, sget()

As of Linux commit 9249e17fe094d853d1ef7475dd559a2cc7e23d42 the
mount flags are now passed to sget() so they can be used when
initializing a new superblock.

ZFS never uses sget() in this fashion so we can simply pass a
zero and add a zpl_sget() compatibility wrapper.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #873
This commit is contained in:
Yuxuan Shui 2012-10-12 21:40:53 +08:00 committed by Brian Behlendorf
parent af26c4d4ab
commit 3c20361075
4 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,23 @@
dnl #
dnl # 3.6 API change,
dnl # 'sget' now takes the mount flags as an argument.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_5ARG_SGET],
[AC_MSG_CHECKING([whether sget() wants 5 args])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct file_system_type *type = NULL;
int (*test)(struct super_block *,void *) = NULL;
int (*set)(struct super_block *,void *) = NULL;
int flags = 0;
void *data = NULL;
(void) sget(type, test, set, flags, data);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_5ARG_SGET, 1, [sget() wants 5 args])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -68,6 +68,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER
ZFS_AC_KERNEL_SET_NLINK ZFS_AC_KERNEL_SET_NLINK
ZFS_AC_KERNEL_ELEVATOR_CHANGE ZFS_AC_KERNEL_ELEVATOR_CHANGE
ZFS_AC_KERNEL_5ARG_SGET
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"

View File

@ -131,4 +131,14 @@ typedef int zpl_umode_t;
#define clear_inode(ip) end_writeback(ip) #define clear_inode(ip) end_writeback(ip)
#endif /* HAVE_EVICT_INODE && !HAVE_CLEAR_INODE */ #endif /* HAVE_EVICT_INODE && !HAVE_CLEAR_INODE */
/*
* 3.6 API change,
* The sget() helper function now takes the mount flags as an argument.
*/
#ifdef HAVE_5ARG_SGET
#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, fl, mtd)
#else
#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, mtd)
#endif /* HAVE_5ARG_SGET */
#endif /* _ZFS_VFS_H */ #endif /* _ZFS_VFS_H */

View File

@ -920,8 +920,8 @@ zfsctl_lookup_objset(struct super_block *sb, uint64_t objsetid, zfs_sb_t **zsbp)
* race cannot occur to an expired mount point because * race cannot occur to an expired mount point because
* we hold the zsb->z_ctldir_lock to prevent the race. * we hold the zsb->z_ctldir_lock to prevent the race.
*/ */
sbp = sget(&zpl_fs_type, zfsctl_test_super, sbp = zpl_sget(&zpl_fs_type, zfsctl_test_super,
zfsctl_set_super, &id); zfsctl_set_super, 0, &id);
if (IS_ERR(sbp)) { if (IS_ERR(sbp)) {
error = -PTR_ERR(sbp); error = -PTR_ERR(sbp);
} else { } else {