2 dnl # The *_file_range APIs have a long history:
4 dnl # 2.6.29: BTRFS_IOC_CLONE and BTRFS_IOC_CLONE_RANGE ioctl introduced
5 dnl # 3.12: BTRFS_IOC_FILE_EXTENT_SAME ioctl introduced
7 dnl # 4.5: copy_file_range() syscall introduced, added to VFS
8 dnl # 4.5: BTRFS_IOC_CLONE and BTRFS_IOC_CLONE_RANGE renamed to FICLONE ands
9 dnl # FICLONERANGE, added to VFS as clone_file_range()
10 dnl # 4.5: BTRFS_IOC_FILE_EXTENT_SAME renamed to FIDEDUPERANGE, added to VFS
11 dnl # as dedupe_file_range()
13 dnl # 4.20: VFS clone_file_range() and dedupe_file_range() replaced by
14 dnl # remap_file_range()
16 dnl # 5.3: VFS copy_file_range() expected to do its own fallback,
17 dnl # generic_copy_file_range() added to support it
19 dnl # 6.8: generic_copy_file_range() removed, replaced by
20 dnl # splice_copy_file_range()
22 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_GENERIC_COPY_FILE_RANGE], [
23 ZFS_LINUX_TEST_SRC([generic_copy_file_range], [
26 struct file *src_file __attribute__ ((unused)) = NULL;
27 loff_t src_off __attribute__ ((unused)) = 0;
28 struct file *dst_file __attribute__ ((unused)) = NULL;
29 loff_t dst_off __attribute__ ((unused)) = 0;
30 size_t len __attribute__ ((unused)) = 0;
31 unsigned int flags __attribute__ ((unused)) = 0;
32 generic_copy_file_range(src_file, src_off, dst_file, dst_off,
36 AC_DEFUN([ZFS_AC_KERNEL_VFS_GENERIC_COPY_FILE_RANGE], [
37 AC_MSG_CHECKING([whether generic_copy_file_range() is available])
38 ZFS_LINUX_TEST_RESULT_SYMBOL([generic_copy_file_range],
39 [generic_copy_file_range], [fs/read_write.c], [
41 AC_DEFINE(HAVE_VFS_GENERIC_COPY_FILE_RANGE, 1,
42 [generic_copy_file_range() is available])
48 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_SPLICE_COPY_FILE_RANGE], [
49 ZFS_LINUX_TEST_SRC([splice_copy_file_range], [
50 #include <linux/splice.h>
52 struct file *src_file __attribute__ ((unused)) = NULL;
53 loff_t src_off __attribute__ ((unused)) = 0;
54 struct file *dst_file __attribute__ ((unused)) = NULL;
55 loff_t dst_off __attribute__ ((unused)) = 0;
56 size_t len __attribute__ ((unused)) = 0;
57 splice_copy_file_range(src_file, src_off, dst_file, dst_off,
61 AC_DEFUN([ZFS_AC_KERNEL_VFS_SPLICE_COPY_FILE_RANGE], [
62 AC_MSG_CHECKING([whether splice_copy_file_range() is available])
63 ZFS_LINUX_TEST_RESULT([splice_copy_file_range], [
65 AC_DEFINE(HAVE_VFS_SPLICE_COPY_FILE_RANGE, 1,
66 [splice_copy_file_range() is available])
72 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_CLONE_FILE_RANGE], [
73 ZFS_LINUX_TEST_SRC([vfs_clone_file_range], [
76 static int test_clone_file_range(struct file *src_file,
77 loff_t src_off, struct file *dst_file, loff_t dst_off,
79 (void) src_file; (void) src_off;
80 (void) dst_file; (void) dst_off;
85 static const struct file_operations
86 fops __attribute__ ((unused)) = {
87 .clone_file_range = test_clone_file_range,
91 AC_DEFUN([ZFS_AC_KERNEL_VFS_CLONE_FILE_RANGE], [
92 AC_MSG_CHECKING([whether fops->clone_file_range() is available])
93 ZFS_LINUX_TEST_RESULT([vfs_clone_file_range], [
95 AC_DEFINE(HAVE_VFS_CLONE_FILE_RANGE, 1,
96 [fops->clone_file_range() is available])
102 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_DEDUPE_FILE_RANGE], [
103 ZFS_LINUX_TEST_SRC([vfs_dedupe_file_range], [
104 #include <linux/fs.h>
106 static int test_dedupe_file_range(struct file *src_file,
107 loff_t src_off, struct file *dst_file, loff_t dst_off,
109 (void) src_file; (void) src_off;
110 (void) dst_file; (void) dst_off;
115 static const struct file_operations
116 fops __attribute__ ((unused)) = {
117 .dedupe_file_range = test_dedupe_file_range,
121 AC_DEFUN([ZFS_AC_KERNEL_VFS_DEDUPE_FILE_RANGE], [
122 AC_MSG_CHECKING([whether fops->dedupe_file_range() is available])
123 ZFS_LINUX_TEST_RESULT([vfs_dedupe_file_range], [
125 AC_DEFINE(HAVE_VFS_DEDUPE_FILE_RANGE, 1,
126 [fops->dedupe_file_range() is available])
132 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_REMAP_FILE_RANGE], [
133 ZFS_LINUX_TEST_SRC([vfs_remap_file_range], [
134 #include <linux/fs.h>
136 static loff_t test_remap_file_range(struct file *src_file,
137 loff_t src_off, struct file *dst_file, loff_t dst_off,
138 loff_t len, unsigned int flags) {
139 (void) src_file; (void) src_off;
140 (void) dst_file; (void) dst_off;
141 (void) len; (void) flags;
145 static const struct file_operations
146 fops __attribute__ ((unused)) = {
147 .remap_file_range = test_remap_file_range,
152 AC_DEFUN([ZFS_AC_KERNEL_VFS_REMAP_FILE_RANGE], [
153 AC_MSG_CHECKING([whether fops->remap_file_range() is available])
154 ZFS_LINUX_TEST_RESULT([vfs_remap_file_range], [
156 AC_DEFINE(HAVE_VFS_REMAP_FILE_RANGE, 1,
157 [fops->remap_file_range() is available])