zfs: add patch for Linux 5.16 compat.
Still missing patch for [1]. Lack of FPU acceleration for encryption is a performance issue and annoying, but it doesn't explicitly break anything, and we should wait for fixes to actually be merged. [1] https://github.com/openzfs/zfs/issues/13042
This commit is contained in:
parent
eafc80e9a9
commit
d7c90369ad
2 changed files with 277 additions and 1 deletions
276
srcpkgs/zfs/patches/12975.patch
Normal file
276
srcpkgs/zfs/patches/12975.patch
Normal file
|
@ -0,0 +1,276 @@
|
|||
From 7b926912e9a968341c2140f7b887261fea86c706 Mon Sep 17 00:00:00 2001
|
||||
From: Rich Ercolani <rincebrain@gmail.com>
|
||||
Date: Fri, 14 Jan 2022 05:09:08 -0500
|
||||
Subject: [PATCH 1/4] Linux 5.16 compat: Check slab.h for kvmalloc
|
||||
|
||||
As it says on the tin - the folio work moved a bunch out of mm.h.
|
||||
|
||||
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
|
||||
---
|
||||
config/kernel-kmem.m4 | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/config/kernel-kmem.m4 b/config/kernel-kmem.m4
|
||||
index 43f9e72f88d..03c2a41fbdb 100644
|
||||
--- a/config/kernel-kmem.m4
|
||||
+++ b/config/kernel-kmem.m4
|
||||
@@ -64,6 +64,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_KVMALLOC], [
|
||||
ZFS_LINUX_TEST_SRC([kvmalloc], [
|
||||
#include <linux/mm.h>
|
||||
+ #include <linux/slab.h>
|
||||
],[
|
||||
void *p __attribute__ ((unused));
|
||||
|
||||
|
||||
From 1ca38ed9280ce80e7a12813b54dc5ade5e78f61b Mon Sep 17 00:00:00 2001
|
||||
From: Rich Ercolani <rincebrain@gmail.com>
|
||||
Date: Fri, 14 Jan 2022 05:08:33 -0500
|
||||
Subject: [PATCH 2/4] Linux 5.16 compat: Added add_disk check for return
|
||||
|
||||
add_disk went from void to must-check int return.
|
||||
|
||||
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
|
||||
---
|
||||
config/kernel-add-disk.m4 | 27 +++++++++++++++++++++++++++
|
||||
config/kernel.m4 | 2 ++
|
||||
module/os/linux/zfs/zvol_os.c | 4 ++++
|
||||
3 files changed, 33 insertions(+)
|
||||
create mode 100644 config/kernel-add-disk.m4
|
||||
|
||||
diff --git a/config/kernel-add-disk.m4 b/config/kernel-add-disk.m4
|
||||
new file mode 100644
|
||||
index 00000000000..3bc40f1e7d2
|
||||
--- /dev/null
|
||||
+++ b/config/kernel-add-disk.m4
|
||||
@@ -0,0 +1,27 @@
|
||||
+dnl #
|
||||
+dnl # 5.16 API change
|
||||
+dnl # add_disk grew a must-check return code
|
||||
+dnl #
|
||||
+AC_DEFUN([ZFS_AC_KERNEL_SRC_ADD_DISK], [
|
||||
+
|
||||
+ ZFS_LINUX_TEST_SRC([add_disk_ret], [
|
||||
+ #include <linux/genhd.h>
|
||||
+ ], [
|
||||
+ struct gendisk *disk = NULL;
|
||||
+ int err = add_disk(disk);
|
||||
+ err = err;
|
||||
+ ])
|
||||
+
|
||||
+])
|
||||
+
|
||||
+AC_DEFUN([ZFS_AC_KERNEL_ADD_DISK], [
|
||||
+ AC_MSG_CHECKING([whether add_disk() returns int])
|
||||
+ ZFS_LINUX_TEST_RESULT([add_disk_ret],
|
||||
+ [
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ AC_DEFINE(HAVE_ADD_DISK_RET, 1,
|
||||
+ [add_disk() returns int])
|
||||
+ ], [
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ ])
|
||||
+])
|
||||
diff --git a/config/kernel.m4 b/config/kernel.m4
|
||||
index bdd3caed2b3..b3ed966b726 100644
|
||||
--- a/config/kernel.m4
|
||||
+++ b/config/kernel.m4
|
||||
@@ -135,6 +135,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
||||
ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG
|
||||
ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT
|
||||
+ ZFS_AC_KERNEL_SRC_ADD_DISK
|
||||
|
||||
AC_MSG_CHECKING([for available kernel interfaces])
|
||||
ZFS_LINUX_TEST_COMPILE_ALL([kabi])
|
||||
@@ -243,6 +244,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
||||
ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG
|
||||
ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT
|
||||
+ ZFS_AC_KERNEL_ADD_DISK
|
||||
])
|
||||
|
||||
dnl #
|
||||
diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c
|
||||
index cef52e22483..e26d4db4977 100644
|
||||
--- a/module/os/linux/zfs/zvol_os.c
|
||||
+++ b/module/os/linux/zfs/zvol_os.c
|
||||
@@ -1110,7 +1110,11 @@ zvol_os_create_minor(const char *name)
|
||||
rw_enter(&zvol_state_lock, RW_WRITER);
|
||||
zvol_insert(zv);
|
||||
rw_exit(&zvol_state_lock);
|
||||
+#ifdef HAVE_ADD_DISK_RET
|
||||
+ error = add_disk(zv->zv_zso->zvo_disk);
|
||||
+#else
|
||||
add_disk(zv->zv_zso->zvo_disk);
|
||||
+#endif
|
||||
} else {
|
||||
ida_simple_remove(&zvol_ida, idx);
|
||||
}
|
||||
|
||||
From a0b11a8996b55a0bb3c1c100fa6f392ca90d74b0 Mon Sep 17 00:00:00 2001
|
||||
From: Rich Ercolani <rincebrain@gmail.com>
|
||||
Date: Fri, 14 Jan 2022 05:07:33 -0500
|
||||
Subject: [PATCH 3/4] Linux 5.16 compat: Added mapping for
|
||||
iov_iter_fault_in_readable
|
||||
|
||||
Linux decided to rename this for some reason. At some point, we
|
||||
should probably invert this mapping, but for now...
|
||||
|
||||
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
|
||||
---
|
||||
config/kernel-add-disk.m4 | 1 -
|
||||
config/kernel-vfs-iov_iter.m4 | 22 ++++++++++++++++++++--
|
||||
include/os/linux/spl/sys/uio.h | 4 ++++
|
||||
3 files changed, 24 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/config/kernel-add-disk.m4 b/config/kernel-add-disk.m4
|
||||
index 3bc40f1e7d2..5d1779eb432 100644
|
||||
--- a/config/kernel-add-disk.m4
|
||||
+++ b/config/kernel-add-disk.m4
|
||||
@@ -13,7 +13,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_ADD_DISK], [
|
||||
])
|
||||
|
||||
])
|
||||
-
|
||||
AC_DEFUN([ZFS_AC_KERNEL_ADD_DISK], [
|
||||
AC_MSG_CHECKING([whether add_disk() returns int])
|
||||
ZFS_LINUX_TEST_RESULT([add_disk_ret],
|
||||
diff --git a/config/kernel-vfs-iov_iter.m4 b/config/kernel-vfs-iov_iter.m4
|
||||
index ecdda939f1c..57f78745a24 100644
|
||||
--- a/config/kernel-vfs-iov_iter.m4
|
||||
+++ b/config/kernel-vfs-iov_iter.m4
|
||||
@@ -41,6 +41,17 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
|
||||
error = iov_iter_fault_in_readable(&iter, size);
|
||||
])
|
||||
|
||||
+ ZFS_LINUX_TEST_SRC([fault_in_iov_iter_readable], [
|
||||
+ #include <linux/fs.h>
|
||||
+ #include <linux/uio.h>
|
||||
+ ],[
|
||||
+ struct iov_iter iter = { 0 };
|
||||
+ size_t size = 512;
|
||||
+ int error __attribute__ ((unused));
|
||||
+
|
||||
+ error = fault_in_iov_iter_readable(&iter, size);
|
||||
+ ])
|
||||
+
|
||||
ZFS_LINUX_TEST_SRC([iov_iter_count], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/uio.h>
|
||||
@@ -123,8 +134,15 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
|
||||
AC_DEFINE(HAVE_IOV_ITER_FAULT_IN_READABLE, 1,
|
||||
[iov_iter_fault_in_readable() is available])
|
||||
],[
|
||||
- AC_MSG_RESULT(no)
|
||||
- enable_vfs_iov_iter="no"
|
||||
+ AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available])
|
||||
+ ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ AC_DEFINE(HAVE_FAULT_IN_IOV_ITER_READABLE, 1,
|
||||
+ [fault_in_iov_iter_readable() is available])
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ enable_vfs_iov_iter="no"
|
||||
+ ])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether iov_iter_count() is available])
|
||||
diff --git a/include/os/linux/spl/sys/uio.h b/include/os/linux/spl/sys/uio.h
|
||||
index 66af2b0b534..439eec98623 100644
|
||||
--- a/include/os/linux/spl/sys/uio.h
|
||||
+++ b/include/os/linux/spl/sys/uio.h
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <asm/uaccess.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
+#if defined(HAVE_VFS_IOV_ITER) && defined(HAVE_FAULT_IN_IOV_ITER_READABLE)
|
||||
+#define iov_iter_fault_in_readable(a, b) fault_in_iov_iter_readable(a, b)
|
||||
+#endif
|
||||
+
|
||||
typedef struct iovec iovec_t;
|
||||
|
||||
typedef enum zfs_uio_rw {
|
||||
|
||||
From 700bb88b595d0e73ad3c19767cec68cb8081be2d Mon Sep 17 00:00:00 2001
|
||||
From: Rich Ercolani <rincebrain@gmail.com>
|
||||
Date: Wed, 19 Jan 2022 00:12:15 -0500
|
||||
Subject: [PATCH 4/4] Add support for FALLOC_FL_ZERO_RANGE
|
||||
|
||||
For us, I think it's always just FALLOC_FL_PUNCH_HOLE with a fake
|
||||
mustache on.
|
||||
|
||||
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
|
||||
---
|
||||
config/kernel-fallocate.m4 | 17 +++++++++++++++++
|
||||
module/os/linux/zfs/zpl_file.c | 9 +++++++--
|
||||
2 files changed, 24 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/config/kernel-fallocate.m4 b/config/kernel-fallocate.m4
|
||||
index 7a8550f7e76..815602d3e2c 100644
|
||||
--- a/config/kernel-fallocate.m4
|
||||
+++ b/config/kernel-fallocate.m4
|
||||
@@ -3,6 +3,10 @@ dnl # Linux 2.6.38 - 3.x API
|
||||
dnl # The fallocate callback was moved from the inode_operations
|
||||
dnl # structure to the file_operations structure.
|
||||
dnl #
|
||||
+dnl #
|
||||
+dnl # Linux 3.15+
|
||||
+dnl # fallocate learned a new flag, FALLOC_FL_ZERO_RANGE
|
||||
+dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
|
||||
ZFS_LINUX_TEST_SRC([file_fallocate], [
|
||||
#include <linux/fs.h>
|
||||
@@ -15,12 +19,25 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
|
||||
.fallocate = test_fallocate,
|
||||
};
|
||||
], [])
|
||||
+ ZFS_LINUX_TEST_SRC([falloc_fl_zero_range], [
|
||||
+ #include <linux/falloc.h>
|
||||
+ ],[
|
||||
+ int flags __attribute__ ((unused));
|
||||
+ flags = FALLOC_FL_ZERO_RANGE;
|
||||
+ ])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [
|
||||
AC_MSG_CHECKING([whether fops->fallocate() exists])
|
||||
ZFS_LINUX_TEST_RESULT([file_fallocate], [
|
||||
AC_MSG_RESULT(yes)
|
||||
+ AC_MSG_CHECKING([whether FALLOC_FL_ZERO_RANGE exists])
|
||||
+ ZFS_LINUX_TEST_RESULT([falloc_fl_zero_range], [
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ AC_DEFINE(HAVE_FALLOC_FL_ZERO_RANGE, 1, [FALLOC_FL_ZERO_RANGE is defined])
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ ])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([file_fallocate])
|
||||
])
|
||||
diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c
|
||||
index 21926f170c5..a3af1804f6a 100644
|
||||
--- a/module/os/linux/zfs/zpl_file.c
|
||||
+++ b/module/os/linux/zfs/zpl_file.c
|
||||
@@ -745,7 +745,12 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
|
||||
fstrans_cookie_t cookie;
|
||||
int error = 0;
|
||||
|
||||
- if ((mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) != 0)
|
||||
+ int test_mode = FALLOC_FL_PUNCH_HOLE;
|
||||
+#ifdef HAVE_FALLOC_FL_ZERO_RANGE
|
||||
+ test_mode |= FALLOC_FL_ZERO_RANGE;
|
||||
+#endif
|
||||
+
|
||||
+ if ((mode & ~(FALLOC_FL_KEEP_SIZE | test_mode)) != 0)
|
||||
return (-EOPNOTSUPP);
|
||||
|
||||
if (offset < 0 || len <= 0)
|
||||
@@ -756,7 +761,7 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
|
||||
|
||||
crhold(cr);
|
||||
cookie = spl_fstrans_mark();
|
||||
- if (mode & FALLOC_FL_PUNCH_HOLE) {
|
||||
+ if (mode & (test_mode)) {
|
||||
flock64_t bf;
|
||||
|
||||
if (offset > olen)
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'zfs'
|
||||
pkgname=zfs
|
||||
version=2.1.2
|
||||
revision=1
|
||||
revision=2
|
||||
build_style=gnu-configure
|
||||
configure_args="--with-config=user --with-mounthelperdir=/usr/bin
|
||||
--with-udevdir=/usr/lib/udev --with-udevruledir=/usr/lib/udev/rules.d
|
||||
|
|
Loading…
Reference in a new issue