mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add Linux posix_fadvise support
The purpose of this PR is to accepts fadvise ioctl from userland to do read-ahead by demand. It could dramatically improve sequential read performance especially when primarycache is set to metadata or zfs_prefetch_disable is 1. If the file is mmaped, generic_fadvise is also called for page cache read-ahead besides dmu_prefetch. Only POSIX_FADV_WILLNEED and POSIX_FADV_SEQUENTIAL are supported in this PR currently. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Finix Yan <yancw@info2soft.com> Closes #13694
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
dnl #
|
||||
dnl # Linux 4.19 API
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_FADVISE], [
|
||||
ZFS_LINUX_TEST_SRC([file_fadvise], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
static const struct file_operations
|
||||
fops __attribute__ ((unused)) = {
|
||||
.fadvise = NULL,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_FADVISE], [
|
||||
AC_MSG_CHECKING([whether fops->fadvise() exists])
|
||||
ZFS_LINUX_TEST_RESULT([file_fadvise], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_FILE_FADVISE, 1, [fops->fadvise() exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,27 @@
|
||||
dnl #
|
||||
dnl # 5.3 API change
|
||||
dnl # The generic_fadvise() function is present since 4.19 kernel
|
||||
dnl # but it was not exported until Linux 5.3.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FADVISE], [
|
||||
ZFS_LINUX_TEST_SRC([generic_fadvise], [
|
||||
#include <linux/fs.h>
|
||||
], [
|
||||
struct file *fp __attribute__ ((unused)) = NULL;
|
||||
loff_t offset __attribute__ ((unused)) = 0;
|
||||
loff_t len __attribute__ ((unused)) = 0;
|
||||
int advise __attribute__ ((unused)) = 0;
|
||||
generic_fadvise(fp, offset, len, advise);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FADVISE], [
|
||||
AC_MSG_CHECKING([whether generic_fadvise() is available])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_fadvise],
|
||||
[generic_fadvise], [mm/fadvise.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GENERIC_FADVISE, 1, [yes])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -42,6 +42,8 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE
|
||||
ZFS_AC_KERNEL_SRC_PDE_DATA
|
||||
ZFS_AC_KERNEL_SRC_FALLOCATE
|
||||
ZFS_AC_KERNEL_SRC_FADVISE
|
||||
ZFS_AC_KERNEL_SRC_GENERIC_FADVISE
|
||||
ZFS_AC_KERNEL_SRC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
|
||||
ZFS_AC_KERNEL_SRC_RWSEM
|
||||
ZFS_AC_KERNEL_SRC_SCHED
|
||||
@@ -161,6 +163,8 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_OBJTOOL
|
||||
ZFS_AC_KERNEL_PDE_DATA
|
||||
ZFS_AC_KERNEL_FALLOCATE
|
||||
ZFS_AC_KERNEL_FADVISE
|
||||
ZFS_AC_KERNEL_GENERIC_FADVISE
|
||||
ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
|
||||
ZFS_AC_KERNEL_RWSEM
|
||||
ZFS_AC_KERNEL_SCHED
|
||||
|
||||
Reference in New Issue
Block a user