Kernel 4.9 compat: file_operations->aio_fsync removal

Linux kernel commit 723c038475b78 removed this field.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: DHE <git@dehacked.net>
Closes #5393
This commit is contained in:
DeHackEd 2016-11-15 12:20:46 -05:00 committed by Brian Behlendorf
parent 20a0763746
commit dbc95a682c
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,21 @@
dnl #
dnl # Linux 4.9-rc5+ ABI, removal of the .aio_fsync field
dnl #
AC_DEFUN([ZFS_AC_KERNEL_AIO_FSYNC], [
AC_MSG_CHECKING([whether fops->aio_fsync() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
static const struct file_operations
fops __attribute__ ((unused)) = {
.aio_fsync = NULL,
};
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_AIO_FSYNC, 1, [fops->aio_fsync() exists])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -61,6 +61,7 @@ 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_AIO_FSYNC
ZFS_AC_KERNEL_MKDIR_UMODE_T ZFS_AC_KERNEL_MKDIR_UMODE_T
ZFS_AC_KERNEL_LOOKUP_NAMEIDATA ZFS_AC_KERNEL_LOOKUP_NAMEIDATA
ZFS_AC_KERNEL_CREATE_NAMEIDATA ZFS_AC_KERNEL_CREATE_NAMEIDATA

View File

@ -131,12 +131,15 @@ zpl_fsync(struct file *filp, struct dentry *dentry, int datasync)
return (error); return (error);
} }
#ifdef HAVE_FILE_AIO_FSYNC
static int static int
zpl_aio_fsync(struct kiocb *kiocb, int datasync) zpl_aio_fsync(struct kiocb *kiocb, int datasync)
{ {
struct file *filp = kiocb->ki_filp; struct file *filp = kiocb->ki_filp;
return (zpl_fsync(filp, filp->f_path.dentry, datasync)); return (zpl_fsync(filp, filp->f_path.dentry, datasync));
} }
#endif
#elif defined(HAVE_FSYNC_WITHOUT_DENTRY) #elif defined(HAVE_FSYNC_WITHOUT_DENTRY)
/* /*
* Linux 2.6.35 - 3.0 API, * Linux 2.6.35 - 3.0 API,
@ -162,11 +165,14 @@ zpl_fsync(struct file *filp, int datasync)
return (error); return (error);
} }
#ifdef HAVE_FILE_AIO_FSYNC
static int static int
zpl_aio_fsync(struct kiocb *kiocb, int datasync) zpl_aio_fsync(struct kiocb *kiocb, int datasync)
{ {
return (zpl_fsync(kiocb->ki_filp, datasync)); return (zpl_fsync(kiocb->ki_filp, datasync));
} }
#endif
#elif defined(HAVE_FSYNC_RANGE) #elif defined(HAVE_FSYNC_RANGE)
/* /*
* Linux 3.1 - 3.x API, * Linux 3.1 - 3.x API,
@ -197,11 +203,14 @@ zpl_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
return (error); return (error);
} }
#ifdef HAVE_FILE_AIO_FSYNC
static int static int
zpl_aio_fsync(struct kiocb *kiocb, int datasync) zpl_aio_fsync(struct kiocb *kiocb, int datasync)
{ {
return (zpl_fsync(kiocb->ki_filp, kiocb->ki_pos, -1, datasync)); return (zpl_fsync(kiocb->ki_filp, kiocb->ki_pos, -1, datasync));
} }
#endif
#else #else
#error "Unsupported fops->fsync() implementation" #error "Unsupported fops->fsync() implementation"
#endif #endif
@ -838,7 +847,9 @@ const struct file_operations zpl_file_operations = {
#endif #endif
.mmap = zpl_mmap, .mmap = zpl_mmap,
.fsync = zpl_fsync, .fsync = zpl_fsync,
#ifdef HAVE_FILE_AIO_FSYNC
.aio_fsync = zpl_aio_fsync, .aio_fsync = zpl_aio_fsync,
#endif
#ifdef HAVE_FILE_FALLOCATE #ifdef HAVE_FILE_FALLOCATE
.fallocate = zpl_fallocate, .fallocate = zpl_fallocate,
#endif /* HAVE_FILE_FALLOCATE */ #endif /* HAVE_FILE_FALLOCATE */