Semi-automated update for zfs 0.8.4

master
Archzfs Buildbot 5 years ago
parent 6a6d01a9d9
commit c63445a34f
  1. 20
      .SRCINFO
  2. 26
      PKGBUILD
  3. 136
      linux-5.5-compat-blkg_tryget.patch
  4. 129
      linux-5.6-compat-ktime_get_raw_ts64.patch
  5. 226
      linux-5.6-compat-struct-proc_ops.patch
  6. 87
      linux-5.6-compat-time_t.patch
  7. 115
      linux-5.6-compat-timestamp_truncate.patch

@ -1,12 +1,12 @@
pkgbase = zfs-dkms pkgbase = zfs-dkms
pkgdesc = Kernel modules for the Zettabyte File System. pkgdesc = Kernel modules for the Zettabyte File System.
pkgver = 0.8.3 pkgver = 0.8.4
pkgrel = 4 pkgrel = 1
url = https://zfsonlinux.org/ url = https://zfsonlinux.org/
arch = x86_64 arch = x86_64
groups = archzfs-dkms groups = archzfs-dkms
license = CDDL license = CDDL
depends = zfs-utils=0.8.3 depends = zfs-utils=0.8.4
depends = lsb-release depends = lsb-release
depends = dkms depends = dkms
provides = zfs provides = zfs
@ -18,18 +18,8 @@ pkgbase = zfs-dkms
conflicts = spl conflicts = spl
conflicts = spl-headers conflicts = spl-headers
replaces = spl-dkms replaces = spl-dkms
source = https://github.com/zfsonlinux/zfs/releases/download/zfs-0.8.3/zfs-0.8.3.tar.gz source = https://github.com/zfsonlinux/zfs/releases/download/zfs-0.8.4/zfs-0.8.4.tar.gz
source = linux-5.5-compat-blkg_tryget.patch sha256sums = 2b988f5777976f09d08083f6bebf6e67219c4c4c183c1f33033fb7e5e5eacafb
source = linux-5.6-compat-struct-proc_ops.patch
source = linux-5.6-compat-timestamp_truncate.patch
source = linux-5.6-compat-ktime_get_raw_ts64.patch
source = linux-5.6-compat-time_t.patch
sha256sums = 545a4897ce30c2d2dd9010a0fdb600a0d3d45805e2387093c473efc03aa9d7fd
sha256sums = daae58460243c45c2c7505b1d88dcb299ea7d92bcf3f41d2d30bc213000bb1da
sha256sums = 05ca889a89b1e57d55c1b7d4d3013398a3e5a69d0fad27278aad701f0bb6e802
sha256sums = 5ad4393b334a8f685212f47b44e98dc468c70214ee5dbbab24cc95c4f310ae39
sha256sums = 7c6ebee72d864160b376fc18017c81f499f177b7d9265f565de859139805a277
sha256sums = 06f7ade5adcbfe77cb234361f8b2aca6d6e78fcd136da6d3a70048b5e92c62bb
pkgname = zfs-dkms pkgname = zfs-dkms

