Merge branch 'linux-3.6'

This branch adds the required compatibility code to support the
Linux 3.6 kernel.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #873
This commit is contained in:
Brian Behlendorf 2012-10-14 16:27:22 -07:00
commit ee7913b644
10 changed files with 115 additions and 10 deletions

View File

@ -0,0 +1,26 @@
dnl #
dnl # 3.6 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
AC_MSG_CHECKING([whether iops->create() takes struct nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
#ifdef HAVE_MKDIR_UMODE_T
int (*inode_create) (struct inode *,struct dentry *,
umode_t, struct nameidata *) = NULL;
#else
int (*inode_create) (struct inode *,struct dentry *,
int, struct nameidata *) = NULL;
#endif
struct inode_operations iops __attribute__ ((unused)) = {
.create = inode_create,
};
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CREATE_NAMEIDATA, 1,
[iops->create() operation takes nameidata])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -0,0 +1,21 @@
dnl #
dnl # 3.6 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
AC_MSG_CHECKING([whether iops->lookup() takes struct nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct dentry * (*inode_lookup) (struct inode *,struct dentry *,
struct nameidata *) = NULL;
struct inode_operations iops __attribute__ ((unused)) = {
.lookup = inode_lookup,
};
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LOOKUP_NAMEIDATA, 1,
[iops->lookup() operation takes nameidata])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -6,19 +6,18 @@ dnl # would also change all three prototypes. However, if it turns out that
dnl # some distribution doesn't backport the whole thing this could be dnl # some distribution doesn't backport the whole thing this could be
dnl # broken apart in to three seperate checks. dnl # broken apart in to three seperate checks.
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_CREATE_UMODE_T], [ AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [
AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t]) AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t])
ZFS_LINUX_TRY_COMPILE([ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h> #include <linux/fs.h>
],[ ],[
int (*create) (struct inode *, struct dentry *, umode_t, int (*mkdir) (struct inode *,struct dentry *,umode_t) = NULL;
struct nameidata *) = NULL;
struct inode_operations iops __attribute__ ((unused)) = { struct inode_operations iops __attribute__ ((unused)) = {
.create = create, .mkdir = mkdir,
}; };
],[ ],[
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CREATE_UMODE_T, 1, AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
[iops->create()/mkdir()/mknod() take umode_t]) [iops->create()/mkdir()/mknod() take umode_t])
],[ ],[
AC_MSG_RESULT(no) AC_MSG_RESULT(no)

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

@ -49,8 +49,10 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_NR_CACHED_OBJECTS ZFS_AC_KERNEL_NR_CACHED_OBJECTS
ZFS_AC_KERNEL_FREE_CACHED_OBJECTS ZFS_AC_KERNEL_FREE_CACHED_OBJECTS
ZFS_AC_KERNEL_FALLOCATE ZFS_AC_KERNEL_FALLOCATE
ZFS_AC_KERNEL_MKDIR_UMODE_T
ZFS_AC_KERNEL_LOOKUP_NAMEIDATA
ZFS_AC_KERNEL_CREATE_NAMEIDATA
ZFS_AC_KERNEL_TRUNCATE_RANGE ZFS_AC_KERNEL_TRUNCATE_RANGE
ZFS_AC_KERNEL_CREATE_UMODE_T
ZFS_AC_KERNEL_AUTOMOUNT ZFS_AC_KERNEL_AUTOMOUNT
ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE
ZFS_AC_KERNEL_COMMIT_METADATA ZFS_AC_KERNEL_COMMIT_METADATA
@ -68,6 +70,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

@ -115,7 +115,7 @@ set_nlink(struct inode *inode, unsigned int nlink)
* umode_t type rather than an int. To cleanly handle both definitions * umode_t type rather than an int. To cleanly handle both definitions
* the zpl_umode_t type is introduced and set accordingly. * the zpl_umode_t type is introduced and set accordingly.
*/ */
#ifdef HAVE_CREATE_UMODE_T #ifdef HAVE_MKDIR_UMODE_T
typedef umode_t zpl_umode_t; typedef umode_t zpl_umode_t;
#else #else
typedef int zpl_umode_t; typedef int zpl_umode_t;
@ -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 {

View File

@ -143,7 +143,11 @@ zpl_root_getattr(struct vfsmount *mnt, struct dentry *dentry,
} }
static struct dentry * static struct dentry *
#ifdef HAVE_LOOKUP_NAMEIDATA
zpl_root_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd) zpl_root_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd)
#else
zpl_root_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags)
#endif
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
struct inode *ip; struct inode *ip;
@ -180,8 +184,14 @@ const struct inode_operations zpl_ops_root = {
}; };
static struct dentry * static struct dentry *
#ifdef HAVE_LOOKUP_NAMEIDATA
zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry, zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
struct nameidata *nd) struct nameidata *nd)
#else
zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
unsigned int flags)
#endif
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
struct inode *ip; struct inode *ip;
@ -410,8 +420,13 @@ const struct dentry_operations zpl_dops_snapdirs = {
#endif /* HAVE_AUTOMOUNT */ #endif /* HAVE_AUTOMOUNT */
static struct dentry * static struct dentry *
#ifdef HAVE_LOOKUP_NAMEIDATA
zpl_shares_lookup(struct inode *dip, struct dentry *dentry, zpl_shares_lookup(struct inode *dip, struct dentry *dentry,
struct nameidata *nd) struct nameidata *nd)
#else
zpl_shares_lookup(struct inode *dip, struct dentry *dentry,
unsigned int flags)
#endif
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
struct inode *ip = NULL; struct inode *ip = NULL;

View File

@ -31,7 +31,11 @@
static struct dentry * static struct dentry *
#ifdef HAVE_LOOKUP_NAMEIDATA
zpl_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) zpl_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
#else
zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
#endif
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
struct inode *ip; struct inode *ip;
@ -71,8 +75,13 @@ zpl_vap_init(vattr_t *vap, struct inode *dir, struct dentry *dentry,
} }
static int static int
#ifdef HAVE_CREATE_NAMEIDATA
zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
struct nameidata *nd) struct nameidata *nd)
#else
zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
bool flag)
#endif
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
struct inode *ip; struct inode *ip;

View File

@ -316,7 +316,6 @@ const struct super_operations zpl_super_operations = {
.delete_inode = zpl_inode_delete, .delete_inode = zpl_inode_delete,
#endif /* HAVE_EVICT_INODE */ #endif /* HAVE_EVICT_INODE */
.put_super = zpl_put_super, .put_super = zpl_put_super,
.write_super = NULL,
.sync_fs = zpl_sync_fs, .sync_fs = zpl_sync_fs,
.statfs = zpl_statfs, .statfs = zpl_statfs,
.remount_fs = zpl_remount_fs, .remount_fs = zpl_remount_fs,