This commit is contained in:
Nathan 2022-10-12 14:09:51 -05:00
parent 11cf41df16
commit e6c342ac2d
11 changed files with 1 additions and 1196 deletions

View File

@ -4,7 +4,7 @@
# Contributor: Iacopo Isimbaldi <isiachi@rhye.it>
pkgname=zfs-dkms-git
pkgver=2.1.99.r1445.g2ba240f358
pkgver=2.1.99.r1452.ga6ccb36b94
pkgrel=1
pkgdesc='Kernel modules for the Zettabyte File System.'
arch=('x86_64')

View File

@ -1,28 +0,0 @@
pkgbase = zfs-dkms
pkgdesc = Kernel modules for the Zettabyte File System.
pkgver = 2.1.6
pkgrel = 1
url = https://zfsonlinux.org/
arch = any
license = CDDL
provides = ZFS-MODULE=2.1.6
provides = SPL-MODULE=2.1.6
provides = spl-dkms
provides = zfs
conflicts = spl-dkms
replaces = spl-dkms
source = https://github.com/zfsonlinux/zfs/releases/download/zfs-2.1.6/zfs-2.1.6.tar.gz
source = https://github.com/zfsonlinux/zfs/releases/download/zfs-2.1.6/zfs-2.1.6.tar.gz.asc
source = 0001-only-build-the-module-in-dkms.conf.patch
validpgpkeys = 4F3BA9AB6D1F8D683DC2DFB56AD860EED4598027
validpgpkeys = C33DF142657ED1F7C328A2960AB9E991C6AF658B
sha256sums = 15339014f8d2131348eb937bf8893849806b6d2645ea607a18c7f117749dbd7a
sha256sums = SKIP
sha256sums = 8d5c31f883a906ab42776dcda79b6c89f904d8f356ade0dab5491578a6af55a5
b2sums = 615fe7a2128af77c6c855ea52b6503a78f0c992ea845b02875ac19aa9dd155c5d4110b668da91c463f96a54767ab92e67e5303572337352484c055c0a0ff9e46
b2sums = SKIP
b2sums = 58dc2494e71b50833d44c126b72acad52e9817626542afbc245b7ba82009e8c8252ebde6023592aac42d9942207e7655c0a421da9067fbdd619746ebc372d791
pkgname = zfs-dkms
depends = zfs-utils=2.1.6
depends = dkms

7
zfs-dkms/.gitignore vendored
View File

@ -1,7 +0,0 @@
!.gitignore
/src
/pkg
*.pkg*
*.orig
zfs-*.tar.gz

View File

