aboutsummaryrefslogtreecommitdiffstats
path: root/config/kernel-generic_fadvise.m4
diff options
context:
space:
mode:
authorFinix1979 <[email protected]>2022-09-09 01:29:41 +0800
committerGitHub <[email protected]>2022-09-08 10:29:41 -0700
commit320f0c6022e1c9bdc9063f849c6b2e4fa3b93995 (patch)
tree644183a6289eaea14a99e76c386292518c07ee7a /config/kernel-generic_fadvise.m4
parent380b08098edf152b1d98e4f48b9577ce44d39166 (diff)
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 <[email protected]> Signed-off-by: Finix Yan <[email protected]> Closes #13694
Diffstat (limited to 'config/kernel-generic_fadvise.m4')
-rw-r--r--config/kernel-generic_fadvise.m427
1 files changed, 27 insertions, 0 deletions
diff --git a/config/kernel-generic_fadvise.m4 b/config/kernel-generic_fadvise.m4
new file mode 100644
index 000000000..8d122064b
--- /dev/null
+++ b/config/kernel-generic_fadvise.m4
@@ -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)
+ ])
+])