@ -8,37 +8,19 @@
pkgname="zfs-dkms" pkgname="zfs-dkms"
pkgdesc="Kernel modules for the Zettabyte File System." pkgdesc="Kernel modules for the Zettabyte File System."
pkgver=0.8.3 pkgver=0.8.4
pkgrel=4 pkgrel=1
makedepends=() makedepends=()
arch=("x86_64") arch=("x86_64")
url="https://zfsonlinux.org/" url="https://zfsonlinux.org/"
source=("https://github.com/zfsonlinux/zfs/releases/download/zfs-${pkgver}/zfs-${pkgver}.tar.gz" source=("https://github.com/zfsonlinux/zfs/releases/download/zfs-${pkgver}/zfs-${pkgver}.tar.gz")
"linux-5.5-compat-blkg_tryget.patch" sha256sums=("2b988f5777976f09d08083f6bebf6e67219c4c4c183c1f33033fb7e5e5eacafb")
"linux-5.6-compat-struct-proc_ops.patch"
"linux-5.6-compat-timestamp_truncate.patch"
"linux-5.6-compat-ktime_get_raw_ts64.patch"
"linux-5.6-compat-time_t.patch")
sha256sums=("545a4897ce30c2d2dd9010a0fdb600a0d3d45805e2387093c473efc03aa9d7fd"
"daae58460243c45c2c7505b1d88dcb299ea7d92bcf3f41d2d30bc213000bb1da"
"05ca889a89b1e57d55c1b7d4d3013398a3e5a69d0fad27278aad701f0bb6e802"
"5ad4393b334a8f685212f47b44e98dc468c70214ee5dbbab24cc95c4f310ae39"
"7c6ebee72d864160b376fc18017c81f499f177b7d9265f565de859139805a277"
"06f7ade5adcbfe77cb234361f8b2aca6d6e78fcd136da6d3a70048b5e92c62bb")
license=("CDDL") license=("CDDL")
depends=("zfs-utils=${pkgver}" "lsb-release" "dkms") depends=("zfs-utils=${pkgver}" "lsb-release" "dkms")
provides=("zfs" "zfs-headers" "spl" "spl-headers") provides=("zfs" "zfs-headers" "spl" "spl-headers")
groups=("archzfs-dkms") groups=("archzfs-dkms")
conflicts=("zfs" "zfs-headers" "spl" "spl-headers") conflicts=("zfs" "zfs-headers" "spl" "spl-headers")
replaces=("spl-dkms") replaces=("spl-dkms")
prepare() {
cd "${srcdir}/zfs-${pkgver}"
patch -Np1 -i ${srcdir}/linux-5.5-compat-blkg_tryget.patch
patch -Np1 -i ${srcdir}/linux-5.6-compat-struct-proc_ops.patch
patch -Np1 -i ${srcdir}/linux-5.6-compat-timestamp_truncate.patch
patch -Np1 -i ${srcdir}/linux-5.6-compat-time_t.patch
patch -Np1 -i ${srcdir}/linux-5.6-compat-ktime_get_raw_ts64.patch
}
build() { build() {
cd "${srcdir}/zfs-${pkgver}" cd "${srcdir}/zfs-${pkgver}"

@ -1,136 +0,0 @@
From 2fcab8795c7c493845bfa277d44bc443802000b8 Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Fri, 28 Feb 2020 08:58:39 -0800
Subject: [PATCH] Linux 5.5 compat: blkg_tryget()
Commit https://github.com/torvalds/linux/commit/9e8d42a0f accidentally
converted the static inline function blkg_tryget() to GPL-only for
kernels built with CONFIG_PREEMPT_RCU=y and CONFIG_BLK_CGROUP=y.
Resolve the build issue by providing our own equivalent functionality
when needed which uses rcu_read_lock_sched() internally as before.
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9745
Closes #10072
---
config/kernel-blkg-tryget.m4 | 37 ++++++++++++++++++++++++++++++++++++
config/kernel.m4 | 2 ++
module/zfs/vdev_disk.c | 32 ++++++++++++++++++++++++++++++-
3 files changed, 70 insertions(+), 1 deletion(-)
create mode 100644 config/kernel-blkg-tryget.m4
diff --git a/config/kernel-blkg-tryget.m4 b/config/kernel-blkg-tryget.m4
new file mode 100644
index 00000000000..fb831ca3b3e
--- /dev/null
+++ b/config/kernel-blkg-tryget.m4
@@ -0,0 +1,37 @@
+dnl #
+dnl # Linux 5.5 API,
+dnl #
+dnl # The Linux 5.5 kernel updated percpu_ref_tryget() which is inlined by
+dnl # blkg_tryget() to use rcu_read_lock() instead of rcu_read_lock_sched().
+dnl # As a side effect the function was converted to GPL-only.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKG_TRYGET], [
+ ZFS_LINUX_TEST_SRC([blkg_tryget], [
+ #include <linux/blk-cgroup.h>
+ #include <linux/bio.h>
+ #include <linux/fs.h>
+ ],[
+ struct blkcg_gq blkg __attribute__ ((unused));
+ bool rc __attribute__ ((unused));
+ rc = blkg_tryget(&blkg);
+ ], [], [$ZFS_META_LICENSE])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [
+ AC_MSG_CHECKING([whether blkg_tryget() is available])
+ ZFS_LINUX_TEST_RESULT([blkg_tryget], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BLKG_TRYGET, 1, [blkg_tryget() is available])
+
+ AC_MSG_CHECKING([whether blkg_tryget() is GPL-only])
+ ZFS_LINUX_TEST_RESULT([blkg_tryget_license], [
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BLKG_TRYGET_GPL_ONLY, 1,
+ [blkg_tryget() GPL-only])
+ ])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index dce619729d4..bea6f9b1bbf 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -70,6 +70,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_BIO_BI_STATUS
ZFS_AC_KERNEL_SRC_BIO_RW_BARRIER
ZFS_AC_KERNEL_SRC_BIO_RW_DISCARD
+ ZFS_AC_KERNEL_SRC_BLKG_TRYGET
ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI
ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD
ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
@@ -186,6 +187,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_BIO_BI_STATUS
ZFS_AC_KERNEL_BIO_RW_BARRIER
ZFS_AC_KERNEL_BIO_RW_DISCARD
+ ZFS_AC_KERNEL_BLKG_TRYGET
ZFS_AC_KERNEL_BLK_QUEUE_BDI
ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
index 661f0f1b727..8544bb8ffb6 100644
--- a/module/zfs/vdev_disk.c
+++ b/module/zfs/vdev_disk.c
@@ -473,6 +473,36 @@ vdev_submit_bio_impl(struct bio *bio)
#ifdef HAVE_BIO_SET_DEV
#if defined(CONFIG_BLK_CGROUP) && defined(HAVE_BIO_SET_DEV_GPL_ONLY)
+/*
+ * The Linux 5.5 kernel updated percpu_ref_tryget() which is inlined by
+ * blkg_tryget() to use rcu_read_lock() instead of rcu_read_lock_sched().
+ * As a side effect the function was converted to GPL-only. Define our
+ * own version when needed which uses rcu_read_lock_sched().
+ */
+#if defined(HAVE_BLKG_TRYGET_GPL_ONLY)
+static inline bool
+vdev_blkg_tryget(struct blkcg_gq *blkg)
+{
+ struct percpu_ref *ref = &blkg->refcnt;
+ unsigned long __percpu *count;
+ bool rc;
+
+ rcu_read_lock_sched();
+
+ if (__ref_is_percpu(ref, &count)) {
+ this_cpu_inc(*count);
+ rc = true;
+ } else {
+ rc = atomic_long_inc_not_zero(&ref->count);
+ }
+
+ rcu_read_unlock_sched();
+
+ return (rc);
+}
+#elif defined(HAVE_BLKG_TRYGET)
+#define vdev_blkg_tryget(bg) blkg_tryget(bg)
+#endif
/*
* The Linux 5.0 kernel updated the bio_set_dev() macro so it calls the
* GPL-only bio_associate_blkg() symbol thus inadvertently converting
@@ -487,7 +517,7 @@ vdev_bio_associate_blkg(struct bio *bio)
ASSERT3P(q, !=, NULL);
ASSERT3P(bio->bi_blkg, ==, NULL);
- if (q->root_blkg && blkg_tryget(q->root_blkg))
+ if (q->root_blkg && vdev_blkg_tryget(q->root_blkg))
bio->bi_blkg = q->root_blkg;
}
#define bio_associate_blkg vdev_bio_associate_blkg

@ -1,129 +0,0 @@
diff --git a/config/kernel-ktime.m4 b/config/kernel-ktime.m4
new file mode 100644
index 00000000000..64c3b5f9032
--- /dev/null
+++ b/config/kernel-ktime.m4
@@ -0,0 +1,55 @@
+dnl #
+dnl # 4.18: ktime_get_coarse_real_ts64() replaces current_kernel_time64().
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_KTIME_GET_COARSE_REAL_TS64], [
+ ZFS_LINUX_TEST_SRC([ktime_get_coarse_real_ts64], [
+ #include <linux/mm.h>
+ ], [
+ struct timespec64 ts;
+ ktime_get_coarse_real_ts64(&ts);
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64], [
+ AC_MSG_CHECKING([whether ktime_get_coarse_real_ts64() exists])
+ ZFS_LINUX_TEST_RESULT([ktime_get_coarse_real_ts64], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KTIME_GET_COARSE_REAL_TS64, 1,
+ [ktime_get_coarse_real_ts64() exists])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+])
+
+dnl #
+dnl # 4.18: ktime_get_raw_ts64() replaces getrawmonotonic64().
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_KTIME_GET_RAW_TS64], [
+ ZFS_LINUX_TEST_SRC([ktime_get_raw_ts64], [
+ #include <linux/mm.h>
+ ], [
+ struct timespec64 ts;
+ ktime_get_raw_ts64(&ts);
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_KTIME_GET_RAW_TS64], [
+ AC_MSG_CHECKING([whether ktime_get_raw_ts64() exists])
+ ZFS_LINUX_TEST_RESULT([ktime_get_raw_ts64], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KTIME_GET_RAW_TS64, 1,
+ [ktime_get_raw_ts64() exists])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_SRC_KTIME], [
+ ZFS_AC_KERNEL_SRC_KTIME_GET_COARSE_REAL_TS64
+ ZFS_AC_KERNEL_SRC_KTIME_GET_RAW_TS64
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_KTIME], [
+ ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64
+ ZFS_AC_KERNEL_KTIME_GET_RAW_TS64
+])
diff --git a/config/kernel-ktime_get_coarse_real_ts64.m4 b/config/kernel-ktime_get_coarse_real_ts64.m4
deleted file mode 100644
index 28492bf04bc..00000000000
--- a/config/kernel-ktime_get_coarse_real_ts64.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-dnl #
-dnl # 4.18: ktime_get_coarse_real_ts64() added. Use it in place of
-dnl # current_kernel_time64().
-dnl #
-AC_DEFUN([ZFS_AC_KERNEL_SRC_KTIME_GET_COARSE_REAL_TS64], [
- ZFS_LINUX_TEST_SRC([ktime_get_coarse_real_ts64], [
- #include <linux/mm.h>
- ], [
- struct timespec64 ts;
- ktime_get_coarse_real_ts64(&ts);
- ])
-])
-
-AC_DEFUN([ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64], [
- AC_MSG_CHECKING([whether ktime_get_coarse_real_ts64() exists])
- ZFS_LINUX_TEST_RESULT([ktime_get_coarse_real_ts64], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_KTIME_GET_COARSE_REAL_TS64, 1,
- [ktime_get_coarse_real_ts64() exists])
- ], [
- AC_MSG_RESULT(no)
- ])
-])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 780de331800..994865fdba1 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -137,7 +137,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_CURRENT_TIME
ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES
ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL
- ZFS_AC_KERNEL_SRC_KTIME_GET_COARSE_REAL_TS64
+ ZFS_AC_KERNEL_SRC_KTIME
ZFS_AC_KERNEL_SRC_TOTALRAM_PAGES_FUNC
ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES
ZFS_AC_KERNEL_SRC_KSTRTOUL
@@ -254,7 +254,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_CURRENT_TIME
ZFS_AC_KERNEL_USERNS_CAPABILITIES
ZFS_AC_KERNEL_IN_COMPAT_SYSCALL
- ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64
+ ZFS_AC_KERNEL_KTIME
ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC
ZFS_AC_KERNEL_TOTALHIGH_PAGES
ZFS_AC_KERNEL_KSTRTOUL
diff --git a/include/spl/sys/time.h b/include/spl/sys/time.h
index 24c1ec7c7ae..4309c300b26 100644
--- a/include/spl/sys/time.h
+++ b/include/spl/sys/time.h
@@ -105,8 +105,13 @@ gethrestime_sec(void)
static inline hrtime_t
gethrtime(void)
{
+#if defined(HAVE_KTIME_GET_RAW_TS64)
+ struct timespec64 ts;
+ ktime_get_raw_ts64(&ts);
+#else
struct timespec ts;
getrawmonotonic(&ts);
+#endif
return (((hrtime_t)ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec);
}

@ -1,226 +0,0 @@
diff --git a/config/kernel-proc-operations.m4 b/config/kernel-proc-operations.m4
new file mode 100644
index 00000000000..df216222ecc
--- /dev/null
+++ b/config/kernel-proc-operations.m4
@@ -0,0 +1,41 @@
+dnl #
+dnl # 5.6 API Change
+dnl # The proc_ops structure was introduced to replace the use of
+dnl # of the file_operations structure when registering proc handlers.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_PROC_OPERATIONS], [
+ ZFS_LINUX_TEST_SRC([proc_ops_struct], [
+ #include <linux/proc_fs.h>
+
+ int test_open(struct inode *ip, struct file *fp) { return 0; }
+ ssize_t test_read(struct file *fp, char __user *ptr,
+ size_t size, loff_t *offp) { return 0; }
+ ssize_t test_write(struct file *fp, const char __user *ptr,
+ size_t size, loff_t *offp) { return 0; }
+ loff_t test_lseek(struct file *fp, loff_t off, int flag)
+ { return 0; }
+ int test_release(struct inode *ip, struct file *fp)
+ { return 0; }
+
+ const struct proc_ops test_ops __attribute__ ((unused)) = {
+ .proc_open = test_open,
+ .proc_read = test_read,
+ .proc_write = test_write,
+ .proc_lseek = test_lseek,
+ .proc_release = test_release,
+ };
+ ], [
+ struct proc_dir_entry *entry __attribute__ ((unused)) =
+ proc_create_data("test", 0444, NULL, &test_ops, NULL);
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_PROC_OPERATIONS], [
+ AC_MSG_CHECKING([whether proc_ops structure exists])
+ ZFS_LINUX_TEST_RESULT([proc_ops_struct], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PROC_OPS_STRUCT, 1, [proc_ops structure exists])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index dce619729d4..780de331800 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -54,6 +54,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_CURRENT_BIO_TAIL
ZFS_AC_KERNEL_SRC_SUPER_USER_NS
ZFS_AC_KERNEL_SRC_SUBMIT_BIO
+ ZFS_AC_KERNEL_SRC_PROC_OPERATIONS
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS
ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH
ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART
@@ -170,6 +171,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_CURRENT_BIO_TAIL
ZFS_AC_KERNEL_SUPER_USER_NS
ZFS_AC_KERNEL_SUBMIT_BIO
+ ZFS_AC_KERNEL_PROC_OPERATIONS
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS
ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
ZFS_AC_KERNEL_BLKDEV_REREAD_PART
diff --git a/include/spl/sys/kstat.h b/include/spl/sys/kstat.h
index 3ce47424887..c93c53171d8 100644
--- a/include/spl/sys/kstat.h
+++ b/include/spl/sys/kstat.h
@@ -152,6 +152,12 @@ typedef struct kstat_named_s {
#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr)
#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len)
+#ifdef HAVE_PROC_OPS_STRUCT
+typedef struct proc_ops kstat_proc_op_t;
+#else
+typedef struct file_operations kstat_proc_op_t;
+#endif
+
typedef struct kstat_intr {
uint_t intrs[KSTAT_NUM_INTRS];
} kstat_intr_t;
@@ -197,7 +203,7 @@ extern void kstat_proc_entry_init(kstat_proc_entry_t *kpep,
const char *module, const char *name);
extern void kstat_proc_entry_delete(kstat_proc_entry_t *kpep);
extern void kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
- const struct file_operations *file_ops, void *data);
+ const kstat_proc_op_t *file_ops, void *data);
extern void __kstat_install(kstat_t *ksp);
extern void __kstat_delete(kstat_t *ksp);
diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
index c97b6d6cbcb..c54378acec5 100644
--- a/module/spl/spl-kstat.c
+++ b/module/spl/spl-kstat.c
@@ -507,12 +507,20 @@ proc_kstat_write(struct file *filp, const char __user *buf, size_t len,
return (len);
}
-static struct file_operations proc_kstat_operations = {
+static const kstat_proc_op_t proc_kstat_operations = {
+#ifdef HAVE_PROC_OPS_STRUCT
+ .proc_open = proc_kstat_open,
+ .proc_write = proc_kstat_write,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
+#else
.open = proc_kstat_open,
.write = proc_kstat_write,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
+#endif
};
void
@@ -656,7 +664,7 @@ kstat_detect_collision(kstat_proc_entry_t *kpep)
*/
void
kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
- const struct file_operations *file_ops, void *data)
+ const kstat_proc_op_t *proc_ops, void *data)
{
kstat_module_t *module;
kstat_proc_entry_t *tmp = NULL;
@@ -690,7 +698,7 @@ kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
kpep->kpe_owner = module;
kpep->kpe_proc = proc_create_data(kpep->kpe_name, mode,
- module->ksm_proc, file_ops, data);
+ module->ksm_proc, proc_ops, data);
if (kpep->kpe_proc == NULL) {
list_del_init(&kpep->kpe_list);
if (list_empty(&module->ksm_kstat_list))
diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c
index c0c13913cdf..40315ede317 100644
--- a/module/spl/spl-proc.c
+++ b/module/spl/spl-proc.c
@@ -532,11 +532,18 @@ proc_slab_open(struct inode *inode, struct file *filp)
return (seq_open(filp, &slab_seq_ops));
}
-static struct file_operations proc_slab_operations = {
- .open = proc_slab_open,
- .read = seq_read,
- .llseek = seq_lseek,
+static const kstat_proc_op_t proc_slab_operations = {
+#ifdef HAVE_PROC_OPS_STRUCT
+ .proc_open = proc_slab_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
+#else
+ .open = proc_slab_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
.release = seq_release,
+#endif
};
static void
@@ -571,18 +578,32 @@ proc_taskq_open(struct inode *inode, struct file *filp)
return (seq_open(filp, &taskq_seq_ops));
}
-static struct file_operations proc_taskq_all_operations = {
+static const kstat_proc_op_t proc_taskq_all_operations = {
+#ifdef HAVE_PROC_OPS_STRUCT
+ .proc_open = proc_taskq_all_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
+#else
.open = proc_taskq_all_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
+#endif
};
-static struct file_operations proc_taskq_operations = {
+static const kstat_proc_op_t proc_taskq_operations = {
+#ifdef HAVE_PROC_OPS_STRUCT
+ .proc_open = proc_taskq_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
+#else
.open = proc_taskq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
+#endif
};
static struct ctl_table spl_kmem_table[] = {
diff --git a/module/spl/spl-procfs-list.c b/module/spl/spl-procfs-list.c
index f6a00da5c91..189d6a7c608 100644
--- a/module/spl/spl-procfs-list.c
+++ b/module/spl/spl-procfs-list.c
@@ -185,13 +185,20 @@ procfs_list_write(struct file *filp, const char __user *buf, size_t len,
return (len);
}
-static struct file_operations procfs_list_operations = {
- .owner = THIS_MODULE,
+static const kstat_proc_op_t procfs_list_operations = {
+#ifdef HAVE_PROC_OPS_STRUCT
+ .proc_open = procfs_list_open,
+ .proc_write = procfs_list_write,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release_private,
+#else
.open = procfs_list_open,
.write = procfs_list_write,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_private,
+#endif
};
/*

@ -1,87 +0,0 @@
diff --git a/include/spl/sys/time.h b/include/spl/sys/time.h
index 312415b7bc8..24c1ec7c7ae 100644
--- a/include/spl/sys/time.h
+++ b/include/spl/sys/time.h
@@ -85,7 +85,7 @@ gethrestime(inode_timespec_t *ts)
#endif
}
-static inline time_t
+static inline uint64_t
gethrestime_sec(void)
{
#if defined(HAVE_INODE_TIMESPEC64_TIMES)
diff --git a/include/sys/vdev_impl.h b/include/sys/vdev_impl.h
index f6f7bbb4b28..090ba3fbc87 100644
--- a/include/sys/vdev_impl.h
+++ b/include/sys/vdev_impl.h
@@ -274,7 +274,7 @@ struct vdev {
range_tree_t *vdev_initialize_tree; /* valid while initializing */
uint64_t vdev_initialize_bytes_est;
uint64_t vdev_initialize_bytes_done;
- time_t vdev_initialize_action_time; /* start and end time */
+ uint64_t vdev_initialize_action_time; /* start and end time */
/* TRIM related */
boolean_t vdev_trim_exit_wanted;
@@ -295,7 +295,7 @@ struct vdev {
uint64_t vdev_trim_rate; /* requested rate (bytes/sec) */
uint64_t vdev_trim_partial; /* requested partial TRIM */
uint64_t vdev_trim_secure; /* requested secure TRIM */
- time_t vdev_trim_action_time; /* start and end time */
+ uint64_t vdev_trim_action_time; /* start and end time */
/* for limiting outstanding I/Os (initialize and TRIM) */
kmutex_t vdev_initialize_io_lock;
diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h
index 291f2190a28..c9f6165047d 100644
--- a/lib/libspl/include/sys/time.h
+++ b/lib/libspl/include/sys/time.h
@@ -88,7 +88,7 @@ gethrestime(inode_timespec_t *ts)
ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
}
-static inline time_t
+static inline uint64_t
gethrestime_sec(void)
{
struct timeval tv;
diff --git a/module/zfs/vdev_initialize.c b/module/zfs/vdev_initialize.c
index 9958a295832..8a3635969e1 100644
--- a/module/zfs/vdev_initialize.c
+++ b/module/zfs/vdev_initialize.c
@@ -700,7 +700,7 @@ vdev_initialize_restart(vdev_t *vd)
vd->vdev_leaf_zap, VDEV_LEAF_ZAP_INITIALIZE_ACTION_TIME,
sizeof (timestamp), 1, &timestamp);
ASSERT(err == 0 || err == ENOENT);
- vd->vdev_initialize_action_time = (time_t)timestamp;
+ vd->vdev_initialize_action_time = timestamp;
if (vd->vdev_initialize_state == VDEV_INITIALIZE_SUSPENDED ||
vd->vdev_offline) {
diff --git a/module/zfs/vdev_trim.c b/module/zfs/vdev_trim.c
index 5ad47cccdaf..b7548fc4c18 100644
--- a/module/zfs/vdev_trim.c
+++ b/module/zfs/vdev_trim.c
@@ -1046,7 +1046,7 @@ vdev_trim_restart(vdev_t *vd)
vd->vdev_leaf_zap, VDEV_LEAF_ZAP_TRIM_ACTION_TIME,
sizeof (timestamp), 1, &timestamp);
ASSERT(err == 0 || err == ENOENT);
- vd->vdev_trim_action_time = (time_t)timestamp;
+ vd->vdev_trim_action_time = timestamp;
if (vd->vdev_trim_state == VDEV_TRIM_SUSPENDED ||
vd->vdev_offline) {
diff --git a/module/zfs/zfs_debug.c b/module/zfs/zfs_debug.c
index 538533d27d2..cf8bbb3ce4f 100644
--- a/module/zfs/zfs_debug.c
+++ b/module/zfs/zfs_debug.c
@@ -27,7 +27,7 @@
typedef struct zfs_dbgmsg {
procfs_list_node_t zdm_node;
- time_t zdm_timestamp;
+ uint64_t zdm_timestamp;
int zdm_size;
char zdm_msg[1]; /* variable length allocation */
} zfs_dbgmsg_t;

@ -1,115 +0,0 @@
diff --git a/config/kernel-inode-times.m4 b/config/kernel-inode-times.m4
index 57e7f31fdcb..8a79c299e1a 100644
--- a/config/kernel-inode-times.m4
+++ b/config/kernel-inode-times.m4
@@ -1,8 +1,22 @@
-dnl #
-dnl # 4.18 API change
-dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64.
-dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_TIMES], [
+
+ dnl #
+ dnl # 5.6 API change
+ dnl # timespec64_trunc() replaced by timestamp_truncate() interface.
+ dnl #
+ ZFS_LINUX_TEST_SRC([timestamp_truncate], [
+ #include <linux/fs.h>
+ ],[
+ struct timespec64 ts;
+ struct inode ip;
+
+ ts = timestamp_truncate(ts, &ip);
+ ])
+
+ dnl #
+ dnl # 4.18 API change
+ dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64.
+ dnl #
ZFS_LINUX_TEST_SRC([inode_times], [
#include <linux/fs.h>
],[
@@ -15,6 +29,15 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_TIMES], [
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
+ AC_MSG_CHECKING([whether timestamp_truncate() exists])
+ ZFS_LINUX_TEST_RESULT([timestamp_truncate], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_INODE_TIMESTAMP_TRUNCATE, 1,
+ [timestamp_truncate() exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
AC_MSG_CHECKING([whether inode->i_*time's are timespec64])
ZFS_LINUX_TEST_RESULT([inode_times], [
AC_MSG_RESULT(no)
diff --git a/include/sys/zpl.h b/include/sys/zpl.h
index 2766269f31c..f88ccd5400a 100644
--- a/include/sys/zpl.h
+++ b/include/sys/zpl.h
@@ -188,13 +188,14 @@ zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
}
#endif /* HAVE_VFS_ITERATE */
-/*
- * Linux 4.18, inode times converted from timespec to timespec64.
- */
-#if defined(HAVE_INODE_TIMESPEC64_TIMES)
-#define zpl_inode_timespec_trunc(ts, gran) timespec64_trunc(ts, gran)
+#if defined(HAVE_INODE_TIMESTAMP_TRUNCATE)
+#define zpl_inode_timestamp_truncate(ts, ip) timestamp_truncate(ts, ip)
+#elif defined(HAVE_INODE_TIMESPEC64_TIMES)
+#define zpl_inode_timestamp_truncate(ts, ip) \
+ timespec64_trunc(ts, (ip)->i_sb->s_time_gran)
#else
-#define zpl_inode_timespec_trunc(ts, gran) timespec_trunc(ts, gran)
+#define zpl_inode_timestamp_truncate(ts, ip) \
+ timespec_trunc(ts, (ip)->i_sb->s_time_gran)
#endif
#endif /* _SYS_ZPL_H */
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 03a8c4a50b0..c322edf6ad9 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -3415,8 +3415,8 @@ zfs_setattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
if (mask & (ATTR_MTIME | ATTR_SIZE)) {
ZFS_TIME_ENCODE(&vap->va_mtime, mtime);
- ZTOI(zp)->i_mtime = zpl_inode_timespec_trunc(vap->va_mtime,
- ZTOI(zp)->i_sb->s_time_gran);
+ ZTOI(zp)->i_mtime = zpl_inode_timestamp_truncate(
+ vap->va_mtime, ZTOI(zp));
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL,
mtime, sizeof (mtime));
@@ -3424,8 +3424,8 @@ zfs_setattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
if (mask & (ATTR_CTIME | ATTR_SIZE)) {
ZFS_TIME_ENCODE(&vap->va_ctime, ctime);
- ZTOI(zp)->i_ctime = zpl_inode_timespec_trunc(vap->va_ctime,
- ZTOI(zp)->i_sb->s_time_gran);
+ ZTOI(zp)->i_ctime = zpl_inode_timestamp_truncate(vap->va_ctime,
+ ZTOI(zp));
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL,
ctime, sizeof (ctime));
}
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
index 5660f8b0e56..1f228dcf822 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/zfs/zpl_inode.c
@@ -390,10 +390,8 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
vap->va_mtime = ia->ia_mtime;
vap->va_ctime = ia->ia_ctime;
- if (vap->va_mask & ATTR_ATIME) {
- ip->i_atime = zpl_inode_timespec_trunc(ia->ia_atime,
- ip->i_sb->s_time_gran);
- }
+ if (vap->va_mask & ATTR_ATIME)
+ ip->i_atime = zpl_inode_timestamp_truncate(ia->ia_atime, ip);
cookie = spl_fstrans_mark();
error = -zfs_setattr(ip, vap, 0, cr);
Loading…
Cancel
Save