@ -1,65 +0,0 @@
From ac0fbbfdf3d686130985615184bc25470dcd8c13 Mon Sep 17 00:00:00 2001
From: Dominic Pearson <dsp@technoanimal.net>
Date: Tue, 20 Aug 2019 00:22:52 +0200
Subject: [PATCH] Linux 5.3 compat: Makefile subdir-m no longer supported
Uses obj-m instead, due to kernel changes.
See LKML: Masahiro Yamada, Tue, 6 Aug 2019 19:03:23 +0900
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Dominic Pearson <dsp@technoanimal.net>
Closes #9169
(cherry picked from commit 70f67bdbbf5f0e8e099f19db7550cb6e444cb0f8)
[Eli Schwartz: removed undesirable patch hunk for .gitignore, rebased
without 8f12a4f8d2846ca668f8ad90d9ea5c19c8c0b78f conflicts]
---
module/Makefile.in | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/module/Makefile.in b/module/Makefile.in
index 935bd2663..168bc5a1b 100644
--- a/module/Makefile.in
+++ b/module/Makefile.in
@@ -1,11 +1,11 @@
-subdir-m += avl
-subdir-m += icp
-subdir-m += lua
-subdir-m += nvpair
-subdir-m += spl
-subdir-m += unicode
-subdir-m += zcommon
-subdir-m += zfs
+obj-m += avl/
+obj-m += icp/
+obj-m += lua/
+obj-m += nvpair/
+obj-m += spl/
+obj-m += unicode/
+obj-m += zcommon/
+obj-m += zfs/
INSTALL_MOD_DIR ?= extra
@@ -60,13 +60,13 @@ modules_install:
modules_uninstall:
@# Uninstall the kernel modules
kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@
- list='$(subdir-m)'; for subdir in $$list; do \
- $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$subdir; \
+ list='$(obj-m)'; for objdir in $$list; do \
+ $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \
done
distdir:
- list='$(subdir-m)'; for subdir in $$list; do \
- (cd @top_srcdir@/module && find $$subdir -name '*.c' -o -name '*.h' -o -name '*.S' |\
+ list='$(obj-m)'; for objdir in $$list; do \
+ (cd @top_srcdir@/module && find $$objdir -name '*.c' -o -name '*.h' -o -name '*.S' |\
xargs cp --parents -t $$distdir); \
done
--
2.23.0

View File

@ -1,41 +0,0 @@
From b4a2c0b184c9c9599421b15a430fb88deb5dbd17 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@archlinux.org>
Date: Sun, 28 Oct 2018 15:01:58 -0400
Subject: [PATCH] only build the module in dkms.conf
---
scripts/dkms.mkconf | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/scripts/dkms.mkconf b/scripts/dkms.mkconf
index 88c289383..5a859a0e0 100755
--- a/scripts/dkms.mkconf
+++ b/scripts/dkms.mkconf
@@ -28,14 +28,7 @@ PACKAGE_CONFIG="${pkgcfg}"
PRE_BUILD="configure
--prefix=/usr
--with-config=kernel
- --with-linux=\$(
- if [ -e "\${kernel_source_dir/%build/source}" ]
- then
- echo "\${kernel_source_dir/%build/source}"
- else
- echo "\${kernel_source_dir}"
- fi
- )
+ --with-linux="\${kernel_source_dir}"
--with-linux-obj="\${kernel_source_dir}"
\$(
[[ -n \"\${ICP_ROOT}\" ]] && \\
@@ -68,7 +53,7 @@ POST_BUILD="scripts/dkms.postbuild
-t \${dkms_tree}
"
AUTOINSTALL="yes"
-MAKE[0]="make"
+MAKE[0]="make -C module/"
STRIP[0]="\$(
[[ -r \${PACKAGE_CONFIG} ]] \\
&& source \${PACKAGE_CONFIG} \\
--
2.19.1

View File

@ -1,676 +0,0 @@
From 02906709cd4d17ab06b5ef48796531838dce4e0c Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Thu, 6 Feb 2020 10:30:41 -0800
Subject: [PATCH 1/4] Linux 5.6 compat: struct proc_ops
The proc_ops structure was introduced to replace the use of of the
file_operations structure when registering proc handlers. This
change creates a new kstat_proc_op_t typedef for compatibility
which can be used to pass around the correct structure.
This change additionally adds the 'const' keyword to all of the
existing proc operations structures.
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9961
(cherry picked from commit 0dd73648532e8654e07c28bba6c80bfb779a4938)
---
config/kernel-proc-operations.m4 | 41 ++++++++++++++++++++++++++++++++
config/kernel.m4 | 2 ++
include/spl/sys/kstat.h | 8 ++++++-
module/spl/spl-kstat.c | 14 ++++++++---
module/spl/spl-proc.c | 33 ++++++++++++++++++++-----
module/spl/spl-procfs-list.c | 11 +++++++--
6 files changed, 97 insertions(+), 12 deletions(-)
create mode 100644 config/kernel-proc-operations.m4
diff --git a/config/kernel-proc-operations.m4 b/config/kernel-proc-operations.m4
new file mode 100644
index 000000000..df216222e
--- /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 dce619729..3a5409b07 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
@@ -169,6 +170,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_TIMER_SETUP
ZFS_AC_KERNEL_CURRENT_BIO_TAIL
ZFS_AC_KERNEL_SUPER_USER_NS
+ ZFS_AC_KERNEL_PROC_OPERATIONS
ZFS_AC_KERNEL_SUBMIT_BIO
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS
ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
diff --git a/include/spl/sys/kstat.h b/include/spl/sys/kstat.h
index 3ce474248..c93c53171 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 c97b6d6cb..c54378ace 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 c0c13913c..40315ede3 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 f6a00da5c..189d6a7c6 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
};
/*
--
2.26.0
From 7a1b4338ec69e01acf2f1eaee617646621c72c81 Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Thu, 6 Feb 2020 12:37:25 -0800
Subject: [PATCH 2/4] Linux 5.6 compat: timestamp_truncate()
The timestamp_truncate() function was added, it replaces the existing
timespec64_trunc() function. This change renames our wrapper function
to be consistent with the upstream name and updates the compatibility
code for older kernels accordingly.
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9956
Closes #9961
(cherry picked from commit 795699a6cc28b8f1059397e03d1a86d576bfc7dc)
---
config/kernel-inode-times.m4 | 31 +++++++++++++++++++++++++++----
include/sys/zpl.h | 13 +++++++------
module/zfs/zfs_vnops.c | 8 ++++----
module/zfs/zpl_inode.c | 6 ++----
4 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/config/kernel-inode-times.m4 b/config/kernel-inode-times.m4
index 57e7f31fd..8a79c299e 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 2766269f3..f88ccd540 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 03a8c4a50..c322edf6a 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -3415,8 +3415,8 @@ top:
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 @@ top:
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 5660f8b0e..1f228dcf8 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);
--
2.26.0
From 3aed5107cd5645a373fc4c352693c9bf8f2bbd61 Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Wed, 26 Feb 2020 12:42:33 -0800
Subject: [PATCH 3/4] Linux 5.6 compat: ktime_get_raw_ts64()
The getrawmonotonic() and getrawmonotonic64() interfaces have been
fully retired. Update gethrtime() to use the replacement interface
ktime_get_raw_ts64() which was introduced in the 4.18 kernel.
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #10052
Closes #10064
(cherry picked from commit ff5587d651371ab496f7962e85fe2c337fdb8a59)
---
config/kernel-ktime.m4 | 55 +++++++++++++++++++++
config/kernel-ktime_get_coarse_real_ts64.m4 | 23 ---------
config/kernel.m4 | 4 +-
include/spl/sys/time.h | 5 ++
4 files changed, 62 insertions(+), 25 deletions(-)
create mode 100644 config/kernel-ktime.m4
delete mode 100644 config/kernel-ktime_get_coarse_real_ts64.m4
diff --git a/config/kernel-ktime.m4 b/config/kernel-ktime.m4
new file mode 100644
index 000000000..64c3b5f90
--- /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 28492bf04..000000000
--- 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 3a5409b07..383f92984 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 312415b7b..56fd725c0 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);
}
--
2.26.0
From 6f38b244502f763d6e20290397ccb29d628499fa Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Wed, 26 Feb 2020 13:18:07 -0800
Subject: [PATCH 4/4] Linux 5.6 compat: time_t
As part of the Linux kernel's y2038 changes the time_t type has been
fully retired. Callers are now required to use the time64_t type.
Rather than move to the new type, I've removed the few remaining
places where a time_t is used in the kernel code. They've been
replaced with a uint64_t which is already how ZFS internally
handled these values.
Going forward we should work towards updating the remaining user
space time_t consumers to the 64-bit interfaces.
Reviewed-by: Matthew Macy <mmacy@freebsd.org>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #10052
Closes #10064
(cherry picked from commit 2c3a83701dd185cadb30db4556256534e2930c7d)
---
include/spl/sys/time.h | 2 +-
include/sys/vdev_impl.h | 4 ++--
lib/libspl/include/sys/time.h | 2 +-
module/zfs/vdev_initialize.c | 2 +-
module/zfs/vdev_trim.c | 2 +-
module/zfs/zfs_debug.c | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/spl/sys/time.h b/include/spl/sys/time.h
index 56fd725c0..4309c300b 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 f6f7bbb4b..090ba3fbc 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 291f2190a..c9f616504 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 9958a2958..8a3635969 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 5ad47cccd..b7548fc4c 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 538533d27..cf8bbb3ce 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;
--
2.26.0

View File

@ -1,61 +0,0 @@
# Maintainer: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Iacopo Isimbaldi <isiachi@rhye.it>
# All my PKGBUILDs are managed at https://github.com/eli-schwartz/pkgbuilds
pkgname=zfs-dkms
pkgver=2.1.6
pkgrel=1
pkgdesc="Kernel modules for the Zettabyte File System."
arch=('any')
url="https://zfsonlinux.org/"
license=('CDDL')
conflicts=('spl-dkms')
provides=("ZFS-MODULE=${pkgver}" "SPL-MODULE=${pkgver}" 'spl-dkms')
# ambiguous, provided for backwards compat, pls don't use
provides+=('zfs')
replaces=('spl-dkms')
source=("https://github.com/zfsonlinux/zfs/releases/download/zfs-${pkgver}/zfs-${pkgver}.tar.gz"{,.asc}
"0001-only-build-the-module-in-dkms.conf.patch")
sha256sums=('15339014f8d2131348eb937bf8893849806b6d2645ea607a18c7f117749dbd7a'
'SKIP'
'8d5c31f883a906ab42776dcda79b6c89f904d8f356ade0dab5491578a6af55a5')
b2sums=('615fe7a2128af77c6c855ea52b6503a78f0c992ea845b02875ac19aa9dd155c5d4110b668da91c463f96a54767ab92e67e5303572337352484c055c0a0ff9e46'
'SKIP'
'58dc2494e71b50833d44c126b72acad52e9817626542afbc245b7ba82009e8c8252ebde6023592aac42d9942207e7655c0a421da9067fbdd619746ebc372d791')
validpgpkeys=('4F3BA9AB6D1F8D683DC2DFB56AD860EED4598027' # Tony Hutter (GPG key for signing ZFS releases) <hutter2@llnl.gov>
'C33DF142657ED1F7C328A2960AB9E991C6AF658B') # Brian Behlendorf <behlendorf1@llnl.gov>
prepare() {
cd "${srcdir}"/${pkgname%-dkms}-${pkgver}
patch -p1 -i ../0001-only-build-the-module-in-dkms.conf.patch
# remove unneeded sections from module build
sed -ri "/AC_CONFIG_FILES/,/]\)/{
/AC_CONFIG_FILES/n
/]\)/n
/^\s*(module\/.*|${pkgname%-dkms}.release|Makefile)/!d
}" configure.ac
autoreconf -fi
}
build() {
cd "${srcdir}"/${pkgname%-dkms}-${pkgver}
./scripts/dkms.mkconf -n ${pkgname%-dkms} -v ${pkgver} -f dkms.conf
./scripts/make_gitrev.sh include/zfs_gitrev.h
}
package() {
depends=("zfs-utils=${pkgver}" 'dkms')
cd "${srcdir}"/${pkgname%-dkms}-${pkgver}
dkmsdir="${pkgdir}/usr/src/${pkgname%-dkms}-${pkgver}"
install -d "${dkmsdir}"/{config,scripts}
cp -a configure dkms.conf Makefile.in META ${pkgname%-dkms}_config.h.in ${pkgname%-dkms}.release.in include/ module/ "${dkmsdir}"/
cp config/compile config/config.* config/missing config/*sh "${dkmsdir}"/config/
cp scripts/enum-extract.pl scripts/dkms.postbuild "${dkmsdir}"/scripts/
}

View File

@ -1,26 +0,0 @@
pkgbase = zfs-utils
pkgdesc = Userspace utilities for the Zettabyte File System.
pkgver = 2.1.6
pkgrel = 1
url = https://zfsonlinux.org/
arch = i686
arch = x86_64
arch = aarch64
license = CDDL
optdepends = python: for arcstat/arc_summary/dbufstat
source = https://github.com/zfsonlinux/zfs/releases/download/zfs-2.1.6/zfs-2.1.6.tar.gz
source = https://github.com/zfsonlinux/zfs/releases/download/zfs-2.1.6/zfs-2.1.6.tar.gz.asc
source = zfs.initcpio.install
source = zfs.initcpio.hook
validpgpkeys = 4F3BA9AB6D1F8D683DC2DFB56AD860EED4598027
validpgpkeys = C33DF142657ED1F7C328A2960AB9E991C6AF658B
sha256sums = 15339014f8d2131348eb937bf8893849806b6d2645ea607a18c7f117749dbd7a
sha256sums = SKIP
sha256sums = da1cdc045d144d2109ec7b5d97c53a69823759d8ecff410e47c3a66b69e6518d
sha256sums = 9c20256093997f7cfa9e7eb5d85d4a712d528a6ff19ef35b83ad03fb1ceae3bc
b2sums = 615fe7a2128af77c6c855ea52b6503a78f0c992ea845b02875ac19aa9dd155c5d4110b668da91c463f96a54767ab92e67e5303572337352484c055c0a0ff9e46
b2sums = SKIP
b2sums = 570e995bba07ea0fb424dff191180b8017b6469501964dc0b70fd51e338a4dad260f87cc313489866cbfd1583e4aac2522cf7309c067cc5314eb83c37fe14ff3
b2sums = e14366cbf680e3337d3d478fe759a09be224c963cc5207bee991805312afc49a49e6691f11e5b8bbe8dde60e8d855bd96e7f4f48f24a4c6d4a8c1bab7fc2bba0
pkgname = zfs-utils

View File

@ -1,70 +0,0 @@
# Maintainer: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Iacopo Isimbaldi <isiachi@rhye.it>
# All my PKGBUILDs are managed at https://github.com/eli-schwartz/pkgbuilds
pkgname=zfs-utils
pkgver=2.1.6
pkgrel=1
pkgdesc="Userspace utilities for the Zettabyte File System."
arch=("i686" "x86_64" "aarch64")
url="https://zfsonlinux.org/"
license=('CDDL')
optdepends=('python: for arcstat/arc_summary/dbufstat')
source=("https://github.com/zfsonlinux/zfs/releases/download/zfs-${pkgver}/zfs-${pkgver}.tar.gz"{,.asc}
"zfs.initcpio.install"
"zfs.initcpio.hook")
sha256sums=('15339014f8d2131348eb937bf8893849806b6d2645ea607a18c7f117749dbd7a'
'SKIP'
'da1cdc045d144d2109ec7b5d97c53a69823759d8ecff410e47c3a66b69e6518d'
'9c20256093997f7cfa9e7eb5d85d4a712d528a6ff19ef35b83ad03fb1ceae3bc')
b2sums=('615fe7a2128af77c6c855ea52b6503a78f0c992ea845b02875ac19aa9dd155c5d4110b668da91c463f96a54767ab92e67e5303572337352484c055c0a0ff9e46'
'SKIP'
'570e995bba07ea0fb424dff191180b8017b6469501964dc0b70fd51e338a4dad260f87cc313489866cbfd1583e4aac2522cf7309c067cc5314eb83c37fe14ff3'
'e14366cbf680e3337d3d478fe759a09be224c963cc5207bee991805312afc49a49e6691f11e5b8bbe8dde60e8d855bd96e7f4f48f24a4c6d4a8c1bab7fc2bba0')
validpgpkeys=('4F3BA9AB6D1F8D683DC2DFB56AD860EED4598027' # Tony Hutter (GPG key for signing ZFS releases) <hutter2@llnl.gov>
'C33DF142657ED1F7C328A2960AB9E991C6AF658B') # Brian Behlendorf <behlendorf1@llnl.gov>
prepare() {
cd "${srcdir}"/zfs-${pkgver}
# pyzfs is not built, but build system tries to check for python anyway
ln -sf /bin/true python3-fake
autoreconf -fi
}
build() {
cd "${srcdir}"/zfs-${pkgver}
./configure --prefix=/usr \
--sysconfdir=/etc \
--sbindir=/usr/bin \
--with-mounthelperdir=/usr/bin \
--with-udevdir=/usr/lib/udev \
--libexecdir=/usr/lib/zfs \
--with-python="$PWD/python3-fake" \
--enable-pyzfs=no \
--enable-systemd \
--with-config=user
make
}
package() {
cd "${srcdir}"/zfs-${pkgver}
make DESTDIR="${pkgdir}" install
install -D -m644 contrib/bash_completion.d/zfs "${pkgdir}"/usr/share/bash-completion/completions/zfs
# Remove uneeded files
rm -r "${pkgdir}"/etc/init.d
rm -r "${pkgdir}"/etc/sudoers.d #???
# We're experimenting with dracut in [extra], so start installing this.
#rm -r "${pkgdir}"/usr/lib/dracut
rm -r "${pkgdir}"/usr/lib/modules-load.d
rm -r "${pkgdir}"/usr/share/initramfs-tools
rm -r "${pkgdir}"/usr/share/zfs
install -D -m644 "${srcdir}"/zfs.initcpio.hook "${pkgdir}"/usr/lib/initcpio/hooks/zfs
install -D -m644 "${srcdir}"/zfs.initcpio.install "${pkgdir}"/usr/lib/initcpio/install/zfs
}

View File

@ -1,119 +0,0 @@
#
# WARNING: This script is parsed by ash in busybox at boot time, not bash!
# http://linux.die.net/man/1/ash
# https://wiki.ubuntu.com/DashAsBinSh
# http://www.jpsdomain.org/public/2008-JP_bash_vs_dash.pdf
#
ZPOOL_FORCE=""
ZPOOL_IMPORT_FLAGS=""
zfs_get_bootfs () {
for zfs_dataset in $(zpool list -H -o bootfs); do
case ${zfs_dataset} in
"" | "-")
# skip this line/dataset
;;
"no pools available")
return 1
;;
*)
ZFS_DATASET=${zfs_dataset}
return 0
;;
esac
done
return 1
}
zfs_mount_handler () {
if [ "${ZFS_DATASET}" = "bootfs" ] ; then
if ! zfs_get_bootfs ; then
# Lets import everything and try again
zpool import ${ZPOOL_IMPORT_FLAGS} -N -a ${ZPOOL_FORCE}
if ! zfs_get_bootfs ; then
die "ZFS: Cannot find bootfs."
fi
fi
fi
local pool="${ZFS_DATASET%%/*}"
local rwopt_exp="${rwopt:-ro}"
if ! zpool list -H "${pool}" >/dev/null 2>&1; then
if [ ! "${rwopt_exp}" = "rw" ]; then
msg "ZFS: Importing pool ${pool} readonly."
ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -o readonly=on"
else
msg "ZFS: Importing pool ${pool}."
fi
if ! zpool import ${ZPOOL_IMPORT_FLAGS} -N "${pool}" ${ZPOOL_FORCE} ; then
die "ZFS: Unable to import pool ${pool}."
fi
fi
local node="$1"
local tab_file="${node}/etc/fstab"
local zfs_datasets="$(zfs list -H -o name -t filesystem -r ${ZFS_DATASET})"
# Mount the root, and any child datasets
for dataset in ${zfs_datasets}; do
mountpoint=$(zfs get -H -o value mountpoint "${dataset}")
case ${mountpoint} in
"none")
# skip this line/dataset.
;;
"legacy")
if [ -f "${tab_file}" ]; then
if findmnt -snero source -F "${tab_file}" -S "${dataset}" > /dev/null 2>&1; then
opt=$(findmnt -snero options -F "${tab_file}" -S "${dataset}")
mnt=$(findmnt -snero target -F "${tab_file}" -S "${dataset}")
mount -t zfs -o "${opt}" "${dataset}" "${node}${mnt}"
fi
fi
;;
*)
mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}${mountpoint}"
;;
esac
done
}
run_hook() {
# Force import the pools, useful if the pool has not properly been exported using 'zpool export <pool>'
[ ! "${zfs_force}" = "" ] && ZPOOL_FORCE="-f"
# Add import directory to import command flags
[ ! "${zfs_import_dir}" = "" ] && ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -d ${zfs_import_dir}"
# Wait 15 seconds for ZFS devices to show up
[ "${zfs_wait}" = "" ] && ZFS_WAIT="15" || ZFS_WAIT="${zfs_wait}"
[ "${root}" = "zfs" ] && mount_handler="zfs_mount_handler"
case ${zfs} in
"")
# skip this line/dataset
;;
auto|bootfs)
ZFS_DATASET="bootfs"
mount_handler="zfs_mount_handler"
;;
*)
ZFS_DATASET="${zfs}"
mount_handler="zfs_mount_handler"
;;
esac
# Allow up to n seconds for zfs device to show up
for i in $(seq 1 ${ZFS_WAIT}); do
[ -c "/dev/zfs" ] && break
sleep 1
done
}
run_latehook () {
zpool import -N -a ${ZPOOL_FORCE}
}
# vim:set ts=4 sw=4 ft=sh et:

View File

@ -1,102 +0,0 @@
#!/bin/bash
build() {
map add_module \
zavl \
znvpair \
zunicode \
zcommon \
zfs \
spl
map add_binary \
fsck.zfs \
mount.zfs \
seq \
zdb \
zed \
zfs \
zhack \
zinject \
zpool \
zstreamdump \
/lib/udev/vdev_id \
/lib/udev/zvol_id \
findmnt
map add_file \
/lib/udev/rules.d/60-zvol.rules \
/lib/udev/rules.d/69-vdev.rules \
/lib/udev/rules.d/90-zfs.rules \
/lib/libgcc_s.so.1
map add_dir \
/etc/zfs/zed.d
add_runscript
# allow mount(8) to "autodetect" ZFS
echo 'zfs' >>"${BUILDROOT}/etc/filesystems"
[[ -f /etc/zfs/zpool.cache ]] && add_file "/etc/zfs/zpool.cache"
[[ -f /etc/modprobe.d/zfs.conf ]] && add_file "/etc/modprobe.d/zfs.conf"
[[ -f /etc/hostid ]] && add_file "/etc/hostid"
}
help() {
cat<<HELPEOF
This hook allows you to use ZFS as your root filesystem.
Command Line Setup:
You can append the following arguments to your kernel parameters list. See
https://wiki.archlinux.org/index.php/Kernel_parameters for more information.
To use ZFS as your boot filesystem:
zfs=bootfs or zfs=auto or root=zfs
To use a pool or dataset:
zfs=<pool/dataset>
To force importing of a ZFS pool:
zfs_force=1
If set to 1, this will use "zpool import -f" when attempting to import
pools.
To change the seconds of time to wait for ZFS devices to show up at boot:
zfs_wait=30
To search for devices in a directory other than "/dev":
zfs_import_dir=/dev/disk/by-uuid
or
zfs_import_dir=/dev/disk/by-partuuid
or
zfs_import_dir=/dev/disk/by-path
etc.
Following initcpio convention, the 'rw' option must be specified to load the
pool as read/write. Pools are loaded as read only by default.
Examples:
To use bootfs on your pool, use
zfs=bootfs rw
This will setup your root using tank/root zfs pool.
zfs=tank/root rw
If you want to set properties for zfs-on-linux module, you should add them to
/etc/modprobe.d/zfs.conf and then rebuild initcpio.
HELPEOF
}
# vim: set ts=4 sw=4 ft=sh et: