Discussion:
[pve-devel] [PATCH zfsonlinux 1/6] update ZFS submodule to debian/0.7.9-2
Stoiko Ivanov
2018-05-22 07:18:01 UTC
Permalink
Signed-off-by: Stoiko Ivanov <***@proxmox.com>
---
zfs-debian | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/zfs-debian b/zfs-debian
index 751356d..6f627d8 160000
--- a/zfs-debian
+++ b/zfs-debian
@@ -1 +1 @@
-Subproject commit 751356d3540d352bb6d27a20d584a020db1b4e1d
+Subproject commit 6f627d8999e930b974be14ab6462c04de30b9ec2
--
2.11.0
Stoiko Ivanov
2018-05-22 07:18:03 UTC
Permalink
Signed-off-by: Stoiko Ivanov <***@proxmox.com>
---
spl-debian | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spl-debian b/spl-debian
index d169ca2..e6b6675 160000
--- a/spl-debian
+++ b/spl-debian
@@ -1 +1 @@
-Subproject commit d169ca25d5546467bd92a00f4d953dbc2d8e3de1
+Subproject commit e6b66753ff444e6d10e5d9dd24c54451e3a2fba3
--
2.11.0
Stoiko Ivanov
2018-05-22 07:18:05 UTC
Permalink
Exported from https://salsa.debian.org/zfsonlinux-team/zfs/merge_requests/2

Signed-off-by: Stoiko Ivanov <***@proxmox.com>
---
...-Expand-zfs-test-and-add-Breaks-Conflicts.patch | 102 +++++++++++++++++++++
zfs-patches/series | 1 +
2 files changed, 103 insertions(+)
create mode 100644 zfs-patches/0004-Expand-zfs-test-and-add-Breaks-Conflicts.patch

diff --git a/zfs-patches/0004-Expand-zfs-test-and-add-Breaks-Conflicts.patch b/zfs-patches/0004-Expand-zfs-test-and-add-Breaks-Conflicts.patch
new file mode 100644
index 0000000..0c9c54f
--- /dev/null
+++ b/zfs-patches/0004-Expand-zfs-test-and-add-Breaks-Conflicts.patch
@@ -0,0 +1,102 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Antonio Russo <***@gmail.com>
+Date: Fri, 18 May 2018 18:04:51 -0400
+Subject: [PATCH] Expand zfs-test and add Breaks/Conflicts
+
+---
+ debian/control | 4 ++--
+ debian/control.in | 4 ++--
+ debian/tests/control | 2 +-
+ debian/zfs-test.install | 6 +++++-
+ debian/zfsutils-linux.install | 5 +----
+ 5 files changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/debian/control b/debian/control
+index 9e4f8fa7..8d85529c 100644
+--- a/debian/control
++++ b/debian/control
+@@ -180,8 +180,8 @@ Depends: acl,
+ zfsutils-linux (>=${binary:Version}),
+ ${misc:Depends},
+ ${shlibs:Depends}
+-Breaks: zfsutils-linux (<= 0.6.5.11-1)
+-Replaces: zfsutils-linux (<= 0.6.5.11-1)
++Breaks: zfsutils-linux (<= 0.7.9-2)
++Replaces: zfsutils-linux (<= 0.7.9-2)
+ Conflicts: zutils
+ Description: OpenZFS test infrastructure an support scripts
+ The Z file system is a pooled filesystem designed for maximum data
+diff --git a/debian/control.in b/debian/control.in
+index e193f017..9970875e 100644
+--- a/debian/control.in
++++ b/debian/control.in
+@@ -180,8 +180,8 @@ Depends: acl,
+ zfsutils-linux (>=${binary:Version}),
+ ${misc:Depends},
+ ${shlibs:Depends}
+-Breaks: zfsutils-linux (<= 0.6.5.11-1)
+-Replaces: zfsutils-linux (<= 0.6.5.11-1)
++Breaks: zfsutils-linux (<= 0.7.9-2)
++Replaces: zfsutils-linux (<= 0.7.9-2)
+ Conflicts: zutils
+ Description: OpenZFS test infrastructure an support scripts
+ The Z file system is a pooled filesystem designed for maximum data
+diff --git a/debian/tests/control b/debian/tests/control
+index 3d704bac..d03b365b 100644
+--- a/debian/tests/control
++++ b/debian/tests/control
+@@ -1,3 +1,3 @@
+ Tests: kernel-smoke-test
+ Restrictions: needs-root
+-Depends: zfsutils-linux, zfs-zed, zfs-initramfs, zfs-dkms
++Depends: zfsutils-linux, zfs-zed, zfs-initramfs, zfs-dkms, zfs-test
+diff --git a/debian/zfs-test.install b/debian/zfs-test.install
+index 225d51fc..ec850df8 100644
+--- a/debian/zfs-test.install
++++ b/debian/zfs-test.install
+@@ -1,8 +1,12 @@
++sbin/zinject
++sbin/zpios
+ sbin/ztest
+ usr/bin/raidz_test
+-usr/share/man/man1/ztest.1
+ usr/share/man/man1/raidz_test.1
+ usr/share/man/man1/test-runner.1
++usr/share/man/man1/zpios.1
++usr/share/man/man1/ztest.1
++usr/share/man/man8/zinject.8
+ usr/share/zfs/common.sh
+ usr/share/zfs/common.sh
+ usr/share/zfs/common.sh
+diff --git a/debian/zfsutils-linux.install b/debian/zfsutils-linux.install
+index 238e00a2..18016822 100644
+--- a/debian/zfsutils-linux.install
++++ b/debian/zfsutils-linux.install
+@@ -15,8 +15,6 @@ sbin/mount.zfs
+ sbin/zdb
+ sbin/zfs
+ sbin/zhack
+-sbin/zinject
+-sbin/zpios
+ sbin/zpool
+ sbin/zstreamdump
+ usr/bin/zgenhostid
+@@ -25,7 +23,7 @@ usr/lib/zfs-linux/zpool.d/
+ usr/sbin/arc_summary
+ usr/sbin/arcstat
+ usr/sbin/dbufstat
+-usr/share/man/man1/
++usr/share/man/man1/zhack.1
+ usr/share/man/man5/
+ usr/share/man/man8/fsck.zfs.8
+ usr/share/man/man8/mount.zfs.8
+@@ -33,6 +31,5 @@ usr/share/man/man8/vdev_id.8
+ usr/share/man/man8/zdb.8
+ usr/share/man/man8/zfs.8
+ usr/share/man/man8/zgenhostid.8
+-usr/share/man/man8/zinject.8
+ usr/share/man/man8/zpool.8
+ usr/share/man/man8/zstreamdump.8
+--
+2.11.0
+
diff --git a/zfs-patches/series b/zfs-patches/series
index 3d515ce..42486f6 100644
--- a/zfs-patches/series
+++ b/zfs-patches/series
@@ -1,3 +1,4 @@
0001-remove-DKMS-modules-and-dracut-build.patch
0002-import-with-d-dev-disk-by-id-in-scan-service.patch
0003-always-load-ZFS-module-on-boot.patch
+0004-Expand-zfs-test-and-add-Breaks-Conflicts.patch
--
2.11.0
Stoiko Ivanov
2018-05-22 07:18:06 UTC
Permalink
Signed-off-by: Stoiko Ivanov <***@proxmox.com>
---
Makefile | 2 +-
spl-changelog.Debian | 6 ++++++
zfs-changelog.Debian | 6 ++++++
3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 35d0814..b7bbdaa 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ RELEASE=5.1

# source form https://github.com/zfsonlinux/

-ZFSVER=0.7.8
+ZFSVER=0.7.9
ZFSPKGREL=pve1~bpo9
SPLPKGREL=pve1~bpo9
ZFSPKGVER=${ZFSVER}-${ZFSPKGREL}
diff --git a/spl-changelog.Debian b/spl-changelog.Debian
index 54cbe92..2bc019c 100644
--- a/spl-changelog.Debian
+++ b/spl-changelog.Debian
@@ -1,3 +1,9 @@
+spl-linux (0.7.9-pve1~bpo9) unstable; urgency=medium
+
+ * update SPL to 0.7.9
+
+ -- Proxmox Support Team <***@proxmox.com> Fri, 18 May 2018 13:49:09 +0200
+
spl-linux (0.7.8-pve1~bpo9) unstable; urgency=medium

* update SPL to 0.7.8 (no changes)
diff --git a/zfs-changelog.Debian b/zfs-changelog.Debian
index f3ef662..c57ec62 100644
--- a/zfs-changelog.Debian
+++ b/zfs-changelog.Debian
@@ -1,3 +1,9 @@
+zfs-linux (0.7.9-pve1~bpo9) unstable; urgency=medium
+
+ * update ZFS to 0.7.9
+
+ -- Proxmox Support Team <***@proxmox.com> Fri, 18 May 2018 13:49:09 +0200
+
zfs-linux (0.7.8-pve1~bpo9) unstable; urgency=medium

* update ZFS to 0.7.8 (no changes)
--
2.11.0
Stoiko Ivanov
2018-05-22 07:18:04 UTC
Permalink
Signed-off-by: Stoiko Ivanov <***@proxmox.com>
---
.../0001-remove-DKMS-and-module-build.patch | 46 +-
.../0002-Allow-longer-SPA-names-in-stats.patch | 70 -
.../0003-Remove-vn_rename-and-vn_remove.patch | 527 --
.../0004-Remove-all-spin_is_locked-calls.patch | 169 -
spl-patches/0005-Add-cv_timedwait_io.patch | 189 -
spl-patches/0006-Fix-cstyle-warnings.patch | 7052 --------------------
spl-patches/0007-Split-spl-build.m4.patch | 2088 ------
...e-evaluations-of-VERIFY-and-ASSERT-on-fai.patch | 48 -
.../0009-Staticize-kstat_default_update.patch | 36 -
spl-patches/0010-Fix-function-name-typos.patch | 50 -
spl-patches/0011-Fix-more-cstyle-warnings.patch | 391 --
...2-Fix-spl-kmod-builds-when-using-rpm-4.14.patch | 38 -
spl-patches/0013-Tag-spl-0.7.7.patch | 63 -
spl-patches/0014-Tag-spl-0.7.8.patch | 63 -
spl-patches/series | 13 -
15 files changed, 23 insertions(+), 10820 deletions(-)
delete mode 100644 spl-patches/0002-Allow-longer-SPA-names-in-stats.patch
delete mode 100644 spl-patches/0003-Remove-vn_rename-and-vn_remove.patch
delete mode 100644 spl-patches/0004-Remove-all-spin_is_locked-calls.patch
delete mode 100644 spl-patches/0005-Add-cv_timedwait_io.patch
delete mode 100644 spl-patches/0006-Fix-cstyle-warnings.patch
delete mode 100644 spl-patches/0007-Split-spl-build.m4.patch
delete mode 100644 spl-patches/0008-Fix-multiple-evaluations-of-VERIFY-and-ASSERT-on-fai.patch
delete mode 100644 spl-patches/0009-Staticize-kstat_default_update.patch
delete mode 100644 spl-patches/0010-Fix-function-name-typos.patch
delete mode 100644 spl-patches/0011-Fix-more-cstyle-warnings.patch
delete mode 100644 spl-patches/0012-Fix-spl-kmod-builds-when-using-rpm-4.14.patch
delete mode 100644 spl-patches/0013-Tag-spl-0.7.7.patch
delete mode 100644 spl-patches/0014-Tag-spl-0.7.8.patch

diff --git a/spl-patches/0001-remove-DKMS-and-module-build.patch b/spl-patches/0001-remove-DKMS-and-module-build.patch
index 35ad5f3..9526dea 100644
--- a/spl-patches/0001-remove-DKMS-and-module-build.patch
+++ b/spl-patches/0001-remove-DKMS-and-module-build.patch
@@ -8,16 +8,28 @@ Content-Transfer-Encoding: 8bit

Signed-off-by: Fabian Grünbichler <***@proxmox.com>
---
- debian/control.in | 30 ------------------------
debian/control | 1 -
- debian/rules | 70 ++-----------------------------------------------------
- 3 files changed, 2 insertions(+), 99 deletions(-)
+ debian/control.in | 31 -------------------------
+ debian/rules | 68 +------------------------------------------------------
+ 3 files changed, 1 insertion(+), 99 deletions(-)

+diff --git a/debian/control b/debian/control
+index 07db14a..01387e5 100644
+--- a/debian/control
++++ b/debian/control
+@@ -8,7 +8,6 @@ Build-Depends: autogen,
+ autotools-dev,
+ debhelper (>= 9),
+ dh-autoreconf,
+- dkms (>> 2.2.0.2-1~),
+ libtool
+ Standards-Version: 4.1.2
+ Homepage: http://www.zfsonlinux.org/
diff --git a/debian/control.in b/debian/control.in
-index 02d3182..5fd81aa 100644
+index 91242a1..5fd81aa 100644
--- a/debian/control.in
+++ b/debian/control.in
-@@ -8,46 +8,16 @@ Build-Depends: autogen,
+@@ -8,47 +8,16 @@ Build-Depends: autogen,
autotools-dev,
debhelper (>= 9),
dh-autoreconf,
@@ -36,8 +48,9 @@ index 02d3182..5fd81aa 100644
- libelf-dev,
- lsb-release,
- ${misc:Depends}
--Recommends: spl (>= ${source:Upstream-Version}),
+-Suggests: spl (>= ${source:Upstream-Version}),
- @LINUX_COMPAT@
+-Conflicts: spl (<< 0.7.9~)
-Provides: spl-modules
-Description: Solaris Porting Layer kernel modules for Linux
- The Solaris Porting Layer (SPL) is a Linux kernel module which provides
@@ -64,20 +77,8 @@ index 02d3182..5fd81aa 100644
Description: Solaris Porting Layer user-space utilities for Linux
The Solaris Porting Layer (SPL) is a Linux kernel module which provides
many of the Solaris kernel APIs. This shim layer makes it possible to
-diff --git a/debian/control b/debian/control
-index c3abf8d..455c34d 100644
---- a/debian/control
-+++ b/debian/control
-@@ -8,7 +8,6 @@ Build-Depends: autogen,
- autotools-dev,
- debhelper (>= 9),
- dh-autoreconf,
-- dkms (>> 2.2.0.2-1~),
- libtool
- Standards-Version: 4.1.2
- Homepage: http://www.zfsonlinux.org/
diff --git a/debian/rules b/debian/rules
-index c7f2608..bca58f7 100755
+index 3a12abc..8dca8fd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,12 +14,8 @@ ifndef KVERS
@@ -93,7 +94,7 @@ index c7f2608..bca58f7 100755
+ dh $@ --with autoreconf --parallel

override_dh_auto_configure:
- sed "s/@LINUX_COMPAT@/linux-libc-dev \(< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
+ sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
@@ -45,69 +41,7 @@ override_dh_auto_install:
@# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree.
$(MAKE) distdir
@@ -114,7 +115,7 @@ index c7f2608..bca58f7 100755
override_dh_auto_clean:
dh_auto_clean
@if test -e META.orig; then mv META.orig META; fi
-- sed "s/@LINUX_COMPAT@/linux-libc-dev \(< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
+ sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
-
-# ------------
-
@@ -164,7 +165,6 @@ index c7f2608..bca58f7 100755
- dh_md5sums -p${pmodules}
-
- dh_builddeb -p${pmodules}
-+ cp debian/control.in debian/control
--
-2.14.2
+2.11.0

diff --git a/spl-patches/0002-Allow-longer-SPA-names-in-stats.patch b/spl-patches/0002-Allow-longer-SPA-names-in-stats.patch
deleted file mode 100644
index a9f56b6..0000000
--- a/spl-patches/0002-Allow-longer-SPA-names-in-stats.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: gaurkuma <***@users.noreply.github.com>
-Date: Fri, 11 Aug 2017 08:53:35 -0700
-Subject: [PATCH] Allow longer SPA names in stats
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Signed-off-by: gaurkuma <***@gmail.com>
-Closes #641
-(cherry picked from commit cbf0dff3d8a13c2b4e547321ff2005055521e5ee)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/sys/kstat.h | 2 +-
- module/spl/spl-kstat.c | 13 +++++++++----
- 2 files changed, 10 insertions(+), 5 deletions(-)
-
-diff --git a/include/sys/kstat.h b/include/sys/kstat.h
-index faf6b81..7862ab0 100644
---- a/include/sys/kstat.h
-+++ b/include/sys/kstat.h
-@@ -32,7 +32,7 @@
- #include <sys/kmem.h>
- #include <sys/mutex.h>
-
--#define KSTAT_STRLEN 31
-+#define KSTAT_STRLEN 255
- #define KSTAT_RAW_MAX (128*1024)
-
- /* For reference valid classes are:
-diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
-index e306915..ed52653 100644
---- a/module/spl/spl-kstat.c
-+++ b/module/spl/spl-kstat.c
-@@ -614,21 +614,26 @@ kstat_detect_collision(kstat_t *ksp)
- {
- kstat_module_t *module;
- kstat_t *tmp;
-- char parent[KSTAT_STRLEN+1];
-+ char *parent;
- char *cp;
-
-- (void) strlcpy(parent, ksp->ks_module, sizeof(parent));
-+ parent = kmem_asprintf("%s", ksp->ks_module);
-
-- if ((cp = strrchr(parent, '/')) == NULL)
-+ if ((cp = strrchr(parent, '/')) == NULL) {
-+ strfree(parent);
- return (0);
-+ }
-
- cp[0] = '\0';
- if ((module = kstat_find_module(parent)) != NULL) {
- list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
-- if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0)
-+ if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {
-+ strfree(parent);
- return (EEXIST);
-+ }
- }
-
-+ strfree(parent);
- return (0);
- }
-
---
-2.14.2
-
diff --git a/spl-patches/0003-Remove-vn_rename-and-vn_remove.patch b/spl-patches/0003-Remove-vn_rename-and-vn_remove.patch
deleted file mode 100644
index 9696709..0000000
--- a/spl-patches/0003-Remove-vn_rename-and-vn_remove.patch
+++ /dev/null
@@ -1,527 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Fri, 27 Oct 2017 15:49:14 -0700
-Subject: [PATCH] Remove vn_rename and vn_remove
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Both vn_rename and vn_remove have been historically problematic
-to implement reliably. Rather than fixing them yet again they
-are being removed.
-
-Reviewed-by: Arkadiusz Bubala <***@open-e.com>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #648
-Closes #661
-(cherry picked from commit 1cb26f06524bdddef24352a3d9ac90a402294f2b)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/sys/vnode.h | 2 -
- module/spl/spl-vnode.c | 217 ---------------------------------------------
- module/splat/splat-vnode.c | 96 --------------------
- config/spl-build.m4 | 101 ---------------------
- 4 files changed, 416 deletions(-)
-
-diff --git a/include/sys/vnode.h b/include/sys/vnode.h
-index 0b857d3..ad7f8f4 100644
---- a/include/sys/vnode.h
-+++ b/include/sys/vnode.h
-@@ -177,8 +177,6 @@ extern int vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len,
- extern int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4);
- extern int vn_seek(vnode_t *vp, offset_t o, offset_t *op, void *ct);
-
--extern int vn_remove(const char *path, uio_seg_t seg, int flags);
--extern int vn_rename(const char *path1, const char *path2, int x1);
- extern int vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4);
- extern int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4);
- extern int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
-diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
-index ca19d73..77bfb45 100644
---- a/module/spl/spl-vnode.c
-+++ b/module/spl/spl-vnode.c
-@@ -269,223 +269,6 @@ vn_seek(vnode_t *vp, offset_t ooff, offset_t *noffp, void *ct)
- }
- EXPORT_SYMBOL(vn_seek);
-
--/*
-- * spl_basename() takes a NULL-terminated string s as input containing a path.
-- * It returns a char pointer to a string and a length that describe the
-- * basename of the path. If the basename is not "." or "/", it will be an index
-- * into the string. While the string should be NULL terminated, the section
-- * referring to the basename is not. spl_basename is dual-licensed GPLv2+ and
-- * CC0. Anyone wishing to reuse it in another codebase may pick either license.
-- */
--static void
--spl_basename(const char *s, const char **str, int *len)
--{
-- size_t i, end;
--
-- ASSERT(str);
-- ASSERT(len);
--
-- if (!s || !*s) {
-- *str = ".";
-- *len = 1;
-- return;
-- }
--
-- i = strlen(s) - 1;
--
-- while (i && s[i--] == '/');
--
-- if (i == 0) {
-- *str = "/";
-- *len = 1;
-- return;
-- }
--
-- end = i;
--
-- for (end = i; i; i--) {
-- if (s[i] == '/') {
-- *str = &s[i+1];
-- *len = end - i + 1;
-- return;
-- }
-- }
--
-- *str = s;
-- *len = end + 1;
--}
--
--static struct dentry *
--spl_kern_path_locked(const char *name, struct path *path)
--{
-- struct path parent;
-- struct dentry *dentry;
-- const char *basename;
-- int len;
-- int rc;
--
-- ASSERT(name);
-- ASSERT(path);
--
-- spl_basename(name, &basename, &len);
--
-- /* We do not accept "." or ".." */
-- if (len <= 2 && basename[0] == '.')
-- if (len == 1 || basename[1] == '.')
-- return (ERR_PTR(-EACCES));
--
-- rc = kern_path(name, LOOKUP_PARENT, &parent);
-- if (rc)
-- return (ERR_PTR(rc));
--
-- /* use I_MUTEX_PARENT because vfs_unlink needs it */
-- spl_inode_lock_nested(parent.dentry->d_inode, I_MUTEX_PARENT);
--
-- dentry = lookup_one_len(basename, parent.dentry, len);
-- if (IS_ERR(dentry)) {
-- spl_inode_unlock(parent.dentry->d_inode);
-- path_put(&parent);
-- } else {
-- *path = parent;
-- }
--
-- return (dentry);
--}
--
--/* Based on do_unlinkat() from linux/fs/namei.c */
--int
--vn_remove(const char *path, uio_seg_t seg, int flags)
--{
-- struct dentry *dentry;
-- struct path parent;
-- struct inode *inode = NULL;
-- int rc = 0;
--
-- ASSERT(seg == UIO_SYSSPACE);
-- ASSERT(flags == RMFILE);
--
-- dentry = spl_kern_path_locked(path, &parent);
-- rc = PTR_ERR(dentry);
-- if (!IS_ERR(dentry)) {
-- if (parent.dentry->d_name.name[parent.dentry->d_name.len]) {
-- rc = 0;
-- goto slashes;
-- }
--
-- inode = dentry->d_inode;
-- if (inode) {
-- atomic_inc(&inode->i_count);
-- } else {
-- rc = 0;
-- goto slashes;
-- }
--
--#ifdef HAVE_2ARGS_VFS_UNLINK
-- rc = vfs_unlink(parent.dentry->d_inode, dentry);
--#else
-- rc = vfs_unlink(parent.dentry->d_inode, dentry, NULL);
--#endif /* HAVE_2ARGS_VFS_UNLINK */
--exit1:
-- dput(dentry);
-- } else {
-- return (-rc);
-- }
--
-- spl_inode_unlock(parent.dentry->d_inode);
-- if (inode)
-- iput(inode); /* truncate the inode here */
--
-- path_put(&parent);
-- return (-rc);
--
--slashes:
-- rc = !dentry->d_inode ? -ENOENT :
-- S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR;
-- goto exit1;
--} /* vn_remove() */
--EXPORT_SYMBOL(vn_remove);
--
--/* Based on do_rename() from linux/fs/namei.c */
--int
--vn_rename(const char *oldname, const char *newname, int x1)
--{
-- struct dentry *old_dir, *new_dir;
-- struct dentry *old_dentry, *new_dentry;
-- struct dentry *trap;
-- struct path old_parent, new_parent;
-- int rc = 0;
--
-- old_dentry = spl_kern_path_locked(oldname, &old_parent);
-- if (IS_ERR(old_dentry)) {
-- rc = PTR_ERR(old_dentry);
-- goto exit;
-- }
--
-- spl_inode_unlock(old_parent.dentry->d_inode);
--
-- new_dentry = spl_kern_path_locked(newname, &new_parent);
-- if (IS_ERR(new_dentry)) {
-- rc = PTR_ERR(new_dentry);
-- goto exit2;
-- }
--
-- spl_inode_unlock(new_parent.dentry->d_inode);
--
-- rc = -EXDEV;
-- if (old_parent.mnt != new_parent.mnt)
-- goto exit3;
--
-- old_dir = old_parent.dentry;
-- new_dir = new_parent.dentry;
-- trap = lock_rename(new_dir, old_dir);
--
-- /* source should not be ancestor of target */
-- rc = -EINVAL;
-- if (old_dentry == trap)
-- goto exit4;
--
-- /* target should not be an ancestor of source */
-- rc = -ENOTEMPTY;
-- if (new_dentry == trap)
-- goto exit4;
--
-- /* source must exist */
-- rc = -ENOENT;
-- if (!old_dentry->d_inode)
-- goto exit4;
--
-- /* unless the source is a directory trailing slashes give -ENOTDIR */
-- if (!S_ISDIR(old_dentry->d_inode->i_mode)) {
-- rc = -ENOTDIR;
-- if (old_dentry->d_name.name[old_dentry->d_name.len])
-- goto exit4;
-- if (new_dentry->d_name.name[new_dentry->d_name.len])
-- goto exit4;
-- }
--
--#if defined(HAVE_4ARGS_VFS_RENAME)
-- rc = vfs_rename(old_dir->d_inode, old_dentry,
-- new_dir->d_inode, new_dentry);
--#elif defined(HAVE_5ARGS_VFS_RENAME)
-- rc = vfs_rename(old_dir->d_inode, old_dentry,
-- new_dir->d_inode, new_dentry, NULL);
--#else
-- rc = vfs_rename(old_dir->d_inode, old_dentry,
-- new_dir->d_inode, new_dentry, NULL, 0);
--#endif
--exit4:
-- unlock_rename(new_dir, old_dir);
--exit3:
-- dput(new_dentry);
-- path_put(&new_parent);
--exit2:
-- dput(old_dentry);
-- path_put(&old_parent);
--exit:
-- return (-rc);
--}
--EXPORT_SYMBOL(vn_rename);
--
- int
- vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
- {
-diff --git a/module/splat/splat-vnode.c b/module/splat/splat-vnode.c
-index ad69cf6..9160003 100644
---- a/module/splat/splat-vnode.c
-+++ b/module/splat/splat-vnode.c
-@@ -42,10 +42,6 @@
- #define SPLAT_VNODE_TEST3_NAME "vn_rdwr"
- #define SPLAT_VNODE_TEST3_DESC "Vn_rdwrt Test"
-
--#define SPLAT_VNODE_TEST4_ID 0x0904
--#define SPLAT_VNODE_TEST4_NAME "vn_rename"
--#define SPLAT_VNODE_TEST4_DESC "Vn_rename Test"
--
- #define SPLAT_VNODE_TEST5_ID 0x0905
- #define SPLAT_VNODE_TEST5_NAME "vn_getattr"
- #define SPLAT_VNODE_TEST5_DESC "Vn_getattr Test"
-@@ -218,94 +214,10 @@ splat_vnode_test3(struct file *file, void *arg)
-
- out:
- VOP_CLOSE(vp, 0, 0, 0, 0, 0);
-- vn_remove(SPLAT_VNODE_TEST_FILE_RW, UIO_SYSSPACE, RMFILE);
-
- return -rc;
- } /* splat_vnode_test3() */
-
--#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,1,0)
--static int
--splat_vnode_test4(struct file *file, void *arg)
--{
-- vnode_t *vp;
-- char buf1[32] = "SPL VNode Interface Test File\n";
-- char buf2[32] = "";
-- int rc;
--
-- if ((rc = splat_vnode_unlink_all(file, arg, SPLAT_VNODE_TEST4_NAME)))
-- return rc;
--
-- if ((rc = vn_open(SPLAT_VNODE_TEST_FILE_RW1, UIO_SYSSPACE,
-- FWRITE | FREAD | FCREAT | FEXCL, 0644, &vp, 0, 0))) {
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME,
-- "Failed to vn_open test file: %s (%d)\n",
-- SPLAT_VNODE_TEST_FILE_RW1, rc);
-- goto out;
-- }
--
-- rc = vn_rdwr(UIO_WRITE, vp, buf1, strlen(buf1), 0,
-- UIO_SYSSPACE, 0, RLIM64_INFINITY, 0, NULL);
-- if (rc) {
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME,
-- "Failed vn_rdwr write of test file: %s (%d)\n",
-- SPLAT_VNODE_TEST_FILE_RW1, rc);
-- goto out2;
-- }
--
-- VOP_CLOSE(vp, 0, 0, 0, 0, 0);
--
-- rc = vn_rename(SPLAT_VNODE_TEST_FILE_RW1,SPLAT_VNODE_TEST_FILE_RW2,0);
-- if (rc) {
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME, "Failed vn_rename "
-- "%s -> %s (%d)\n",
-- SPLAT_VNODE_TEST_FILE_RW1,
-- SPLAT_VNODE_TEST_FILE_RW2, rc);
-- goto out;
-- }
--
-- if ((rc = vn_open(SPLAT_VNODE_TEST_FILE_RW2, UIO_SYSSPACE,
-- FREAD | FEXCL, 0644, &vp, 0, 0))) {
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME,
-- "Failed to vn_open test file: %s (%d)\n",
-- SPLAT_VNODE_TEST_FILE_RW2, rc);
-- goto out;
-- }
--
-- rc = vn_rdwr(UIO_READ, vp, buf2, strlen(buf1), 0,
-- UIO_SYSSPACE, 0, RLIM64_INFINITY, 0, NULL);
-- if (rc) {
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME,
-- "Failed vn_rdwr read of test file: %s (%d)\n",
-- SPLAT_VNODE_TEST_FILE_RW2, rc);
-- goto out2;
-- }
--
-- if (strncmp(buf1, buf2, strlen(buf1))) {
-- rc = EINVAL;
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME,
-- "Failed strncmp data written does not match "
-- "data read\nWrote: %sRead: %s\n", buf1, buf2);
-- goto out2;
-- }
--
-- rc = 0;
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME, "Wrote to %s: %s",
-- SPLAT_VNODE_TEST_FILE_RW1, buf1);
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME, "Read from %s: %s",
-- SPLAT_VNODE_TEST_FILE_RW2, buf2);
-- splat_vprint(file, SPLAT_VNODE_TEST4_NAME, "Successfully renamed "
-- "test file %s -> %s and verified data pattern\n",
-- SPLAT_VNODE_TEST_FILE_RW1, SPLAT_VNODE_TEST_FILE_RW2);
--out2:
-- VOP_CLOSE(vp, 0, 0, 0, 0, 0);
--out:
-- vn_remove(SPLAT_VNODE_TEST_FILE_RW1, UIO_SYSSPACE, RMFILE);
-- vn_remove(SPLAT_VNODE_TEST_FILE_RW2, UIO_SYSSPACE, RMFILE);
--
-- return -rc;
--} /* splat_vnode_test4() */
--#endif
--
- static int
- splat_vnode_test5(struct file *file, void *arg)
- {
-@@ -387,7 +299,6 @@ splat_vnode_test6(struct file *file, void *arg)
- "fsync'ed test file %s\n", SPLAT_VNODE_TEST_FILE_RW);
- out:
- VOP_CLOSE(vp, 0, 0, 0, 0, 0);
-- vn_remove(SPLAT_VNODE_TEST_FILE_RW, UIO_SYSSPACE, RMFILE);
-
- return -rc;
- } /* splat_vnode_test6() */
-@@ -415,10 +326,6 @@ splat_vnode_init(void)
- SPLAT_VNODE_TEST2_ID, splat_vnode_test2);
- splat_test_init(sub, SPLAT_VNODE_TEST3_NAME, SPLAT_VNODE_TEST3_DESC,
- SPLAT_VNODE_TEST3_ID, splat_vnode_test3);
--#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,1,0)
-- splat_test_init(sub, SPLAT_VNODE_TEST4_NAME, SPLAT_VNODE_TEST4_DESC,
-- SPLAT_VNODE_TEST4_ID, splat_vnode_test4);
--#endif
- splat_test_init(sub, SPLAT_VNODE_TEST5_NAME, SPLAT_VNODE_TEST5_DESC,
- SPLAT_VNODE_TEST5_ID, splat_vnode_test5);
- splat_test_init(sub, SPLAT_VNODE_TEST6_NAME, SPLAT_VNODE_TEST6_DESC,
-@@ -434,9 +341,6 @@ splat_vnode_fini(splat_subsystem_t *sub)
-
- splat_test_fini(sub, SPLAT_VNODE_TEST6_ID);
- splat_test_fini(sub, SPLAT_VNODE_TEST5_ID);
--#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,1,0)
-- splat_test_fini(sub, SPLAT_VNODE_TEST4_ID);
--#endif
- splat_test_fini(sub, SPLAT_VNODE_TEST3_ID);
- splat_test_fini(sub, SPLAT_VNODE_TEST2_ID);
- splat_test_fini(sub, SPLAT_VNODE_TEST1_ID);
-diff --git a/config/spl-build.m4 b/config/spl-build.m4
-index 25013b5..926abd5 100644
---- a/config/spl-build.m4
-+++ b/config/spl-build.m4
-@@ -27,8 +27,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
- SPL_AC_CONFIG_TRIM_UNUSED_KSYMS
- SPL_AC_PDE_DATA
- SPL_AC_SET_FS_PWD_WITH_CONST
-- SPL_AC_2ARGS_VFS_UNLINK
-- SPL_AC_4ARGS_VFS_RENAME
- SPL_AC_2ARGS_VFS_FSYNC
- SPL_AC_INODE_TRUNCATE_RANGE
- SPL_AC_FS_STRUCT_SPINLOCK
-@@ -936,105 +934,6 @@ AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
- EXTRA_KCFLAGS="$tmp_flags"
- ])
-
--dnl #
--dnl # 3.13 API change
--dnl # vfs_unlink() updated to take a third delegated_inode argument.
--dnl #
--AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
-- [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_unlink((struct inode *) NULL, (struct dentry *) NULL);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
-- [vfs_unlink() wants 2 args])
-- ],[
-- AC_MSG_RESULT(no)
-- dnl #
-- dnl # Linux 3.13 API change
-- dnl # Added delegated inode
-- dnl #
-- AC_MSG_CHECKING([whether vfs_unlink() wants 3 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_unlink((struct inode *) NULL,
-- (struct dentry *) NULL,
-- (struct inode **) NULL);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_3ARGS_VFS_UNLINK, 1,
-- [vfs_unlink() wants 3 args])
-- ],[
-- AC_MSG_ERROR(no)
-- ])
--
-- ])
--])
--
--dnl #
--dnl # 3.13 and 3.15 API changes
--dnl # Added delegated inode and flags argument.
--dnl #
--AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
-- [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_rename((struct inode *) NULL, (struct dentry *) NULL,
-- (struct inode *) NULL, (struct dentry *) NULL);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
-- [vfs_rename() wants 4 args])
-- ],[
-- AC_MSG_RESULT(no)
-- dnl #
-- dnl # Linux 3.13 API change
-- dnl # Added delegated inode
-- dnl #
-- AC_MSG_CHECKING([whether vfs_rename() wants 5 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_rename((struct inode *) NULL,
-- (struct dentry *) NULL,
-- (struct inode *) NULL,
-- (struct dentry *) NULL,
-- (struct inode **) NULL);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_5ARGS_VFS_RENAME, 1,
-- [vfs_rename() wants 5 args])
-- ],[
-- AC_MSG_RESULT(no)
-- dnl #
-- dnl # Linux 3.15 API change
-- dnl # Added flags
-- dnl #
-- AC_MSG_CHECKING([whether vfs_rename() wants 6 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_rename((struct inode *) NULL,
-- (struct dentry *) NULL,
-- (struct inode *) NULL,
-- (struct dentry *) NULL,
-- (struct inode **) NULL,
-- (unsigned int) 0);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_6ARGS_VFS_RENAME, 1,
-- [vfs_rename() wants 6 args])
-- ],[
-- AC_MSG_ERROR(no)
-- ])
-- ])
-- ])
--])
--
- dnl #
- dnl # 2.6.36 API change,
- dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
---
-2.14.2
-
diff --git a/spl-patches/0004-Remove-all-spin_is_locked-calls.patch b/spl-patches/0004-Remove-all-spin_is_locked-calls.patch
deleted file mode 100644
index 2b0d568..0000000
--- a/spl-patches/0004-Remove-all-spin_is_locked-calls.patch
+++ /dev/null
@@ -1,169 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: James Cowgill <***@users.noreply.github.com>
-Date: Mon, 30 Oct 2017 18:16:56 +0000
-Subject: [PATCH] Remove all spin_is_locked calls
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-On systems with CONFIG_SMP turned off, spin_is_locked always returns
-false causing these assertions to fail. Remove them as suggested in
-zfsonlinux/zfs#6558.
-
-Reviewed-by: George Melikov <***@gmelikov.ru>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: James Cowgill <***@mips.com>
-Closes #665
-(cherry picked from commit 9e573b7f9a5cf3e1cb6bb1b66bc35d5bb93cfaa9)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/spl/spl-kmem-cache.c | 4 ----
- module/spl/spl-taskq.c | 13 -------------
- module/spl/spl-tsd.c | 1 -
- module/spl/spl-vnode.c | 2 --
- 4 files changed, 20 deletions(-)
-
-diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c
-index 45576b9..3668669 100644
---- a/module/spl/spl-kmem-cache.c
-+++ b/module/spl/spl-kmem-cache.c
-@@ -382,7 +382,6 @@ spl_slab_free(spl_kmem_slab_t *sks,
-
- skc = sks->sks_cache;
- ASSERT(skc->skc_magic == SKC_MAGIC);
-- ASSERT(spin_is_locked(&skc->skc_lock));
-
- /*
- * Update slab/objects counters in the cache, then remove the
-@@ -583,7 +582,6 @@ __spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush)
-
- ASSERT(skc->skc_magic == SKC_MAGIC);
- ASSERT(skm->skm_magic == SKM_MAGIC);
-- ASSERT(spin_is_locked(&skc->skc_lock));
-
- for (i = 0; i < count; i++)
- spl_cache_shrink(skc, skm->skm_objs[i]);
-@@ -1125,7 +1123,6 @@ spl_cache_obj(spl_kmem_cache_t *skc, spl_kmem_slab_t *sks)
-
- ASSERT(skc->skc_magic == SKC_MAGIC);
- ASSERT(sks->sks_magic == SKS_MAGIC);
-- ASSERT(spin_is_locked(&skc->skc_lock));
-
- sko = list_entry(sks->sks_free_list.next, spl_kmem_obj_t, sko_list);
- ASSERT(sko->sko_magic == SKO_MAGIC);
-@@ -1396,7 +1393,6 @@ spl_cache_shrink(spl_kmem_cache_t *skc, void *obj)
- spl_kmem_obj_t *sko = NULL;
-
- ASSERT(skc->skc_magic == SKC_MAGIC);
-- ASSERT(spin_is_locked(&skc->skc_lock));
-
- sko = spl_sko_from_obj(skc, obj);
- ASSERT(sko->sko_magic == SKO_MAGIC);
-diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c
-index 89c53a5..ae26bdb 100644
---- a/module/spl/spl-taskq.c
-+++ b/module/spl/spl-taskq.c
-@@ -103,7 +103,6 @@ task_alloc(taskq_t *tq, uint_t flags, unsigned long *irqflags)
- int count = 0;
-
- ASSERT(tq);
-- ASSERT(spin_is_locked(&tq->tq_lock));
- retry:
- /* Acquire taskq_ent_t's from free list if available */
- if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) {
-@@ -168,7 +167,6 @@ task_free(taskq_t *tq, taskq_ent_t *t)
- {
- ASSERT(tq);
- ASSERT(t);
-- ASSERT(spin_is_locked(&tq->tq_lock));
- ASSERT(list_empty(&t->tqent_list));
- ASSERT(!timer_pending(&t->tqent_timer));
-
-@@ -185,7 +183,6 @@ task_done(taskq_t *tq, taskq_ent_t *t)
- {
- ASSERT(tq);
- ASSERT(t);
-- ASSERT(spin_is_locked(&tq->tq_lock));
-
- /* Wake tasks blocked in taskq_wait_id() */
- wake_up_all(&t->tqent_waitq);
-@@ -274,7 +271,6 @@ taskq_lowest_id(taskq_t *tq)
- taskq_thread_t *tqt;
-
- ASSERT(tq);
-- ASSERT(spin_is_locked(&tq->tq_lock));
-
- if (!list_empty(&tq->tq_pend_list)) {
- t = list_entry(tq->tq_pend_list.next, taskq_ent_t, tqent_list);
-@@ -312,7 +308,6 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt)
-
- ASSERT(tq);
- ASSERT(tqt);
-- ASSERT(spin_is_locked(&tq->tq_lock));
-
- list_for_each_prev(l, &tq->tq_active_list) {
- w = list_entry(l, taskq_thread_t, tqt_active_list);
-@@ -335,8 +330,6 @@ taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id)
- struct list_head *l;
- taskq_ent_t *t;
-
-- ASSERT(spin_is_locked(&tq->tq_lock));
--
- list_for_each(l, lh) {
- t = list_entry(l, taskq_ent_t, tqent_list);
-
-@@ -363,8 +356,6 @@ taskq_find(taskq_t *tq, taskqid_t id)
- struct list_head *l;
- taskq_ent_t *t;
-
-- ASSERT(spin_is_locked(&tq->tq_lock));
--
- t = taskq_find_list(tq, &tq->tq_delay_list, id);
- if (t)
- return (t);
-@@ -774,8 +765,6 @@ taskq_next_ent(taskq_t *tq)
- {
- struct list_head *list;
-
-- ASSERT(spin_is_locked(&tq->tq_lock));
--
- if (!list_empty(&tq->tq_prio_list))
- list = &tq->tq_prio_list;
- else if (!list_empty(&tq->tq_pend_list))
-@@ -840,8 +829,6 @@ taskq_thread_spawn(taskq_t *tq)
- static int
- taskq_thread_should_stop(taskq_t *tq, taskq_thread_t *tqt)
- {
-- ASSERT(spin_is_locked(&tq->tq_lock));
--
- if (!(tq->tq_flags & TASKQ_DYNAMIC))
- return (0);
-
-diff --git a/module/spl/spl-tsd.c b/module/spl/spl-tsd.c
-index bf82350..4c80029 100644
---- a/module/spl/spl-tsd.c
-+++ b/module/spl/spl-tsd.c
-@@ -315,7 +315,6 @@ tsd_hash_add_pid(tsd_hash_table_t *table, pid_t pid)
- static void
- tsd_hash_del(tsd_hash_table_t *table, tsd_hash_entry_t *entry)
- {
-- ASSERT(spin_is_locked(&table->ht_lock));
- hlist_del(&entry->he_list);
- list_del_init(&entry->he_key_list);
- list_del_init(&entry->he_pid_list);
-diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
-index 77bfb45..a804e10 100644
---- a/module/spl/spl-vnode.c
-+++ b/module/spl/spl-vnode.c
-@@ -414,8 +414,6 @@ file_find(int fd, struct task_struct *task)
- {
- file_t *fp;
-
-- ASSERT(spin_is_locked(&vn_file_lock));
--
- list_for_each_entry(fp, &vn_file_list, f_list) {
- if (fd == fp->f_fd && fp->f_task == task) {
- ASSERT(atomic_read(&fp->f_ref) != 0);
---
-2.14.2
-
diff --git a/spl-patches/0005-Add-cv_timedwait_io.patch b/spl-patches/0005-Add-cv_timedwait_io.patch
deleted file mode 100644
index c02c7fc..0000000
--- a/spl-patches/0005-Add-cv_timedwait_io.patch
+++ /dev/null
@@ -1,189 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Wed, 24 Jan 2018 11:33:47 -0800
-Subject: [PATCH] Add cv_timedwait_io()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add missing helper function cv_timedwait_io(), it should be used
-when waiting on IO with a specified timeout.
-
-Reviewed-by: Tim Chase <***@chase2k.com>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #674
-(cherry picked from commit ba003d46e3269ead9128b537f8f31c44bc3a974f)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/sys/condvar.h | 2 ++
- module/spl/spl-condvar.c | 58 +++++++++++++++++++++++++++++++++++++++++-------
- config/spl-build.m4 | 21 ++++++++++++++++++
- 3 files changed, 73 insertions(+), 8 deletions(-)
-
-diff --git a/include/sys/condvar.h b/include/sys/condvar.h
-index 5479e75..5fcc906 100644
---- a/include/sys/condvar.h
-+++ b/include/sys/condvar.h
-@@ -56,6 +56,7 @@ extern void __cv_wait(kcondvar_t *, kmutex_t *);
- extern void __cv_wait_io(kcondvar_t *, kmutex_t *);
- extern void __cv_wait_sig(kcondvar_t *, kmutex_t *);
- extern clock_t __cv_timedwait(kcondvar_t *, kmutex_t *, clock_t);
-+extern clock_t __cv_timedwait_io(kcondvar_t *, kmutex_t *, clock_t);
- extern clock_t __cv_timedwait_sig(kcondvar_t *, kmutex_t *, clock_t);
- extern clock_t cv_timedwait_hires(kcondvar_t *, kmutex_t *, hrtime_t,
- hrtime_t res, int flag);
-@@ -71,6 +72,7 @@ extern void __cv_broadcast(kcondvar_t *c);
- #define cv_wait_sig(cvp, mp) __cv_wait_sig(cvp, mp)
- #define cv_wait_interruptible(cvp, mp) cv_wait_sig(cvp, mp)
- #define cv_timedwait(cvp, mp, t) __cv_timedwait(cvp, mp, t)
-+#define cv_timedwait_io(cvp, mp, t) __cv_timedwait_io(cvp, mp, t)
- #define cv_timedwait_sig(cvp, mp, t) __cv_timedwait_sig(cvp, mp, t)
- #define cv_timedwait_interruptible(cvp, mp, t) cv_timedwait_sig(cvp, mp, t)
- #define cv_signal(cvp) __cv_signal(cvp)
-diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c
-index 80c2ef0..4778fb2 100644
---- a/module/spl/spl-condvar.c
-+++ b/module/spl/spl-condvar.c
-@@ -136,6 +136,13 @@ __cv_wait(kcondvar_t *cvp, kmutex_t *mp)
- }
- EXPORT_SYMBOL(__cv_wait);
-
-+void
-+__cv_wait_io(kcondvar_t *cvp, kmutex_t *mp)
-+{
-+ cv_wait_common(cvp, mp, TASK_UNINTERRUPTIBLE, 1);
-+}
-+EXPORT_SYMBOL(__cv_wait_io);
-+
- void
- __cv_wait_sig(kcondvar_t *cvp, kmutex_t *mp)
- {
-@@ -143,12 +150,34 @@ __cv_wait_sig(kcondvar_t *cvp, kmutex_t *mp)
- }
- EXPORT_SYMBOL(__cv_wait_sig);
-
--void
--__cv_wait_io(kcondvar_t *cvp, kmutex_t *mp)
-+#if defined(HAVE_IO_SCHEDULE_TIMEOUT)
-+#define spl_io_schedule_timeout(t) io_schedule_timeout(t)
-+#else
-+static void
-+__cv_wakeup(unsigned long data)
- {
-- cv_wait_common(cvp, mp, TASK_UNINTERRUPTIBLE, 1);
-+ wake_up_process((struct task_struct *)data);
- }
--EXPORT_SYMBOL(__cv_wait_io);
-+
-+static long
-+spl_io_schedule_timeout(long time_left)
-+{
-+ long expire_time = jiffies + time_left;
-+ struct timer_list timer;
-+
-+ init_timer(&timer);
-+ setup_timer(&timer, __cv_wakeup, (unsigned long)current);
-+ timer.expires = expire_time;
-+ add_timer(&timer);
-+
-+ io_schedule();
-+
-+ del_timer_sync(&timer);
-+ time_left = expire_time - jiffies;
-+
-+ return (time_left < 0 ? 0 : time_left);
-+}
-+#endif
-
- /*
- * 'expire_time' argument is an absolute wall clock time in jiffies.
-@@ -156,7 +185,7 @@ EXPORT_SYMBOL(__cv_wait_io);
- */
- static clock_t
- __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time,
-- int state)
-+ int state, int io)
- {
- DEFINE_WAIT(wait);
- kmutex_t *m;
-@@ -188,7 +217,10 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time,
- * race where 'cvp->cv_waiters > 0' but the list is empty.
- */
- mutex_exit(mp);
-- time_left = schedule_timeout(time_left);
-+ if (io)
-+ time_left = spl_io_schedule_timeout(time_left);
-+ else
-+ time_left = schedule_timeout(time_left);
-
- /* No more waiters a different mutex could be used */
- if (atomic_dec_and_test(&cvp->cv_waiters)) {
-@@ -214,14 +246,24 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time,
- clock_t
- __cv_timedwait(kcondvar_t *cvp, kmutex_t *mp, clock_t exp_time)
- {
-- return (__cv_timedwait_common(cvp, mp, exp_time, TASK_UNINTERRUPTIBLE));
-+ return (__cv_timedwait_common(cvp, mp, exp_time,
-+ TASK_UNINTERRUPTIBLE, 0));
- }
- EXPORT_SYMBOL(__cv_timedwait);
-
-+clock_t
-+__cv_timedwait_io(kcondvar_t *cvp, kmutex_t *mp, clock_t exp_time)
-+{
-+ return (__cv_timedwait_common(cvp, mp, exp_time,
-+ TASK_UNINTERRUPTIBLE, 1));
-+}
-+EXPORT_SYMBOL(__cv_timedwait_io);
-+
- clock_t
- __cv_timedwait_sig(kcondvar_t *cvp, kmutex_t *mp, clock_t exp_time)
- {
-- return (__cv_timedwait_common(cvp, mp, exp_time, TASK_INTERRUPTIBLE));
-+ return (__cv_timedwait_common(cvp, mp, exp_time,
-+ TASK_INTERRUPTIBLE, 0));
- }
- EXPORT_SYMBOL(__cv_timedwait_sig);
-
-diff --git a/config/spl-build.m4 b/config/spl-build.m4
-index 926abd5..afc8de6 100644
---- a/config/spl-build.m4
-+++ b/config/spl-build.m4
-@@ -52,6 +52,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
- SPL_AC_KMEM_CACHE_CREATE_USERCOPY
- SPL_AC_WAIT_QUEUE_ENTRY_T
- SPL_AC_WAIT_QUEUE_HEAD_ENTRY
-+ SPL_AC_IO_SCHEDULE_TIMEOUT
- SPL_AC_KERNEL_WRITE
- SPL_AC_KERNEL_READ
- SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST
-@@ -1598,6 +1599,26 @@ AC_DEFUN([SPL_AC_WAIT_QUEUE_HEAD_ENTRY], [
- ])
- ])
-
-+dnl #
-+dnl # 3.19 API change
-+dnl # The io_schedule_timeout() function is present in all 2.6.32 kernels
-+dnl # but it was not exported until Linux 3.19. The RHEL 7.x kernels which
-+dnl # are based on a 3.10 kernel do export this symbol.
-+dnl #
-+AC_DEFUN([SPL_AC_IO_SCHEDULE_TIMEOUT], [
-+ AC_MSG_CHECKING([whether io_schedule_timeout() is available])
-+ SPL_LINUX_TRY_COMPILE_SYMBOL([
-+ #include <linux/sched.h>
-+ ], [
-+ (void) io_schedule_timeout(1);
-+ ], [io_schedule_timeout], [], [
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_IO_SCHEDULE_TIMEOUT, 1, [yes])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
- dnl #
- dnl # 4.14 API change
- dnl # kernel_write() which was introduced in 3.9 was updated to take
---
-2.14.2
-
diff --git a/spl-patches/0006-Fix-cstyle-warnings.patch b/spl-patches/0006-Fix-cstyle-warnings.patch
deleted file mode 100644
index 4aebe3a..0000000
--- a/spl-patches/0006-Fix-cstyle-warnings.patch
+++ /dev/null
@@ -1,7052 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Wed, 7 Feb 2018 11:49:38 -0800
-Subject: [PATCH] Fix cstyle warnings
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This patch contains no functional changes. It is solely intended
-to resolve cstyle warnings in order to facilitate moving the spl
-source code in to the zfs repository.
-
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #681
-(cherry picked from commit 4852db99b4fb7ffe356e6fe9c024480e101dd69d)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/fs/fs_subr.h | 2 +-
- include/linux/math64_compat.h | 3 +-
- include/rpc/types.h | 2 +-
- include/rpc/xdr.h | 48 ++--
- include/sharefs/share.h | 2 +-
- include/spl-ctl.h | 22 +-
- include/splat-ctl.h | 60 ++--
- include/strings.h | 2 +-
- include/sys/acl.h | 138 +++++-----
- include/sys/acl_impl.h | 2 +-
- include/sys/atomic.h | 80 +++---
- include/sys/attr.h | 2 +-
- include/sys/bitmap.h | 2 +-
- include/sys/bootconf.h | 2 +-
- include/sys/bootprops.h | 2 +-
- include/sys/buf.h | 2 +-
- include/sys/byteorder.h | 32 ++-
- include/sys/callb.h | 21 +-
- include/sys/callo.h | 10 +-
- include/sys/cmn_err.h | 14 +-
- include/sys/compress.h | 2 +-
- include/sys/conf.h | 2 +-
- include/sys/console.h | 10 +-
- include/sys/cpupart.h | 2 +-
- include/sys/cpuvar.h | 2 +-
- include/sys/crc32.h | 2 +-
- include/sys/cred.h | 4 +-
- include/sys/ctype.h | 2 +-
- include/sys/ddi.h | 2 +-
- include/sys/debug.h | 6 +-
- include/sys/dirent.h | 2 +-
- include/sys/disp.h | 2 +-
- include/sys/dkioc_free_util.h | 2 +-
- include/sys/dnlc.h | 2 +-
- include/sys/dumphdr.h | 2 +-
- include/sys/efi_partition.h | 2 +-
- include/sys/errno.h | 2 +-
- include/sys/fcntl.h | 4 +-
- include/sys/file.h | 2 +-
- include/sys/fs/swapnode.h | 2 +-
- include/sys/idmap.h | 4 +-
- include/sys/int_limits.h | 2 +-
- include/sys/int_types.h | 2 +-
- include/sys/inttypes.h | 2 +-
- include/sys/isa_defs.h | 64 ++---
- include/sys/kidmap.h | 2 +-
- include/sys/kobj.h | 2 +-
- include/sys/kstat.h | 244 ++++++++--------
- include/sys/list.h | 36 +--
- include/sys/mkdev.h | 2 +-
- include/sys/mntent.h | 2 +-
- include/sys/modctl.h | 2 +-
- include/sys/mode.h | 8 +-
- include/sys/mount.h | 2 +-
- include/sys/mutex.h | 10 +-
- include/sys/note.h | 2 +-
- include/sys/open.h | 2 +-
- include/sys/param.h | 8 +-
- include/sys/pathname.h | 2 +-
- include/sys/policy.h | 20 +-
- include/sys/pool.h | 2 +-
- include/sys/priv_impl.h | 2 +-
- include/sys/proc.h | 2 +-
- include/sys/processor.h | 2 +-
- include/sys/pset.h | 14 +-
- include/sys/random.h | 4 +-
- include/sys/refstr.h | 2 +-
- include/sys/resource.h | 2 +-
- include/sys/rwlock.h | 34 +--
- include/sys/sdt.h | 4 +-
- include/sys/sid.h | 12 +-
- include/sys/signal.h | 7 +-
- include/sys/stat.h | 2 +-
- include/sys/stropts.h | 2 +-
- include/sys/sunddi.h | 8 +-
- include/sys/sunldi.h | 4 +-
- include/sys/sysdc.h | 2 +-
- include/sys/sysmacros.h | 196 ++++++-------
- include/sys/systeminfo.h | 8 +-
- include/sys/systm.h | 2 +-
- include/sys/t_lock.h | 2 +-
- include/sys/taskq.h | 2 +-
- include/sys/thread.h | 36 +--
- include/sys/timer.h | 37 ++-
- include/sys/tsd.h | 10 +-
- include/sys/types.h | 6 +-
- include/sys/u8_textprep.h | 2 +-
- include/sys/uio.h | 20 +-
- include/sys/unistd.h | 2 +-
- include/sys/user.h | 4 +-
- include/sys/va_list.h | 2 +-
- include/sys/varargs.h | 4 +-
- include/sys/vfs.h | 4 +-
- include/sys/vfs_opreg.h | 2 +-
- include/sys/vmsystm.h | 14 +-
- include/sys/vnode.h | 100 +++----
- include/sys/zmod.h | 5 +-
- include/sys/zone.h | 2 +-
- include/unistd.h | 2 +-
- include/util/qsort.h | 4 +-
- include/util/sscanf.h | 2 +-
- include/vm/anon.h | 2 +-
- include/vm/pvn.h | 2 +-
- include/vm/seg_kmem.h | 2 +-
- module/spl/spl-atomic.c | 8 +-
- module/spl/spl-condvar.c | 8 +-
- module/spl/spl-cred.c | 38 ++-
- module/spl/spl-err.c | 5 +-
- module/spl/spl-generic.c | 84 +++---
- module/spl/spl-kmem-cache.c | 22 +-
- module/spl/spl-kmem.c | 2 +-
- module/spl/spl-kobj.c | 12 +-
- module/spl/spl-kstat.c | 521 +++++++++++++++++------------------
- module/spl/spl-mutex.c | 8 +-
- module/spl/spl-proc.c | 628 +++++++++++++++++++++---------------------
- module/spl/spl-rwlock.c | 10 +-
- module/spl/spl-taskq.c | 22 +-
- module/spl/spl-thread.c | 29 +-
- module/spl/spl-vnode.c | 164 ++++++-----
- module/spl/spl-xdr.c | 157 ++++++-----
- module/spl/spl-zlib.c | 37 +--
- 121 files changed, 1634 insertions(+), 1622 deletions(-)
-
-diff --git a/include/fs/fs_subr.h b/include/fs/fs_subr.h
-index 33ccc68..881a4cd 100644
---- a/include/fs/fs_subr.h
-+++ b/include/fs/fs_subr.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_FS_FS_SUBR_H
--#define _SPL_FS_FS_SUBR_H
-+#define _SPL_FS_FS_SUBR_H
-
- #endif /* SPL_FS_FS_SUBR_H */
-diff --git a/include/linux/math64_compat.h b/include/linux/math64_compat.h
-index 2c911a6..173b380 100644
---- a/include/linux/math64_compat.h
-+++ b/include/linux/math64_compat.h
-@@ -26,7 +26,8 @@
- #define _SPL_MATH64_COMPAT_H
-
- #ifndef abs64
--#define abs64(x) ({ uint64_t t = (x) >> 63; ((x) ^ t) - t; })
-+/* CSTYLED */
-+#define abs64(x) ({ uint64_t t = (x) >> 63; ((x) ^ t) - t; })
- #endif
-
- #endif /* _SPL_MATH64_COMPAT_H */
-diff --git a/include/rpc/types.h b/include/rpc/types.h
-index b57b4bd..915ace5 100644
---- a/include/rpc/types.h
-+++ b/include/rpc/types.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_RPC_TYPES_H
--#define _SPL_RPC_TYPES_H
-+#define _SPL_RPC_TYPES_H
-
- typedef int bool_t;
-
-diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
-index d0f06b5..dc46f51 100644
---- a/include/rpc/xdr.h
-+++ b/include/rpc/xdr.h
-@@ -20,7 +20,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_RPC_XDR_H
--#define _SPL_RPC_XDR_H
-+#define _SPL_RPC_XDR_H
-
- #include <sys/types.h>
- #include <rpc/types.h>
-@@ -36,11 +36,10 @@ enum xdr_op {
- struct xdr_ops;
-
- typedef struct {
-- struct xdr_ops *x_ops; /* Also used to let caller know if
-- xdrmem_create() succeeds (sigh..) */
-- caddr_t x_addr; /* Current buffer addr */
-- caddr_t x_addr_end; /* End of the buffer */
-- enum xdr_op x_op; /* Stream direction */
-+ struct xdr_ops *x_ops; /* Let caller know xdrmem_create() succeeds */
-+ caddr_t x_addr; /* Current buffer addr */
-+ caddr_t x_addr_end; /* End of the buffer */
-+ enum xdr_op x_op; /* Stream direction */
- } XDR;
-
- typedef bool_t (*xdrproc_t)(XDR *xdrs, void *ptr);
-@@ -56,13 +55,13 @@ struct xdr_ops {
- bool_t (*xdr_opaque)(XDR *, caddr_t, const uint_t);
- bool_t (*xdr_string)(XDR *, char **, const uint_t);
- bool_t (*xdr_array)(XDR *, caddr_t *, uint_t *, const uint_t,
-- const uint_t, const xdrproc_t);
-+ const uint_t, const xdrproc_t);
- };
-
- /*
- * XDR control operator.
- */
--#define XDR_GET_BYTES_AVAIL 1
-+#define XDR_GET_BYTES_AVAIL 1
-
- struct xdr_bytesrec {
- bool_t xc_is_last_record;
-@@ -74,11 +73,12 @@ struct xdr_bytesrec {
- */
- void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size,
- const enum xdr_op op);
--#define xdr_destroy(xdrs) ((void) 0) /* Currently not needed. If needed later,
-- we'll add it to struct xdr_ops */
-
--#define xdr_control(xdrs, req, info) (xdrs)->x_ops->xdr_control((xdrs), \
-- (req), (info))
-+/* Currently not needed. If needed later, we'll add it to struct xdr_ops */
-+#define xdr_destroy(xdrs) ((void) 0)
-+
-+#define xdr_control(xdrs, req, info) \
-+ (xdrs)->x_ops->xdr_control((xdrs), (req), (info))
-
- /*
- * For precaution, the following are defined as static inlines instead of macros
-@@ -89,40 +89,40 @@ void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size,
- */
- static inline bool_t xdr_char(XDR *xdrs, char *cp)
- {
-- return xdrs->x_ops->xdr_char(xdrs, cp);
-+ return (xdrs->x_ops->xdr_char(xdrs, cp));
- }
-
- static inline bool_t xdr_u_short(XDR *xdrs, unsigned short *usp)
- {
-- return xdrs->x_ops->xdr_u_short(xdrs, usp);
-+ return (xdrs->x_ops->xdr_u_short(xdrs, usp));
- }
-
- static inline bool_t xdr_short(XDR *xdrs, short *sp)
- {
-- BUILD_BUG_ON(sizeof(short) != 2);
-- return xdrs->x_ops->xdr_u_short(xdrs, (unsigned short *) sp);
-+ BUILD_BUG_ON(sizeof (short) != 2);
-+ return (xdrs->x_ops->xdr_u_short(xdrs, (unsigned short *) sp));
- }
-
- static inline bool_t xdr_u_int(XDR *xdrs, unsigned *up)
- {
-- return xdrs->x_ops->xdr_u_int(xdrs, up);
-+ return (xdrs->x_ops->xdr_u_int(xdrs, up));
- }
-
- static inline bool_t xdr_int(XDR *xdrs, int *ip)
- {
-- BUILD_BUG_ON(sizeof(int) != 4);
-- return xdrs->x_ops->xdr_u_int(xdrs, (unsigned *) ip);
-+ BUILD_BUG_ON(sizeof (int) != 4);
-+ return (xdrs->x_ops->xdr_u_int(xdrs, (unsigned *)ip));
- }
-
- static inline bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp)
- {
-- return xdrs->x_ops->xdr_u_longlong_t(xdrs, ullp);
-+ return (xdrs->x_ops->xdr_u_longlong_t(xdrs, ullp));
- }
-
- static inline bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp)
- {
-- BUILD_BUG_ON(sizeof(longlong_t) != 8);
-- return xdrs->x_ops->xdr_u_longlong_t(xdrs, (u_longlong_t *) llp);
-+ BUILD_BUG_ON(sizeof (longlong_t) != 8);
-+ return (xdrs->x_ops->xdr_u_longlong_t(xdrs, (u_longlong_t *)llp));
- }
-
- /*
-@@ -130,7 +130,7 @@ static inline bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp)
- */
- static inline bool_t xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt)
- {
-- return xdrs->x_ops->xdr_opaque(xdrs, cp, cnt);
-+ return (xdrs->x_ops->xdr_opaque(xdrs, cp, cnt));
- }
-
- /*
-@@ -139,7 +139,7 @@ static inline bool_t xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt)
- */
- static inline bool_t xdr_string(XDR *xdrs, char **sp, const uint_t maxsize)
- {
-- return xdrs->x_ops->xdr_string(xdrs, sp, maxsize);
-+ return (xdrs->x_ops->xdr_string(xdrs, sp, maxsize));
- }
-
- /*
-diff --git a/include/sharefs/share.h b/include/sharefs/share.h
-index fc248a2..13f0d9a 100644
---- a/include/sharefs/share.h
-+++ b/include/sharefs/share.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SHARE_H
--#define _SPL_SHARE_H
-+#define _SPL_SHARE_H
-
- #endif /* SPL_SHARE_H */
-diff --git a/include/spl-ctl.h b/include/spl-ctl.h
-index bb24490..a31a0af 100644
---- a/include/spl-ctl.h
-+++ b/include/spl-ctl.h
-@@ -23,23 +23,23 @@
- \*****************************************************************************/
-
- #ifndef _DEBUG_CTL_H
--#define _DEBUG_CTL_H
-+#define _DEBUG_CTL_H
-
- /*
- * Contains shared definitions which both the user space
- * and kernel space portions of splat must agree on.
- */
- typedef struct spl_debug_header {
-- int ph_len;
-- int ph_flags;
-- int ph_subsys;
-- int ph_mask;
-- int ph_cpu_id;
-- int ph_sec;
-- long ph_usec;
-- int ph_stack;
-- int ph_pid;
-- int ph_line_num;
-+ int ph_len;
-+ int ph_flags;
-+ int ph_subsys;
-+ int ph_mask;
-+ int ph_cpu_id;
-+ int ph_sec;
-+ long ph_usec;
-+ int ph_stack;
-+ int ph_pid;
-+ int ph_line_num;
- } spl_debug_header_t;
-
- #endif /* _DEBUG_CTL_H */
-diff --git a/include/splat-ctl.h b/include/splat-ctl.h
-index 15fd01b..d049551 100644
---- a/include/splat-ctl.h
-+++ b/include/splat-ctl.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPLAT_CTL_H
--#define _SPLAT_CTL_H
-+#define _SPLAT_CTL_H
-
- #include <linux/types.h>
-
-@@ -32,11 +32,11 @@
- * ensure 32-bit/64-bit interoperability over ioctl()'s only types with
- * fixed sizes can be used.
- */
--#define SPLAT_NAME "splatctl"
--#define SPLAT_DEV "/dev/splatctl"
-+#define SPLAT_NAME "splatctl"
-+#define SPLAT_DEV "/dev/splatctl"
-
--#define SPLAT_NAME_SIZE 20
--#define SPLAT_DESC_SIZE 60
-+#define SPLAT_NAME_SIZE 20
-+#define SPLAT_DESC_SIZE 60
-
- typedef struct splat_user {
- char name[SPLAT_NAME_SIZE]; /* Short name */
-@@ -72,38 +72,38 @@ typedef struct splat_cmd {
- } splat_cmd_t;
-
- /* Valid ioctls */
--#define SPLAT_CFG _IOWR('f', 101, splat_cfg_t)
--#define SPLAT_CMD _IOWR('f', 102, splat_cmd_t)
-+#define SPLAT_CFG _IOWR('f', 101, splat_cfg_t)
-+#define SPLAT_CMD _IOWR('f', 102, splat_cmd_t)
-
- /* Valid configuration commands */
--#define SPLAT_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */
--#define SPLAT_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */
--#define SPLAT_CFG_SUBSYSTEM_COUNT 0x101 /* Number of subsystem */
--#define SPLAT_CFG_SUBSYSTEM_LIST 0x102 /* List of N subsystems */
--#define SPLAT_CFG_TEST_COUNT 0x201 /* Number of tests */
--#define SPLAT_CFG_TEST_LIST 0x202 /* List of N tests */
-+#define SPLAT_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */
-+#define SPLAT_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */
-+#define SPLAT_CFG_SUBSYSTEM_COUNT 0x101 /* Number of subsystem */
-+#define SPLAT_CFG_SUBSYSTEM_LIST 0x102 /* List of N subsystems */
-+#define SPLAT_CFG_TEST_COUNT 0x201 /* Number of tests */
-+#define SPLAT_CFG_TEST_LIST 0x202 /* List of N tests */
-
- /*
- * Valid subsystem and test commands are defined in each subsystem as
- * SPLAT_SUBSYSTEM_*. We do need to be careful to avoid collisions, the
- * currently defined subsystems are as follows:
- */
--#define SPLAT_SUBSYSTEM_KMEM 0x0100
--#define SPLAT_SUBSYSTEM_TASKQ 0x0200
--#define SPLAT_SUBSYSTEM_KRNG 0x0300
--#define SPLAT_SUBSYSTEM_MUTEX 0x0400
--#define SPLAT_SUBSYSTEM_CONDVAR 0x0500
--#define SPLAT_SUBSYSTEM_THREAD 0x0600
--#define SPLAT_SUBSYSTEM_RWLOCK 0x0700
--#define SPLAT_SUBSYSTEM_TIME 0x0800
--#define SPLAT_SUBSYSTEM_VNODE 0x0900
--#define SPLAT_SUBSYSTEM_KOBJ 0x0a00
--#define SPLAT_SUBSYSTEM_ATOMIC 0x0b00
--#define SPLAT_SUBSYSTEM_LIST 0x0c00
--#define SPLAT_SUBSYSTEM_GENERIC 0x0d00
--#define SPLAT_SUBSYSTEM_CRED 0x0e00
--#define SPLAT_SUBSYSTEM_ZLIB 0x0f00
--#define SPLAT_SUBSYSTEM_LINUX 0x1000
--#define SPLAT_SUBSYSTEM_UNKNOWN 0xff00
-+#define SPLAT_SUBSYSTEM_KMEM 0x0100
-+#define SPLAT_SUBSYSTEM_TASKQ 0x0200
-+#define SPLAT_SUBSYSTEM_KRNG 0x0300
-+#define SPLAT_SUBSYSTEM_MUTEX 0x0400
-+#define SPLAT_SUBSYSTEM_CONDVAR 0x0500
-+#define SPLAT_SUBSYSTEM_THREAD 0x0600
-+#define SPLAT_SUBSYSTEM_RWLOCK 0x0700
-+#define SPLAT_SUBSYSTEM_TIME 0x0800
-+#define SPLAT_SUBSYSTEM_VNODE 0x0900
-+#define SPLAT_SUBSYSTEM_KOBJ 0x0a00
-+#define SPLAT_SUBSYSTEM_ATOMIC 0x0b00
-+#define SPLAT_SUBSYSTEM_LIST 0x0c00
-+#define SPLAT_SUBSYSTEM_GENERIC 0x0d00
-+#define SPLAT_SUBSYSTEM_CRED 0x0e00
-+#define SPLAT_SUBSYSTEM_ZLIB 0x0f00
-+#define SPLAT_SUBSYSTEM_LINUX 0x1000
-+#define SPLAT_SUBSYSTEM_UNKNOWN 0xff00
-
- #endif /* _SPLAT_CTL_H */
-diff --git a/include/strings.h b/include/strings.h
-index dc0f314..d0cf1e0 100644
---- a/include/strings.h
-+++ b/include/strings.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_STRINGS_H
--#define _SPL_STRINGS_H
-+#define _SPL_STRINGS_H
-
- #endif /* SPL_STRINGS_H */
-diff --git a/include/sys/acl.h b/include/sys/acl.h
-index f4a3de5..34f4508 100644
---- a/include/sys/acl.h
-+++ b/include/sys/acl.h
-@@ -23,95 +23,97 @@
- \*****************************************************************************/
-
- #ifndef _SPL_ACL_H
--#define _SPL_ACL_H
-+#define _SPL_ACL_H
-
- #include <sys/types.h>
-
- typedef struct ace {
-- uid_t a_who;
-- uint32_t a_access_mask;
-- uint16_t a_flags;
-- uint16_t a_type;
-+ uid_t a_who;
-+ uint32_t a_access_mask;
-+ uint16_t a_flags;
-+ uint16_t a_type;
- } ace_t;
-
- typedef struct ace_object {
-- uid_t a_who; /* uid or gid */
-- uint32_t a_access_mask; /* read,write,... */
-- uint16_t a_flags; /* see below */
-- uint16_t a_type; /* allow or deny */
-- uint8_t a_obj_type[16]; /* obj type */
-- uint8_t a_inherit_obj_type[16]; /* inherit obj */
-+ uid_t a_who; /* uid or gid */
-+ uint32_t a_access_mask; /* read,write,... */
-+ uint16_t a_flags; /* see below */
-+ uint16_t a_type; /* allow or deny */
-+ uint8_t a_obj_type[16]; /* obj type */
-+ uint8_t a_inherit_obj_type[16]; /* inherit obj */
- } ace_object_t;
-
--#define MAX_ACL_ENTRIES 1024
-+#define MAX_ACL_ENTRIES 1024
-
--#define ACE_READ_DATA 0x00000001
--#define ACE_LIST_DIRECTORY 0x00000001
--#define ACE_WRITE_DATA 0x00000002
--#define ACE_ADD_FILE 0x00000002
--#define ACE_APPEND_DATA 0x00000004
--#define ACE_ADD_SUBDIRECTORY 0x00000004
--#define ACE_READ_NAMED_ATTRS 0x00000008
--#define ACE_WRITE_NAMED_ATTRS 0x00000010
--#define ACE_EXECUTE 0x00000020
--#define ACE_DELETE_CHILD 0x00000040
--#define ACE_READ_ATTRIBUTES 0x00000080
--#define ACE_WRITE_ATTRIBUTES 0x00000100
--#define ACE_DELETE 0x00010000
--#define ACE_READ_ACL 0x00020000
--#define ACE_WRITE_ACL 0x00040000
--#define ACE_WRITE_OWNER 0x00080000
--#define ACE_SYNCHRONIZE 0x00100000
-+#define ACE_READ_DATA 0x00000001
-+#define ACE_LIST_DIRECTORY 0x00000001
-+#define ACE_WRITE_DATA 0x00000002
-+#define ACE_ADD_FILE 0x00000002
-+#define ACE_APPEND_DATA 0x00000004
-+#define ACE_ADD_SUBDIRECTORY 0x00000004
-+#define ACE_READ_NAMED_ATTRS 0x00000008
-+#define ACE_WRITE_NAMED_ATTRS 0x00000010
-+#define ACE_EXECUTE 0x00000020
-+#define ACE_DELETE_CHILD 0x00000040
-+#define ACE_READ_ATTRIBUTES 0x00000080
-+#define ACE_WRITE_ATTRIBUTES 0x00000100
-+#define ACE_DELETE 0x00010000
-+#define ACE_READ_ACL 0x00020000
-+#define ACE_WRITE_ACL 0x00040000
-+#define ACE_WRITE_OWNER 0x00080000
-+#define ACE_SYNCHRONIZE 0x00100000
-
--#define ACE_FILE_INHERIT_ACE 0x0001
--#define ACE_DIRECTORY_INHERIT_ACE 0x0002
--#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004
--#define ACE_INHERIT_ONLY_ACE 0x0008
--#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010
--#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020
--#define ACE_IDENTIFIER_GROUP 0x0040
--#define ACE_INHERITED_ACE 0x0080
--#define ACE_OWNER 0x1000
--#define ACE_GROUP 0x2000
--#define ACE_EVERYONE 0x4000
-+#define ACE_FILE_INHERIT_ACE 0x0001
-+#define ACE_DIRECTORY_INHERIT_ACE 0x0002
-+#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004
-+#define ACE_INHERIT_ONLY_ACE 0x0008
-+#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010
-+#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020
-+#define ACE_IDENTIFIER_GROUP 0x0040
-+#define ACE_INHERITED_ACE 0x0080
-+#define ACE_OWNER 0x1000
-+#define ACE_GROUP 0x2000
-+#define ACE_EVERYONE 0x4000
-
--#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000
--#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001
--#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002
--#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003
-+#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000
-+#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001
-+#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002
-+#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003
-
--#define ACL_AUTO_INHERIT 0x0001
--#define ACL_PROTECTED 0x0002
--#define ACL_DEFAULTED 0x0004
--#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED)
-+#define ACL_AUTO_INHERIT 0x0001
-+#define ACL_PROTECTED 0x0002
-+#define ACL_DEFAULTED 0x0004
-+#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED)
-
--#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04
--#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05
--#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06
--#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
--#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
--#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09
--#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A
--#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B
--#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C
--#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D
--#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E
--#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F
--#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
-+#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04
-+#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05
-+#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06
-+#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
-+#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
-+#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09
-+#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A
-+#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B
-+#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C
-+#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D
-+#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E
-+#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F
-+#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
-
--#define ACE_ALL_TYPES 0x001F
-+#define ACE_ALL_TYPES 0x001F
-
--#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP)
-+#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP)
-
--#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \
-+/* BEGIN CSTYLED */
-+#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \
- ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS| \
- ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES| \
- ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \
- ACE_WRITE_OWNER|ACE_SYNCHRONIZE)
-+/* END CSTYLED */
-
--#define VSA_ACE 0x0010
--#define VSA_ACECNT 0x0020
--#define VSA_ACE_ALLTYPES 0x0040
--#define VSA_ACE_ACLFLAGS 0x0080
-+#define VSA_ACE 0x0010
-+#define VSA_ACECNT 0x0020
-+#define VSA_ACE_ALLTYPES 0x0040
-+#define VSA_ACE_ACLFLAGS 0x0080
-
- #endif /* _SPL_ACL_H */
-diff --git a/include/sys/acl_impl.h b/include/sys/acl_impl.h
-index 67af713..c96cc52 100644
---- a/include/sys/acl_impl.h
-+++ b/include/sys/acl_impl.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_ACL_IMPL_H
--#define _SPL_ACL_IMPL_H
-+#define _SPL_ACL_IMPL_H
-
- #endif /* _SPL_ACL_IMPL_H */
-diff --git a/include/sys/atomic.h b/include/sys/atomic.h
-index 07b460e..1f730e2 100644
---- a/include/sys/atomic.h
-+++ b/include/sys/atomic.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_ATOMIC_H
--#define _SPL_ATOMIC_H
-+#define _SPL_ATOMIC_H
-
- #include <linux/module.h>
- #include <linux/spinlock.h>
-@@ -91,7 +91,7 @@ atomic_inc_32_nv(volatile uint32_t *target)
- nv = ++(*target);
- spin_unlock(&atomic32_lock);
-
-- return nv;
-+ return (nv);
- }
-
- static __inline__ uint32_t
-@@ -103,7 +103,7 @@ atomic_dec_32_nv(volatile uint32_t *target)
- nv = --(*target);
- spin_unlock(&atomic32_lock);
-
-- return nv;
-+ return (nv);
- }
-
- static __inline__ uint32_t
-@@ -116,7 +116,7 @@ atomic_add_32_nv(volatile uint32_t *target, uint32_t delta)
- nv = *target;
- spin_unlock(&atomic32_lock);
-
-- return nv;
-+ return (nv);
- }
-
- static __inline__ uint32_t
-@@ -129,12 +129,11 @@ atomic_sub_32_nv(volatile uint32_t *target, uint32_t delta)
- nv = *target;
- spin_unlock(&atomic32_lock);
-
-- return nv;
-+ return (nv);
- }
-
- static __inline__ uint32_t
--atomic_cas_32(volatile uint32_t *target, uint32_t cmp,
-- uint32_t newval)
-+atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval)
- {
- uint32_t rc;
-
-@@ -145,7 +144,7 @@ atomic_cas_32(volatile uint32_t *target, uint32_t cmp,
-
- spin_unlock(&atomic32_lock);
-
-- return rc;
-+ return (rc);
- }
-
- static __inline__ uint32_t
-@@ -158,7 +157,7 @@ atomic_swap_32(volatile uint32_t *target, uint32_t newval)
- *target = newval;
- spin_unlock(&atomic32_lock);
-
-- return rc;
-+ return (rc);
- }
-
- static __inline__ void
-@@ -202,7 +201,7 @@ atomic_inc_64_nv(volatile uint64_t *target)
- nv = ++(*target);
- spin_unlock(&atomic64_lock);
-
-- return nv;
-+ return (nv);
- }
-
- static __inline__ uint64_t
-@@ -214,7 +213,7 @@ atomic_dec_64_nv(volatile uint64_t *target)
- nv = --(*target);
- spin_unlock(&atomic64_lock);
-
-- return nv;
-+ return (nv);
- }
-
- static __inline__ uint64_t
-@@ -227,7 +226,7 @@ atomic_add_64_nv(volatile uint64_t *target, uint64_t delta)
- nv = *target;
- spin_unlock(&atomic64_lock);
-
-- return nv;
-+ return (nv);
- }
-
- static __inline__ uint64_t
-@@ -240,12 +239,11 @@ atomic_sub_64_nv(volatile uint64_t *target, uint64_t delta)
- nv = *target;
- spin_unlock(&atomic64_lock);
-
-- return nv;
-+ return (nv);
- }
-
- static __inline__ uint64_t
--atomic_cas_64(volatile uint64_t *target, uint64_t cmp,
-- uint64_t newval)
-+atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval)
- {
- uint64_t rc;
-
-@@ -255,7 +253,7 @@ atomic_cas_64(volatile uint64_t *target, uint64_t cmp,
- *target = newval;
- spin_unlock(&atomic64_lock);
-
-- return rc;
-+ return (rc);
- }
-
- static __inline__ uint64_t
-@@ -268,31 +266,31 @@ atomic_swap_64(volatile uint64_t *target, uint64_t newval)
- *target = newval;
- spin_unlock(&atomic64_lock);
-
-- return rc;
-+ return (rc);
- }
-
- #else /* ATOMIC_SPINLOCK */
-
--#define atomic_inc_32(v) atomic_inc((atomic_t *)(v))
--#define atomic_dec_32(v) atomic_dec((atomic_t *)(v))
--#define atomic_add_32(v, i) atomic_add((i), (atomic_t *)(v))
--#define atomic_sub_32(v, i) atomic_sub((i), (atomic_t *)(v))
--#define atomic_inc_32_nv(v) atomic_inc_return((atomic_t *)(v))
--#define atomic_dec_32_nv(v) atomic_dec_return((atomic_t *)(v))
--#define atomic_add_32_nv(v, i) atomic_add_return((i), (atomic_t *)(v))
--#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v))
--#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y)
--#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x)
--#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v))
--#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v))
--#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v))
--#define atomic_sub_64(v, i) atomic64_sub((i), (atomic64_t *)(v))
--#define atomic_inc_64_nv(v) atomic64_inc_return((atomic64_t *)(v))
--#define atomic_dec_64_nv(v) atomic64_dec_return((atomic64_t *)(v))
--#define atomic_add_64_nv(v, i) atomic64_add_return((i), (atomic64_t *)(v))
--#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v))
--#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y)
--#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x)
-+#define atomic_inc_32(v) atomic_inc((atomic_t *)(v))
-+#define atomic_dec_32(v) atomic_dec((atomic_t *)(v))
-+#define atomic_add_32(v, i) atomic_add((i), (atomic_t *)(v))
-+#define atomic_sub_32(v, i) atomic_sub((i), (atomic_t *)(v))
-+#define atomic_inc_32_nv(v) atomic_inc_return((atomic_t *)(v))
-+#define atomic_dec_32_nv(v) atomic_dec_return((atomic_t *)(v))
-+#define atomic_add_32_nv(v, i) atomic_add_return((i), (atomic_t *)(v))
-+#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v))
-+#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y)
-+#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x)
-+#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v))
-+#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v))
-+#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v))
-+#define atomic_sub_64(v, i) atomic64_sub((i), (atomic64_t *)(v))
-+#define atomic_inc_64_nv(v) atomic64_inc_return((atomic64_t *)(v))
-+#define atomic_dec_64_nv(v) atomic64_dec_return((atomic64_t *)(v))
-+#define atomic_add_64_nv(v, i) atomic64_add_return((i), (atomic64_t *)(v))
-+#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v))
-+#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y)
-+#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x)
-
- #endif /* ATOMIC_SPINLOCK */
-
-@@ -300,15 +298,15 @@ atomic_swap_64(volatile uint64_t *target, uint64_t newval)
- static __inline__ void *
- atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
- {
-- return (void *)atomic_cas_64((volatile uint64_t *)target,
-- (uint64_t)cmp, (uint64_t)newval);
-+ return ((void *)atomic_cas_64((volatile uint64_t *)target,
-+ (uint64_t)cmp, (uint64_t)newval));
- }
- #else /* _LP64 */
- static __inline__ void *
- atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
- {
-- return (void *)atomic_cas_32((volatile uint32_t *)target,
-- (uint32_t)cmp, (uint32_t)newval);
-+ return ((void *)atomic_cas_32((volatile uint32_t *)target,
-+ (uint32_t)cmp, (uint32_t)newval));
- }
- #endif /* _LP64 */
-
-diff --git a/include/sys/attr.h b/include/sys/attr.h
-index 5fb609c..48c5e26 100644
---- a/include/sys/attr.h
-+++ b/include/sys/attr.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_ATTR_H
--#define _SPL_ATTR_H
-+#define _SPL_ATTR_H
-
- #endif /* SPL_ATTR_H */
-diff --git a/include/sys/bitmap.h b/include/sys/bitmap.h
-index e4acb0b..d940c14 100644
---- a/include/sys/bitmap.h
-+++ b/include/sys/bitmap.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_BITMAP_H
--#define _SPL_BITMAP_H
-+#define _SPL_BITMAP_H
-
- #endif /* SPL_BITMAP_H */
-diff --git a/include/sys/bootconf.h b/include/sys/bootconf.h
-index 4e032ad..d83a478 100644
---- a/include/sys/bootconf.h
-+++ b/include/sys/bootconf.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_BOOTCONF_H
--#define _SPL_BOOTCONF_H
-+#define _SPL_BOOTCONF_H
-
- #endif /* SPL_BOOTCONF_H */
-diff --git a/include/sys/bootprops.h b/include/sys/bootprops.h
-index a562ec9..ac54bc2 100644
---- a/include/sys/bootprops.h
-+++ b/include/sys/bootprops.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_BOOTPROPS_H
--#define _SPL_BOOTPROPS_H
-+#define _SPL_BOOTPROPS_H
-
- #endif /* SPL_BOOTPROPS_H */
-diff --git a/include/sys/buf.h b/include/sys/buf.h
-index 8596c83..6879188 100644
---- a/include/sys/buf.h
-+++ b/include/sys/buf.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_BUF_H
--#define _SPL_BUF_H
-+#define _SPL_BUF_H
-
- #endif /* SPL_BUF_H */
-diff --git a/include/sys/byteorder.h b/include/sys/byteorder.h
-index 184b52d..2034f22 100644
---- a/include/sys/byteorder.h
-+++ b/include/sys/byteorder.h
-@@ -23,45 +23,49 @@
- \*****************************************************************************/
-
- #ifndef _SPL_BYTEORDER_H
--#define _SPL_BYTEORDER_H
-+#define _SPL_BYTEORDER_H
-
- #include <asm/byteorder.h>
- #include <sys/isa_defs.h>
-
--#define LE_16(x) cpu_to_le16(x)
--#define LE_32(x) cpu_to_le32(x)
--#define LE_64(x) cpu_to_le64(x)
--#define BE_16(x) cpu_to_be16(x)
--#define BE_32(x) cpu_to_be32(x)
--#define BE_64(x) cpu_to_be64(x)
-+#define LE_16(x) cpu_to_le16(x)
-+#define LE_32(x) cpu_to_le32(x)
-+#define LE_64(x) cpu_to_le64(x)
-+#define BE_16(x) cpu_to_be16(x)
-+#define BE_32(x) cpu_to_be32(x)
-+#define BE_64(x) cpu_to_be64(x)
-
--#define BE_IN8(xa) \
-+#define BE_IN8(xa) \
- *((uint8_t *)(xa))
-
--#define BE_IN16(xa) \
-+#define BE_IN16(xa) \
- (((uint16_t)BE_IN8(xa) << 8) | BE_IN8((uint8_t *)(xa)+1))
-
--#define BE_IN32(xa) \
-+#define BE_IN32(xa) \
- (((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2))
-
- #ifdef _BIG_ENDIAN
- static __inline__ uint64_t
--htonll(uint64_t n) {
-+htonll(uint64_t n)
-+{
- return (n);
- }
-
- static __inline__ uint64_t
--ntohll(uint64_t n) {
-+ntohll(uint64_t n)
-+{
- return (n);
- }
- #else
- static __inline__ uint64_t
--htonll(uint64_t n) {
-+htonll(uint64_t n)
-+{
- return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32));
- }
-
- static __inline__ uint64_t
--ntohll(uint64_t n) {
-+ntohll(uint64_t n)
-+{
- return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32));
- }
- #endif
-diff --git a/include/sys/callb.h b/include/sys/callb.h
-index fbe4128..33e12b8 100644
---- a/include/sys/callb.h
-+++ b/include/sys/callb.h
-@@ -23,33 +23,32 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CALLB_H
--#define _SPL_CALLB_H
-+#define _SPL_CALLB_H
-
- #include <linux/module.h>
- #include <sys/mutex.h>
-
--#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp));
-+#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp));
-
- typedef struct callb_cpr {
-- kmutex_t *cc_lockp;
-+ kmutex_t *cc_lockp;
- } callb_cpr_t;
-
--#define CALLB_CPR_INIT(cp, lockp, func, name) { \
-- (cp)->cc_lockp = lockp; \
-+#define CALLB_CPR_INIT(cp, lockp, func, name) { \
-+ (cp)->cc_lockp = lockp; \
- }
-
--#define CALLB_CPR_SAFE_BEGIN(cp) { \
-+#define CALLB_CPR_SAFE_BEGIN(cp) { \
- CALLB_CPR_ASSERT(cp); \
- }
-
--#define CALLB_CPR_SAFE_END(cp, lockp) { \
-+#define CALLB_CPR_SAFE_END(cp, lockp) { \
- CALLB_CPR_ASSERT(cp); \
- }
-
--#define CALLB_CPR_EXIT(cp) { \
-- ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
-- mutex_exit((cp)->cc_lockp); \
-+#define CALLB_CPR_EXIT(cp) { \
-+ ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
-+ mutex_exit((cp)->cc_lockp); \
- }
-
- #endif /* _SPL_CALLB_H */
--
-diff --git a/include/sys/callo.h b/include/sys/callo.h
-index 0d9fbcb..c7eea68 100644
---- a/include/sys/callo.h
-+++ b/include/sys/callo.h
-@@ -22,7 +22,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CALLO_H
--#define _SPL_CALLO_H
-+#define _SPL_CALLO_H
-
- /*
- * Callout flags:
-@@ -44,9 +44,9 @@
- * Legacy interfaces timeout() and realtime_timeout() pass this flag
- * to timeout_generic() to indicate that a 32-bit ID should be allocated.
- */
--#define CALLOUT_FLAG_ROUNDUP 0x1
--#define CALLOUT_FLAG_ABSOLUTE 0x2
--#define CALLOUT_FLAG_HRESTIME 0x4
--#define CALLOUT_FLAG_32BIT 0x8
-+#define CALLOUT_FLAG_ROUNDUP 0x1
-+#define CALLOUT_FLAG_ABSOLUTE 0x2
-+#define CALLOUT_FLAG_HRESTIME 0x4
-+#define CALLOUT_FLAG_32BIT 0x8
-
- #endif /* _SPL_CALLB_H */
-diff --git a/include/sys/cmn_err.h b/include/sys/cmn_err.h
-index 1291510..f1c077e 100644
---- a/include/sys/cmn_err.h
-+++ b/include/sys/cmn_err.h
-@@ -23,20 +23,20 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CMN_ERR_H
--#define _SPL_CMN_ERR_H
-+#define _SPL_CMN_ERR_H
-
- #include <sys/varargs.h>
-
--#define CE_CONT 0 /* continuation */
--#define CE_NOTE 1 /* notice */
--#define CE_WARN 2 /* warning */
--#define CE_PANIC 3 /* panic */
--#define CE_IGNORE 4 /* print nothing */
-+#define CE_CONT 0 /* continuation */
-+#define CE_NOTE 1 /* notice */
-+#define CE_WARN 2 /* warning */
-+#define CE_PANIC 3 /* panic */
-+#define CE_IGNORE 4 /* print nothing */
-
- extern void cmn_err(int, const char *, ...);
- extern void vcmn_err(int, const char *, __va_list);
- extern void vpanic(const char *, __va_list);
-
--#define fm_panic panic
-+#define fm_panic panic
-
- #endif /* SPL_CMN_ERR_H */
-diff --git a/include/sys/compress.h b/include/sys/compress.h
-index 55822f0..1a946ce 100644
---- a/include/sys/compress.h
-+++ b/include/sys/compress.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_COMPRESS_H
--#define _SPL_COMPRESS_H
-+#define _SPL_COMPRESS_H
-
- #endif /* SPL_COMPRESS_H */
-diff --git a/include/sys/conf.h b/include/sys/conf.h
-index eece0c7..e4c8f6c 100644
---- a/include/sys/conf.h
-+++ b/include/sys/conf.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CONF_H
--#define _SPL_CONF_H
-+#define _SPL_CONF_H
-
- #endif /* SPL_CONF_H */
-diff --git a/include/sys/console.h b/include/sys/console.h
-index 76ef618..dfa38c9 100644
---- a/include/sys/console.h
-+++ b/include/sys/console.h
-@@ -28,17 +28,17 @@
- void
- console_vprintf(const char *fmt, va_list args)
- {
-- vprintk(fmt, args);
-+ vprintk(fmt, args);
- }
-
- void
- console_printf(const char *fmt, ...)
- {
-- va_list args;
-+ va_list args;
-
-- va_start(args, fmt);
-- console_vprintf(fmt, args);
-- va_end(args);
-+ va_start(args, fmt);
-+ console_vprintf(fmt, args);
-+ va_end(args);
- }
-
- #endif /* _SPL_CONSOLE_H */
-diff --git a/include/sys/cpupart.h b/include/sys/cpupart.h
-index fddeed6..eb819ff 100644
---- a/include/sys/cpupart.h
-+++ b/include/sys/cpupart.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CPUPART_H
--#define _SPL_CPUPART_H
-+#define _SPL_CPUPART_H
-
- #endif /* SPL_CPUPART_H */
-diff --git a/include/sys/cpuvar.h b/include/sys/cpuvar.h
-index 1284f94..6963067 100644
---- a/include/sys/cpuvar.h
-+++ b/include/sys/cpuvar.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CPUVAR_H
--#define _SPL_CPUVAR_H
-+#define _SPL_CPUVAR_H
-
- #endif /* SPL_CPUVAR_H */
-diff --git a/include/sys/crc32.h b/include/sys/crc32.h
-index 1981f35..c14384a 100644
---- a/include/sys/crc32.h
-+++ b/include/sys/crc32.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CRC32_H
--#define _SPL_CRC32_H
-+#define _SPL_CRC32_H
-
- #endif /* SPL_CRC32_H */
-diff --git a/include/sys/cred.h b/include/sys/cred.h
-index 2ad7115..3e96a07 100644
---- a/include/sys/cred.h
-+++ b/include/sys/cred.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CRED_H
--#define _SPL_CRED_H
-+#define _SPL_CRED_H
-
- #include <linux/module.h>
- #include <sys/types.h>
-@@ -68,7 +68,7 @@ extern gid_t crgetrgid(const cred_t *cr);
- extern gid_t crgetsgid(const cred_t *cr);
- extern gid_t crgetfsgid(const cred_t *cr);
- extern int crgetngroups(const cred_t *cr);
--extern gid_t * crgetgroups(const cred_t *cr);
-+extern gid_t *crgetgroups(const cred_t *cr);
- extern int groupmember(gid_t gid, const cred_t *cr);
-
- #endif /* _SPL_CRED_H */
-diff --git a/include/sys/ctype.h b/include/sys/ctype.h
-index 52037f9..86f29de 100644
---- a/include/sys/ctype.h
-+++ b/include/sys/ctype.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_CTYPE_H
--#define _SPL_CTYPE_H
-+#define _SPL_CTYPE_H
-
- #include <linux/ctype.h>
-
-diff --git a/include/sys/ddi.h b/include/sys/ddi.h
-index 2fa1388..b0af3cb 100644
---- a/include/sys/ddi.h
-+++ b/include/sys/ddi.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_DDI_H
--#define _SPL_DDI_H
-+#define _SPL_DDI_H
-
- #endif /* SPL_DDI_H */
-diff --git a/include/sys/debug.h b/include/sys/debug.h
-index 98ccbaf..6d683c2 100644
---- a/include/sys/debug.h
-+++ b/include/sys/debug.h
-@@ -54,16 +54,17 @@ int spl_panic(const char *file, const char *func, int line,
- const char *fmt, ...);
- void spl_dumpstack(void);
-
-+/* BEGIN CSTYLED */
- #define PANIC(fmt, a...) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a)
-
- #define VERIFY(cond) \
-- (void)(unlikely(!(cond)) && \
-+ (void) (unlikely(!(cond)) && \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "%s", "VERIFY(" #cond ") failed\n"))
-
- #define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \
-- (void)((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \
-+ (void) ((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
- "failed (" FMT " " #OP " " FMT ")\n", \
-@@ -120,6 +121,7 @@ void spl_dumpstack(void);
- ((void)((!!(A) == !!(B)) || \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "(" #A ") is equivalent to (" #B ")")))
-+/* END CSTYLED */
-
- #endif /* NDEBUG */
-
-diff --git a/include/sys/dirent.h b/include/sys/dirent.h
-index 68f75da..8a33588 100644
---- a/include/sys/dirent.h
-+++ b/include/sys/dirent.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_DIRENT_H
--#define _SPL_DIRENT_H
-+#define _SPL_DIRENT_H
-
- #endif /* SPL_DIRENT_H */
-diff --git a/include/sys/disp.h b/include/sys/disp.h
-index c3077a7..7f5ec85 100644
---- a/include/sys/disp.h
-+++ b/include/sys/disp.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_DISP_H
--#define _SPL_DISP_H
-+#define _SPL_DISP_H
-
- #include <linux/preempt.h>
-
-diff --git a/include/sys/dkioc_free_util.h b/include/sys/dkioc_free_util.h
-index bea5a5b..6b1b941 100644
---- a/include/sys/dkioc_free_util.h
-+++ b/include/sys/dkioc_free_util.h
-@@ -52,7 +52,7 @@ static inline void dfl_free(dkioc_free_list_t *dfl) {
- }
-
- static inline dkioc_free_list_t *dfl_alloc(uint64_t dfl_num_exts, int flags) {
-- return vmem_zalloc(DFL_SZ(dfl_num_exts), flags);
-+ return (vmem_zalloc(DFL_SZ(dfl_num_exts), flags));
- }
-
- #endif /* _SPL_DKIOC_UTIL_H */
-diff --git a/include/sys/dnlc.h b/include/sys/dnlc.h
-index 99d16c8..2014af5 100644
---- a/include/sys/dnlc.h
-+++ b/include/sys/dnlc.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_DNLC_H
--#define _SPL_DNLC_H
-+#define _SPL_DNLC_H
-
- #endif /* SPL_DNLC_H */
-diff --git a/include/sys/dumphdr.h b/include/sys/dumphdr.h
-index 1b45058..84c5b76 100644
---- a/include/sys/dumphdr.h
-+++ b/include/sys/dumphdr.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_DUMPHDR_H
--#define _SPL_DUMPHDR_H
-+#define _SPL_DUMPHDR_H
-
- #endif /* SPL_DUMPHDR_H */
-diff --git a/include/sys/efi_partition.h b/include/sys/efi_partition.h
-index c392364..96739a1 100644
---- a/include/sys/efi_partition.h
-+++ b/include/sys/efi_partition.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_EFI_PARTITION_H
--#define _SPL_EFI_PARTITION_H
-+#define _SPL_EFI_PARTITION_H
-
- #endif /* SPL_EFI_PARTITION_H */
-diff --git a/include/sys/errno.h b/include/sys/errno.h
-index 64d8482..6b151bb 100644
---- a/include/sys/errno.h
-+++ b/include/sys/errno.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_ERRNO_H
--#define _SPL_ERRNO_H
-+#define _SPL_ERRNO_H
-
- #endif /* SPL_ERRNO_H */
-diff --git a/include/sys/fcntl.h b/include/sys/fcntl.h
-index 88b7a69..d71c39b 100644
---- a/include/sys/fcntl.h
-+++ b/include/sys/fcntl.h
-@@ -22,11 +22,11 @@
- \*****************************************************************************/
-
- #ifndef _SPL_FCNTL_H
--#define _SPL_FCNTL_H
-+#define _SPL_FCNTL_H
-
- #include <asm/fcntl.h>
-
--#define F_FREESP 11
-+#define F_FREESP 11
-
- #ifdef CONFIG_64BIT
- typedef struct flock flock64_t;
-diff --git a/include/sys/file.h b/include/sys/file.h
-index 67b301c..20fa7dc 100644
---- a/include/sys/file.h
-+++ b/include/sys/file.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_FILE_H
--#define _SPL_FILE_H
-+#define _SPL_FILE_H
-
- #define FIGNORECASE 0x00080000
- #define FKIOCTL 0x80000000
-diff --git a/include/sys/fs/swapnode.h b/include/sys/fs/swapnode.h
-index a5df129..b4745f4 100644
---- a/include/sys/fs/swapnode.h
-+++ b/include/sys/fs/swapnode.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SWAPNODE_H
--#define _SPL_SWAPNODE_H
-+#define _SPL_SWAPNODE_H
-
- #endif /* SPL_SWAPNODE_H */
-diff --git a/include/sys/idmap.h b/include/sys/idmap.h
-index 3618c65..f524a02 100644
---- a/include/sys/idmap.h
-+++ b/include/sys/idmap.h
-@@ -22,8 +22,8 @@
- \*****************************************************************************/
-
- #ifndef _SPL_IDMAP_H
--#define _SPL_IDMAP_H
-+#define _SPL_IDMAP_H
-
--#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U
-+#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U
-
- #endif /* SPL_IDMAP_H */
-diff --git a/include/sys/int_limits.h b/include/sys/int_limits.h
-index 64f0a11..689d9d7 100644
---- a/include/sys/int_limits.h
-+++ b/include/sys/int_limits.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_INT_LIMITS_H
--#define _SPL_INT_LIMITS_H
-+#define _SPL_INT_LIMITS_H
-
- #endif /* SPL_INT_LIMITS_H */
-diff --git a/include/sys/int_types.h b/include/sys/int_types.h
-index 582fded..fd4dafa 100644
---- a/include/sys/int_types.h
-+++ b/include/sys/int_types.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_INT_TYPES_H
--#define _SPL_INT_TYPES_H
-+#define _SPL_INT_TYPES_H
-
- #include <sys/inttypes.h>
-
-diff --git a/include/sys/inttypes.h b/include/sys/inttypes.h
-index 82e555c..e63383e 100644
---- a/include/sys/inttypes.h
-+++ b/include/sys/inttypes.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_INTTYPES_H
--#define _SPL_INTTYPES_H
-+#define _SPL_INTTYPES_H
-
- #endif /* SPL_INTTYPES_H */
-diff --git a/include/sys/isa_defs.h b/include/sys/isa_defs.h
-index 738795c..5559782 100644
---- a/include/sys/isa_defs.h
-+++ b/include/sys/isa_defs.h
-@@ -29,59 +29,59 @@
- #if defined(__x86_64) || defined(__x86_64__)
-
- #if !defined(__x86_64)
--#define __x86_64
-+#define __x86_64
- #endif
-
- #if !defined(__amd64)
--#define __amd64
-+#define __amd64
- #endif
-
- #if !defined(__x86)
--#define __x86
-+#define __x86
- #endif
-
- #if !defined(_LP64)
--#define _LP64
-+#define _LP64
- #endif
-
--#define _ALIGNMENT_REQUIRED 1
-+#define _ALIGNMENT_REQUIRED 1
-
-
- /* i386 arch specific defines */
- #elif defined(__i386) || defined(__i386__)
-
- #if !defined(__i386)
--#define __i386
-+#define __i386
- #endif
-
- #if !defined(__x86)
--#define __x86
-+#define __x86
- #endif
-
- #if !defined(_ILP32)
--#define _ILP32
-+#define _ILP32
- #endif
-
--#define _ALIGNMENT_REQUIRED 0
-+#define _ALIGNMENT_REQUIRED 0
-
- /* powerpc (ppc64) arch specific defines */
- #elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__)
-
- #if !defined(__powerpc)
--#define __powerpc
-+#define __powerpc
- #endif
-
- #if !defined(__powerpc__)
--#define __powerpc__
-+#define __powerpc__
- #endif
-
- #if defined(__powerpc64__)
- #if !defined(_LP64)
--#define _LP64
-+#define _LP64
- #endif
- #else
- #if !defined(_ILP32)
--#define _ILP32
-+#define _ILP32
- #endif
- #endif
-
-@@ -89,65 +89,65 @@
- * Illumos doesn't define _ALIGNMENT_REQUIRED for PPC, so default to 1
- * out of paranoia.
- */
--#define _ALIGNMENT_REQUIRED 1
-+#define _ALIGNMENT_REQUIRED 1
-
- /* arm arch specific defines */
- #elif defined(__arm) || defined(__arm__) || defined(__aarch64__)
-
- #if !defined(__arm)
--#define __arm
-+#define __arm
- #endif
-
- #if !defined(__arm__)
--#define __arm__
-+#define __arm__
- #endif
-
- #if defined(__aarch64__)
- #if !defined(_LP64)
--#define _LP64
-+#define _LP64
- #endif
- #else
- #if !defined(_ILP32)
--#define _ILP32
-+#define _ILP32
- #endif
- #endif
-
- #if defined(__ARMEL__) || defined(__AARCH64EL__)
--#define _LITTLE_ENDIAN
-+#define _LITTLE_ENDIAN
- #else
--#define _BIG_ENDIAN
-+#define _BIG_ENDIAN
- #endif
-
- /*
- * Illumos doesn't define _ALIGNMENT_REQUIRED for ARM, so default to 1
- * out of paranoia.
- */
--#define _ALIGNMENT_REQUIRED 1
-+#define _ALIGNMENT_REQUIRED 1
-
- /* sparc arch specific defines */
- #elif defined(__sparc) || defined(__sparc__)
-
- #if !defined(__sparc)
--#define __sparc
-+#define __sparc
- #endif
-
- #if !defined(__sparc__)
--#define __sparc__
-+#define __sparc__
- #endif
-
- #if defined(__arch64__)
- #if !defined(_LP64)
--#define _LP64
-+#define _LP64
- #endif
- #else
- #if !defined(_ILP32)
--#define _ILP32
-+#define _ILP32
- #endif
- #endif
-
--#define _BIG_ENDIAN
--#define _SUNOS_VTOC_16
--#define _ALIGNMENT_REQUIRED 1
-+#define _BIG_ENDIAN
-+#define _SUNOS_VTOC_16
-+#define _ALIGNMENT_REQUIRED 1
-
- /* s390 arch specific defines */
- #elif defined(__s390__)
-@@ -167,7 +167,7 @@
- * Illumos doesn't define _ALIGNMENT_REQUIRED for s390, so default to 1
- * out of paranoia.
- */
--#define _ALIGNMENT_REQUIRED 1
-+#define _ALIGNMENT_REQUIRED 1
-
- /* MIPS arch specific defines */
- #elif defined(__mips__)
-@@ -190,7 +190,7 @@
- * Illumos doesn't define _ALIGNMENT_REQUIRED for MIPS, so default to 1
- * out of paranoia.
- */
--#define _ALIGNMENT_REQUIRED 1
-+#define _ALIGNMENT_REQUIRED 1
-
- #else
- /*
-@@ -211,11 +211,11 @@
- #include <sys/byteorder.h>
-
- #if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN)
--#define _LITTLE_ENDIAN __LITTLE_ENDIAN
-+#define _LITTLE_ENDIAN __LITTLE_ENDIAN
- #endif
-
- #if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN)
--#define _BIG_ENDIAN __BIG_ENDIAN
-+#define _BIG_ENDIAN __BIG_ENDIAN
- #endif
-
- #if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
-diff --git a/include/sys/kidmap.h b/include/sys/kidmap.h
-index 3d67b51..ce31d35 100644
---- a/include/sys/kidmap.h
-+++ b/include/sys/kidmap.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_KIDMAP_H
--#define _SPL_KIDMAP_H
-+#define _SPL_KIDMAP_H
-
- #include <sys/idmap.h>
-
-diff --git a/include/sys/kobj.h b/include/sys/kobj.h
-index 334449a..a688843 100644
---- a/include/sys/kobj.h
-+++ b/include/sys/kobj.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_KOBJ_H
--#define _SPL_KOBJ_H
-+#define _SPL_KOBJ_H
-
- #include <sys/vnode.h>
-
-diff --git a/include/sys/kstat.h b/include/sys/kstat.h
-index 7862ab0..2018019 100644
---- a/include/sys/kstat.h
-+++ b/include/sys/kstat.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_KSTAT_H
--#define _SPL_KSTAT_H
-+#define _SPL_KSTAT_H
-
- #include <linux/module.h>
- #include <linux/proc_compat.h>
-@@ -32,63 +32,65 @@
- #include <sys/kmem.h>
- #include <sys/mutex.h>
-
--#define KSTAT_STRLEN 255
--#define KSTAT_RAW_MAX (128*1024)
-+#define KSTAT_STRLEN 255
-+#define KSTAT_RAW_MAX (128*1024)
-
--/* For reference valid classes are:
-+/*
-+ * For reference valid classes are:
- * disk, tape, net, controller, vm, kvm, hat, streams, kstat, misc
- */
-
--#define KSTAT_TYPE_RAW 0 /* can be anything; ks_ndata >= 1 */
--#define KSTAT_TYPE_NAMED 1 /* name/value pair; ks_ndata >= 1 */
--#define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */
--#define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */
--#define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */
--#define KSTAT_NUM_TYPES 5
--
--#define KSTAT_DATA_CHAR 0
--#define KSTAT_DATA_INT32 1
--#define KSTAT_DATA_UINT32 2
--#define KSTAT_DATA_INT64 3
--#define KSTAT_DATA_UINT64 4
--#define KSTAT_DATA_LONG 5
--#define KSTAT_DATA_ULONG 6
--#define KSTAT_DATA_STRING 7
--#define KSTAT_NUM_DATAS 8
--
--#define KSTAT_INTR_HARD 0
--#define KSTAT_INTR_SOFT 1
--#define KSTAT_INTR_WATCHDOG 2
--#define KSTAT_INTR_SPURIOUS 3
--#define KSTAT_INTR_MULTSVC 4
--#define KSTAT_NUM_INTRS 5
--
--#define KSTAT_FLAG_VIRTUAL 0x01
--#define KSTAT_FLAG_VAR_SIZE 0x02
--#define KSTAT_FLAG_WRITABLE 0x04
--#define KSTAT_FLAG_PERSISTENT 0x08
--#define KSTAT_FLAG_DORMANT 0x10
--#define KSTAT_FLAG_UNSUPPORTED (KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_WRITABLE | \
-- KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_DORMANT)
--
--
--#define KS_MAGIC 0x9d9d9d9d
-+#define KSTAT_TYPE_RAW 0 /* can be anything; ks_ndata >= 1 */
-+#define KSTAT_TYPE_NAMED 1 /* name/value pair; ks_ndata >= 1 */
-+#define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */
-+#define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */
-+#define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */
-+#define KSTAT_NUM_TYPES 5
-+
-+#define KSTAT_DATA_CHAR 0
-+#define KSTAT_DATA_INT32 1
-+#define KSTAT_DATA_UINT32 2
-+#define KSTAT_DATA_INT64 3
-+#define KSTAT_DATA_UINT64 4
-+#define KSTAT_DATA_LONG 5
-+#define KSTAT_DATA_ULONG 6
-+#define KSTAT_DATA_STRING 7
-+#define KSTAT_NUM_DATAS 8
-+
-+#define KSTAT_INTR_HARD 0
-+#define KSTAT_INTR_SOFT 1
-+#define KSTAT_INTR_WATCHDOG 2
-+#define KSTAT_INTR_SPURIOUS 3
-+#define KSTAT_INTR_MULTSVC 4
-+#define KSTAT_NUM_INTRS 5
-+
-+#define KSTAT_FLAG_VIRTUAL 0x01
-+#define KSTAT_FLAG_VAR_SIZE 0x02
-+#define KSTAT_FLAG_WRITABLE 0x04
-+#define KSTAT_FLAG_PERSISTENT 0x08
-+#define KSTAT_FLAG_DORMANT 0x10
-+#define KSTAT_FLAG_UNSUPPORTED \
-+ (KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_WRITABLE | \
-+ KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_DORMANT)
-+
-+
-+#define KS_MAGIC 0x9d9d9d9d
-
- /* Dynamic updates */
--#define KSTAT_READ 0
--#define KSTAT_WRITE 1
-+#define KSTAT_READ 0
-+#define KSTAT_WRITE 1
-
- struct kstat_s;
- typedef struct kstat_s kstat_t;
-
--typedef int kid_t; /* unique kstat id */
--typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */
-+typedef int kid_t; /* unique kstat id */
-+typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */
-
- typedef struct kstat_module {
-- char ksm_name[KSTAT_STRLEN+1]; /* module name */
-- struct list_head ksm_module_list; /* module linkage */
-- struct list_head ksm_kstat_list; /* list of kstat entries */
-- struct proc_dir_entry *ksm_proc; /* proc entry */
-+ char ksm_name[KSTAT_STRLEN+1]; /* module name */
-+ struct list_head ksm_module_list; /* module linkage */
-+ struct list_head ksm_kstat_list; /* list of kstat entries */
-+ struct proc_dir_entry *ksm_proc; /* proc entry */
- } kstat_module_t;
-
- typedef struct kstat_raw_ops {
-@@ -98,95 +100,96 @@ typedef struct kstat_raw_ops {
- } kstat_raw_ops_t;
-
- struct kstat_s {
-- int ks_magic; /* magic value */
-- kid_t ks_kid; /* unique kstat ID */
-- hrtime_t ks_crtime; /* creation time */
-- hrtime_t ks_snaptime; /* last access time */
-- char ks_module[KSTAT_STRLEN+1]; /* provider module name */
-- int ks_instance; /* provider module instance */
-- char ks_name[KSTAT_STRLEN+1]; /* kstat name */
-- char ks_class[KSTAT_STRLEN+1]; /* kstat class */
-- uchar_t ks_type; /* kstat data type */
-- uchar_t ks_flags; /* kstat flags */
-- void *ks_data; /* kstat type-specific data */
-- uint_t ks_ndata; /* # of type-specific data records */
-- size_t ks_data_size; /* size of kstat data section */
-- struct proc_dir_entry *ks_proc; /* proc linkage */
-- kstat_update_t *ks_update; /* dynamic updates */
-- void *ks_private; /* private data */
-- kmutex_t ks_private_lock; /* kstat private data lock */
-- kmutex_t *ks_lock; /* kstat data lock */
-- struct list_head ks_list; /* kstat linkage */
-- kstat_module_t *ks_owner; /* kstat module linkage */
-- kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */
-- char *ks_raw_buf; /* buf used for raw ops */
-- size_t ks_raw_bufsize; /* size of raw ops buffer */
-+ int ks_magic; /* magic value */
-+ kid_t ks_kid; /* unique kstat ID */
-+ hrtime_t ks_crtime; /* creation time */
-+ hrtime_t ks_snaptime; /* last access time */
-+ char ks_module[KSTAT_STRLEN+1]; /* provider module name */
-+ int ks_instance; /* provider module instance */
-+ char ks_name[KSTAT_STRLEN+1]; /* kstat name */
-+ char ks_class[KSTAT_STRLEN+1]; /* kstat class */
-+ uchar_t ks_type; /* kstat data type */
-+ uchar_t ks_flags; /* kstat flags */
-+ void *ks_data; /* kstat type-specific data */
-+ uint_t ks_ndata; /* # of data records */
-+ size_t ks_data_size; /* size of kstat data section */
-+ struct proc_dir_entry *ks_proc; /* proc linkage */
-+ kstat_update_t *ks_update; /* dynamic updates */
-+ void *ks_private; /* private data */
-+ kmutex_t ks_private_lock; /* kstat private data lock */
-+ kmutex_t *ks_lock; /* kstat data lock */
-+ struct list_head ks_list; /* kstat linkage */
-+ kstat_module_t *ks_owner; /* kstat module linkage */
-+ kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */
-+ char *ks_raw_buf; /* buf used for raw ops */
-+ size_t ks_raw_bufsize; /* size of raw ops buffer */
- };
-
- typedef struct kstat_named_s {
-- char name[KSTAT_STRLEN]; /* name of counter */
-- uchar_t data_type; /* data type */
-- union {
-- char c[16]; /* 128-bit int */
-- int32_t i32; /* 32-bit signed int */
-- uint32_t ui32; /* 32-bit unsigned int */
-- int64_t i64; /* 64-bit signed int */
-- uint64_t ui64; /* 64-bit unsigned int */
-- long l; /* native signed long */
-- ulong_t ul; /* native unsigned long */
-- struct {
-- union {
-- char *ptr; /* NULL-term string */
-- char __pad[8]; /* 64-bit padding */
-- } addr;
-- uint32_t len; /* # bytes for strlen + '\0' */
-- } string;
-- } value;
-+ char name[KSTAT_STRLEN]; /* name of counter */
-+ uchar_t data_type; /* data type */
-+ union {
-+ char c[16]; /* 128-bit int */
-+ int32_t i32; /* 32-bit signed int */
-+ uint32_t ui32; /* 32-bit unsigned int */
-+ int64_t i64; /* 64-bit signed int */
-+ uint64_t ui64; /* 64-bit unsigned int */
-+ long l; /* native signed long */
-+ ulong_t ul; /* native unsigned long */
-+ struct {
-+ union {
-+ char *ptr; /* NULL-term string */
-+ char __pad[8]; /* 64-bit padding */
-+ } addr;
-+ uint32_t len; /* # bytes for strlen + '\0' */
-+ } string;
-+ } value;
- } kstat_named_t;
-
--#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr)
--#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len)
-+#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr)
-+#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len)
-
- typedef struct kstat_intr {
-- uint_t intrs[KSTAT_NUM_INTRS];
-+ uint_t intrs[KSTAT_NUM_INTRS];
- } kstat_intr_t;
-
- typedef struct kstat_io {
-- u_longlong_t nread; /* number of bytes read */
-- u_longlong_t nwritten; /* number of bytes written */
-- uint_t reads; /* number of read operations */
-- uint_t writes; /* number of write operations */
-- hrtime_t wtime; /* cumulative wait (pre-service) time */
-- hrtime_t wlentime; /* cumulative wait length*time product*/
-- hrtime_t wlastupdate; /* last time wait queue changed */
-- hrtime_t rtime; /* cumulative run (service) time */
-- hrtime_t rlentime; /* cumulative run length*time product */
-- hrtime_t rlastupdate; /* last time run queue changed */
-- uint_t wcnt; /* count of elements in wait state */
-- uint_t rcnt; /* count of elements in run state */
-+ u_longlong_t nread; /* number of bytes read */
-+ u_longlong_t nwritten; /* number of bytes written */
-+ uint_t reads; /* number of read operations */
-+ uint_t writes; /* number of write operations */
-+ hrtime_t wtime; /* cumulative wait (pre-service) time */
-+ hrtime_t wlentime; /* cumulative wait len*time product */
-+ hrtime_t wlastupdate; /* last time wait queue changed */
-+ hrtime_t rtime; /* cumulative run (service) time */
-+ hrtime_t rlentime; /* cumulative run length*time product */
-+ hrtime_t rlastupdate; /* last time run queue changed */
-+ uint_t wcnt; /* count of elements in wait state */
-+ uint_t rcnt; /* count of elements in run state */
- } kstat_io_t;
-
- typedef struct kstat_timer {
-- char name[KSTAT_STRLEN+1]; /* event name */
-- u_longlong_t num_events; /* number of events */
-- hrtime_t elapsed_time; /* cumulative elapsed time */
-- hrtime_t min_time; /* shortest event duration */
-- hrtime_t max_time; /* longest event duration */
-- hrtime_t start_time; /* previous event start time */
-- hrtime_t stop_time; /* previous event stop time */
-+ char name[KSTAT_STRLEN+1]; /* event name */
-+ u_longlong_t num_events; /* number of events */
-+ hrtime_t elapsed_time; /* cumulative elapsed time */
-+ hrtime_t min_time; /* shortest event duration */
-+ hrtime_t max_time; /* longest event duration */
-+ hrtime_t start_time; /* previous event start time */
-+ hrtime_t stop_time; /* previous event stop time */
- } kstat_timer_t;
-
- int spl_kstat_init(void);
- void spl_kstat_fini(void);
-
- extern void __kstat_set_raw_ops(kstat_t *ksp,
-- int (*headers)(char *buf, size_t size),
-- int (*data)(char *buf, size_t size, void *data),
-- void* (*addr)(kstat_t *ksp, loff_t index));
-+ int (*headers)(char *buf, size_t size),
-+ int (*data)(char *buf, size_t size, void *data),
-+ void* (*addr)(kstat_t *ksp, loff_t index));
-+
- extern kstat_t *__kstat_create(const char *ks_module, int ks_instance,
-- const char *ks_name, const char *ks_class,
-- uchar_t ks_type, uint_t ks_ndata,
-- uchar_t ks_flags);
-+ const char *ks_name, const char *ks_class, uchar_t ks_type,
-+ uint_t ks_ndata, uchar_t ks_flags);
-+
- extern void __kstat_install(kstat_t *ksp);
- extern void __kstat_delete(kstat_t *ksp);
- extern void kstat_waitq_enter(kstat_io_t *);
-@@ -194,9 +197,12 @@ extern void kstat_waitq_exit(kstat_io_t *);
- extern void kstat_runq_enter(kstat_io_t *);
- extern void kstat_runq_exit(kstat_io_t *);
-
--#define kstat_set_raw_ops(k,h,d,a) __kstat_set_raw_ops(k,h,d,a)
--#define kstat_create(m,i,n,c,t,s,f) __kstat_create(m,i,n,c,t,s,f)
--#define kstat_install(k) __kstat_install(k)
--#define kstat_delete(k) __kstat_delete(k)
-+#define kstat_set_raw_ops(k, h, d, a) \
-+ __kstat_set_raw_ops(k, h, d, a)
-+#define kstat_create(m, i, n, c, t, s, f) \
-+ __kstat_create(m, i, n, c, t, s, f)
-+
-+#define kstat_install(k) __kstat_install(k)
-+#define kstat_delete(k) __kstat_delete(k)
-
- #endif /* _SPL_KSTAT_H */
-diff --git a/include/sys/list.h b/include/sys/list.h
-index 563784a..9aba3b4 100644
---- a/include/sys/list.h
-+++ b/include/sys/list.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_LIST_H
--#define _SPL_LIST_H
-+#define _SPL_LIST_H
-
- #include <sys/types.h>
- #include <linux/list.h>
-@@ -53,13 +53,13 @@ typedef struct list {
- list_node_t list_head;
- } list_t;
-
--#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset))
--#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset))
-+#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset))
-+#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset))
-
- static inline int
- list_is_empty(list_t *list)
- {
-- return list_empty(&list->list_head);
-+ return (list_empty(&list->list_head));
- }
-
- static inline void
-@@ -74,7 +74,7 @@ list_create(list_t *list, size_t size, size_t offset)
- {
- ASSERT(list);
- ASSERT(size > 0);
-- ASSERT(size >= offset + sizeof(list_node_t));
-+ ASSERT(size >= offset + sizeof (list_node_t));
-
- list->list_size = size;
- list->list_offset = offset;
-@@ -132,10 +132,10 @@ list_remove_head(list_t *list)
- {
- list_node_t *head = list->list_head.next;
- if (head == &list->list_head)
-- return NULL;
-+ return (NULL);
-
- list_del(head);
-- return list_object(list, head);
-+ return (list_object(list, head));
- }
-
- static inline void *
-@@ -143,28 +143,28 @@ list_remove_tail(list_t *list)
- {
- list_node_t *tail = list->list_head.prev;
- if (tail == &list->list_head)
-- return NULL;
-+ return (NULL);
-
- list_del(tail);
-- return list_object(list, tail);
-+ return (list_object(list, tail));
- }
-
- static inline void *
- list_head(list_t *list)
- {
- if (list_is_empty(list))
-- return NULL;
-+ return (NULL);
-
-- return list_object(list, list->list_head.next);
-+ return (list_object(list, list->list_head.next));
- }
-
- static inline void *
- list_tail(list_t *list)
- {
- if (list_is_empty(list))
-- return NULL;
-+ return (NULL);
-
-- return list_object(list, list->list_head.prev);
-+ return (list_object(list, list->list_head.prev));
- }
-
- static inline void *
-@@ -173,9 +173,9 @@ list_next(list_t *list, void *object)
- list_node_t *node = list_d2l(list, object);
-
- if (node->next != &list->list_head)
-- return list_object(list, node->next);
-+ return (list_object(list, node->next));
-
-- return NULL;
-+ return (NULL);
- }
-
- static inline void *
-@@ -184,9 +184,9 @@ list_prev(list_t *list, void *object)
- list_node_t *node = list_d2l(list, object);
-
- if (node->prev != &list->list_head)
-- return list_object(list, node->prev);
-+ return (list_object(list, node->prev));
-
-- return NULL;
-+ return (NULL);
- }
-
- static inline int
-@@ -201,7 +201,7 @@ spl_list_move_tail(list_t *dst, list_t *src)
- list_splice_init(&src->list_head, dst->list_head.prev);
- }
-
--#define list_move_tail(dst, src) spl_list_move_tail(dst, src)
-+#define list_move_tail(dst, src) spl_list_move_tail(dst, src)
-
- static inline void
- list_link_replace(list_node_t *old_node, list_node_t *new_node)
-diff --git a/include/sys/mkdev.h b/include/sys/mkdev.h
-index d765b73..8fbbc0c 100644
---- a/include/sys/mkdev.h
-+++ b/include/sys/mkdev.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_MKDEV_H
--#define _SPL_MKDEV_H
-+#define _SPL_MKDEV_H
-
- #endif /* SPL_MKDEV_H */
-diff --git a/include/sys/mntent.h b/include/sys/mntent.h
-index 66fae87..61ccac3 100644
---- a/include/sys/mntent.h
-+++ b/include/sys/mntent.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_MNTENT_H
--#define _SPL_MNTENT_H
-+#define _SPL_MNTENT_H
-
- #endif /* SPL_MNTENT_H */
-diff --git a/include/sys/modctl.h b/include/sys/modctl.h
-index 8d79e53..36dc9a6 100644
---- a/include/sys/modctl.h
-+++ b/include/sys/modctl.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_MODCTL_H
--#define _SPL_MODCTL_H
-+#define _SPL_MODCTL_H
-
- #endif /* SPL_MODCTL_H */
-diff --git a/include/sys/mode.h b/include/sys/mode.h
-index d09965e..1b43e65 100644
---- a/include/sys/mode.h
-+++ b/include/sys/mode.h
-@@ -23,10 +23,10 @@
- \*****************************************************************************/
-
- #ifndef _SPL_MODE_H
--#define _SPL_MODE_H
-+#define _SPL_MODE_H
-
--#define IFTOVT(mode) vn_mode_to_vtype(mode)
--#define VTTOIF(vtype) vn_vtype_to_mode(vtype)
--#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT))
-+#define IFTOVT(mode) vn_mode_to_vtype(mode)
-+#define VTTOIF(vtype) vn_vtype_to_mode(vtype)
-+#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT))
-
- #endif /* SPL_MODE_H */
-diff --git a/include/sys/mount.h b/include/sys/mount.h
-index ca1796d..3e3d8e5 100644
---- a/include/sys/mount.h
-+++ b/include/sys/mount.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_MOUNT_H
--#define _SPL_MOUNT_H
-+#define _SPL_MOUNT_H
-
- #endif /* SPL_MOUNT_H */
-diff --git a/include/sys/mutex.h b/include/sys/mutex.h
-index 8cbab7c..c7084b3 100644
---- a/include/sys/mutex.h
-+++ b/include/sys/mutex.h
-@@ -84,13 +84,13 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \
- lockdep_on(); \
- }
- #else /* CONFIG_LOCKDEP */
--#define spl_mutex_set_type(mp, type)
--#define spl_mutex_lockdep_off_maybe(mp)
--#define spl_mutex_lockdep_on_maybe(mp)
-+#define spl_mutex_set_type(mp, type)
-+#define spl_mutex_lockdep_off_maybe(mp)
-+#define spl_mutex_lockdep_on_maybe(mp)
- #endif /* CONFIG_LOCKDEP */
-
- /*
-- * The following functions must be a #define and not static inline.
-+ * The following functions must be a #define and not static inline.
- * This ensures that the native linux mutex functions (lock/unlock)
- * will be correctly located in the users code which is important
- * for the built in kernel lock analysis tools
-@@ -113,6 +113,7 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \
- VERIFY3P(mutex_owner(mp), ==, NULL); \
- }
-
-+/* BEGIN CSTYLED */
- #define mutex_tryenter(mp) \
- ({ \
- int _rc_; \
-@@ -124,6 +125,7 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \
- \
- _rc_; \
- })
-+/* END CSTYLED */
-
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- #define mutex_enter_nested(mp, subclass) \
-diff --git a/include/sys/note.h b/include/sys/note.h
-index 5117562..7480adf 100644
---- a/include/sys/note.h
-+++ b/include/sys/note.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_NOTE_H
--#define _SPL_NOTE_H
-+#define _SPL_NOTE_H
-
- #endif /* SPL_NOTE_H */
-diff --git a/include/sys/open.h b/include/sys/open.h
-index e3ebd8c..bf55ee7 100644
---- a/include/sys/open.h
-+++ b/include/sys/open.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_OPEN_H
--#define _SPL_OPEN_H
-+#define _SPL_OPEN_H
-
- #endif /* SPL_OPEN_H */
-diff --git a/include/sys/param.h b/include/sys/param.h
-index 665f641..274db42 100644
---- a/include/sys/param.h
-+++ b/include/sys/param.h
-@@ -23,14 +23,14 @@
- \*****************************************************************************/
-
- #ifndef _SPL_PARAM_H
--#define _SPL_PARAM_H
-+#define _SPL_PARAM_H
-
- #include <asm/page.h>
-
- /* Pages to bytes and back */
--#define ptob(pages) ((pages) << PAGE_SHIFT)
--#define btop(bytes) ((bytes) >> PAGE_SHIFT)
-+#define ptob(pages) ((pages) << PAGE_SHIFT)
-+#define btop(bytes) ((bytes) >> PAGE_SHIFT)
-
--#define MAXUID UINT32_MAX
-+#define MAXUID UINT32_MAX
-
- #endif /* SPL_PARAM_H */
-diff --git a/include/sys/pathname.h b/include/sys/pathname.h
-index 71ea441..812114e 100644
---- a/include/sys/pathname.h
-+++ b/include/sys/pathname.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_PATHNAME_H
--#define _SPL_PATHNAME_H
-+#define _SPL_PATHNAME_H
-
- typedef struct pathname {
- char *pn_buf; /* underlying storage */
-diff --git a/include/sys/policy.h b/include/sys/policy.h
-index 45e724b..2892ce1 100644
---- a/include/sys/policy.h
-+++ b/include/sys/policy.h
-@@ -23,25 +23,25 @@
- \*****************************************************************************/
-
- #ifndef _SPL_POLICY_H
--#define _SPL_POLICY_H
-+#define _SPL_POLICY_H
-
--#define secpolicy_fs_unmount(c,vfs) (0)
-+#define secpolicy_fs_unmount(c, vfs) (0)
- #define secpolicy_nfs(c) (0)
--#define secpolicy_sys_config(c,co) (0)
-+#define secpolicy_sys_config(c, co) (0)
- #define secpolicy_zfs(c) (0)
- #define secpolicy_zinject(c) (0)
--#define secpolicy_vnode_setids_setgids(c,id) (0)
-+#define secpolicy_vnode_setids_setgids(c, id) (0)
- #define secpolicy_vnode_setid_retain(c, sr) (0)
- #define secpolicy_setid_clear(v, c) (0)
--#define secpolicy_vnode_any_access(c,vp,o) (0)
--#define secpolicy_vnode_access2(c,cp,o,m1,m2) (0)
--#define secpolicy_vnode_chown(c,o) (0)
--#define secpolicy_vnode_setdac(c,o) (0)
-+#define secpolicy_vnode_any_access(c, vp, o) (0)
-+#define secpolicy_vnode_access2(c, cp, o, m1, m2) (0)
-+#define secpolicy_vnode_chown(c, o) (0)
-+#define secpolicy_vnode_setdac(c, o) (0)
- #define secpolicy_vnode_remove(c) (0)
--#define secpolicy_vnode_setattr(c,v,a,o,f,func,n) (0)
-+#define secpolicy_vnode_setattr(c, v, a, o, f, func, n) (0)
- #define secpolicy_xvattr(x, o, c, t) (0)
- #define secpolicy_vnode_stky_modify(c) (0)
--#define secpolicy_setid_setsticky_clear(v,a,o,c) (0)
-+#define secpolicy_setid_setsticky_clear(v, a, o, c) (0)
- #define secpolicy_basic_link(c) (0)
-
- #endif /* SPL_POLICY_H */
-diff --git a/include/sys/pool.h b/include/sys/pool.h
-index bf6a0bb..410bb2f 100644
---- a/include/sys/pool.h
-+++ b/include/sys/pool.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_POOL_H
--#define _SPL_POOL_H
-+#define _SPL_POOL_H
-
- #include <sys/pset.h>
-
-diff --git a/include/sys/priv_impl.h b/include/sys/priv_impl.h
-index f1507a8..ef11a62 100644
---- a/include/sys/priv_impl.h
-+++ b/include/sys/priv_impl.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_PRIV_IMPL_H
--#define _SPL_PRIV_IMPL_H
-+#define _SPL_PRIV_IMPL_H
-
- #endif /* _SPL_PRIV_IMPL_H */
-diff --git a/include/sys/proc.h b/include/sys/proc.h
-index dbaf416..f926e1e 100644
---- a/include/sys/proc.h
-+++ b/include/sys/proc.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_PROC_H
--#define _SPL_PROC_H
-+#define _SPL_PROC_H
-
- #endif /* SPL_PROC_H */
-diff --git a/include/sys/processor.h b/include/sys/processor.h
-index 60b1a21..2e325c3 100644
---- a/include/sys/processor.h
-+++ b/include/sys/processor.h
-@@ -25,7 +25,7 @@
- #ifndef _SPL_PROCESSOR_H
- #define _SPL_PROCESSOR_H
-
--#define getcpuid() smp_processor_id()
-+#define getcpuid() smp_processor_id()
-
- typedef int processorid_t;
-
-diff --git a/include/sys/pset.h b/include/sys/pset.h
-index 2723d31..d588600 100644
---- a/include/sys/pset.h
-+++ b/include/sys/pset.h
-@@ -23,16 +23,16 @@
- \*****************************************************************************/
-
- #ifndef _SPL_PSET_H
--#define _SPL_PSET_H
-+#define _SPL_PSET_H
-
- typedef int psetid_t;
-
- /* special processor set id's */
--#define PS_NONE -1
--#define PS_QUERY -2
--#define PS_MYID -3
--#define PS_SOFT -4
--#define PS_HARD -5
--#define PS_QUERY_TYPE -6
-+#define PS_NONE -1
-+#define PS_QUERY -2
-+#define PS_MYID -3
-+#define PS_SOFT -4
-+#define PS_HARD -5
-+#define PS_QUERY_TYPE -6
-
- #endif /* SPL_PSET_H */
-diff --git a/include/sys/random.h b/include/sys/random.h
-index 64f70ee..1f05a58 100644
---- a/include/sys/random.h
-+++ b/include/sys/random.h
-@@ -31,8 +31,8 @@
- static __inline__ int
- random_get_bytes(uint8_t *ptr, size_t len)
- {
-- get_random_bytes((void *)ptr,(int)len);
-- return 0;
-+ get_random_bytes((void *)ptr, (int)len);
-+ return (0);
- }
-
- extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len);
-diff --git a/include/sys/refstr.h b/include/sys/refstr.h
-index 49a3417..fec0ab2 100644
---- a/include/sys/refstr.h
-+++ b/include/sys/refstr.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_REFSTR_H
--#define _SPL_REFSTR_H
-+#define _SPL_REFSTR_H
-
- #endif /* SPL_REFSTR_H */
-diff --git a/include/sys/resource.h b/include/sys/resource.h
-index fe33655..0ff0a75 100644
---- a/include/sys/resource.h
-+++ b/include/sys/resource.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_RESOURCE_H
--#define _SPL_RESOURCE_H
-+#define _SPL_RESOURCE_H
-
- #include <linux/resource.h>
-
-diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h
-index ffb7b90..325dfc4 100644
---- a/include/sys/rwlock.h
-+++ b/include/sys/rwlock.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_RWLOCK_H
--#define _SPL_RWLOCK_H
-+#define _SPL_RWLOCK_H
-
- #include <sys/types.h>
- #include <linux/rwsem.h>
-@@ -55,7 +55,7 @@ typedef struct {
- #endif /* CONFIG_LOCKDEP */
- } krwlock_t;
-
--#define SEM(rwp) (&(rwp)->rw_rwlock)
-+#define SEM(rwp) (&(rwp)->rw_rwlock)
-
- static inline void
- spl_rw_set_owner(krwlock_t *rwp)
-@@ -81,9 +81,9 @@ static inline kthread_t *
- rw_owner(krwlock_t *rwp)
- {
- #ifdef CONFIG_RWSEM_SPIN_ON_OWNER
-- return SEM(rwp)->owner;
-+ return (SEM(rwp)->owner);
- #else
-- return rwp->rw_owner;
-+ return (rwp->rw_owner);
- #endif
- }
-
-@@ -106,9 +106,9 @@ spl_rw_lockdep_on_maybe(krwlock_t *rwp) \
- lockdep_on(); \
- }
- #else /* CONFIG_LOCKDEP */
--#define spl_rw_set_type(rwp, type)
--#define spl_rw_lockdep_off_maybe(rwp)
--#define spl_rw_lockdep_on_maybe(rwp)
-+#define spl_rw_set_type(rwp, type)
-+#define spl_rw_lockdep_off_maybe(rwp)
-+#define spl_rw_lockdep_on_maybe(rwp)
- #endif /* CONFIG_LOCKDEP */
-
- static inline int
-@@ -131,16 +131,17 @@ RW_WRITE_HELD(krwlock_t *rwp)
- static inline int
- RW_LOCK_HELD(krwlock_t *rwp)
- {
-- return spl_rwsem_is_locked(SEM(rwp));
-+ return (spl_rwsem_is_locked(SEM(rwp)));
- }
-
- /*
-- * The following functions must be a #define and not static inline.
-+ * The following functions must be a #define and not static inline.
- * This ensures that the native linux semaphore functions (down/up)
- * will be correctly located in the users code which is important
- * for the built in kernel lock analysis tools
- */
--#define rw_init(rwp, name, type, arg) \
-+/* BEGIN CSTYLED */
-+#define rw_init(rwp, name, type, arg) \
- ({ \
- static struct lock_class_key __key; \
- ASSERT(type == RW_DEFAULT || type == RW_NOLOCKDEP); \
-@@ -150,12 +151,12 @@ RW_LOCK_HELD(krwlock_t *rwp)
- spl_rw_set_type(rwp, type); \
- })
-
--#define rw_destroy(rwp) \
-+#define rw_destroy(rwp) \
- ({ \
- VERIFY(!RW_LOCK_HELD(rwp)); \
- })
-
--#define rw_tryenter(rwp, rw) \
-+#define rw_tryenter(rwp, rw) \
- ({ \
- int _rc_ = 0; \
- \
-@@ -175,7 +176,7 @@ RW_LOCK_HELD(krwlock_t *rwp)
- _rc_; \
- })
-
--#define rw_enter(rwp, rw) \
-+#define rw_enter(rwp, rw) \
- ({ \
- spl_rw_lockdep_off_maybe(rwp); \
- switch (rw) { \
-@@ -192,7 +193,7 @@ RW_LOCK_HELD(krwlock_t *rwp)
- spl_rw_lockdep_on_maybe(rwp); \
- })
-
--#define rw_exit(rwp) \
-+#define rw_exit(rwp) \
- ({ \
- spl_rw_lockdep_off_maybe(rwp); \
- if (RW_WRITE_HELD(rwp)) { \
-@@ -205,7 +206,7 @@ RW_LOCK_HELD(krwlock_t *rwp)
- spl_rw_lockdep_on_maybe(rwp); \
- })
-
--#define rw_downgrade(rwp) \
-+#define rw_downgrade(rwp) \
- ({ \
- spl_rw_lockdep_off_maybe(rwp); \
- spl_rw_clear_owner(rwp); \
-@@ -213,7 +214,7 @@ RW_LOCK_HELD(krwlock_t *rwp)
- spl_rw_lockdep_on_maybe(rwp); \
- })
-
--#define rw_tryupgrade(rwp) \
-+#define rw_tryupgrade(rwp) \
- ({ \
- int _rc_ = 0; \
- \
-@@ -227,6 +228,7 @@ RW_LOCK_HELD(krwlock_t *rwp)
- } \
- _rc_; \
- })
-+/* END CSTYLED */
-
- int spl_rw_init(void);
- void spl_rw_fini(void);
-diff --git a/include/sys/sdt.h b/include/sys/sdt.h
-index 287bfaa..8178eb8 100644
---- a/include/sys/sdt.h
-+++ b/include/sys/sdt.h
-@@ -23,8 +23,8 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SDT_H
--#define _SPL_SDT_H
-+#define _SPL_SDT_H
-
--#define SET_ERROR(x) (x)
-+#define SET_ERROR(x) (x)
-
- #endif /* SPL_SDT_H */
-diff --git a/include/sys/sid.h b/include/sys/sid.h
-index 8ee5d07..a54d78b 100644
---- a/include/sys/sid.h
-+++ b/include/sys/sid.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SID_H
--#define _SPL_SID_H
-+#define _SPL_SID_H
-
- typedef struct ksiddomain {
- char *kd_name;
-@@ -41,21 +41,21 @@ typedef int ksid_t;
- static inline ksiddomain_t *
- ksid_lookupdomain(const char *dom)
- {
-- ksiddomain_t *kd;
-+ ksiddomain_t *kd;
- int len = strlen(dom);
-
-- kd = kmem_zalloc(sizeof(ksiddomain_t), KM_SLEEP);
-- kd->kd_name = kmem_zalloc(len + 1, KM_SLEEP);
-+ kd = kmem_zalloc(sizeof (ksiddomain_t), KM_SLEEP);
-+ kd->kd_name = kmem_zalloc(len + 1, KM_SLEEP);
- memcpy(kd->kd_name, dom, len);
-
-- return (kd);
-+ return (kd);
- }
-
- static inline void
- ksiddomain_rele(ksiddomain_t *ksid)
- {
- kmem_free(ksid->kd_name, strlen(ksid->kd_name) + 1);
-- kmem_free(ksid, sizeof(ksiddomain_t));
-+ kmem_free(ksid, sizeof (ksiddomain_t));
- }
-
- #endif /* _SPL_SID_H */
-diff --git a/include/sys/signal.h b/include/sys/signal.h
-index 77cc2d3..849c6e9 100644
---- a/include/sys/signal.h
-+++ b/include/sys/signal.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SIGNAL_H
--#define _SPL_SIGNAL_H
-+#define _SPL_SIGNAL_H
-
- #include <linux/sched.h>
-
-@@ -34,7 +34,8 @@
- #define FORREAL 0 /* Usual side-effects */
- #define JUSTLOOKING 1 /* Don't stop the process */
-
--/* The "why" argument indicates the allowable side-effects of the call:
-+/*
-+ * The "why" argument indicates the allowable side-effects of the call:
- *
- * FORREAL: Extract the next pending signal from p_sig into p_cursig;
- * stop the process if a stop has been requested or if a traced signal
-@@ -48,7 +49,7 @@ issig(int why)
- {
- ASSERT(why == FORREAL || why == JUSTLOOKING);
-
-- return signal_pending(current);
-+ return (signal_pending(current));
- }
-
- #endif /* SPL_SIGNAL_H */
-diff --git a/include/sys/stat.h b/include/sys/stat.h
-index cde7556..c425b75 100644
---- a/include/sys/stat.h
-+++ b/include/sys/stat.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_STAT_H
--#define _SPL_STAT_H
-+#define _SPL_STAT_H
-
- #include <linux/stat.h>
-
-diff --git a/include/sys/stropts.h b/include/sys/stropts.h
-index 25c7ee1..c0c8566 100644
---- a/include/sys/stropts.h
-+++ b/include/sys/stropts.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_STROPTS_H
--#define _SPL_STROPTS_H
-+#define _SPL_STROPTS_H
-
- #endif /* SPL_STROPTS_H */
-diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h
-index c49b0c2..1f78094 100644
---- a/include/sys/sunddi.h
-+++ b/include/sys/sunddi.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SUNDDI_H
--#define _SPL_SUNDDI_H
-+#define _SPL_SUNDDI_H
-
- #include <sys/cred.h>
- #include <sys/uio.h>
-@@ -44,9 +44,9 @@ typedef int ddi_devid_t;
- #define DDI_SUCCESS 0
- #define DDI_FAILURE -1
-
--#define ddi_prop_lookup_string(x1,x2,x3,x4,x5) (*x5 = NULL)
--#define ddi_prop_free(x) (void)0
--#define ddi_root_node() (void)0
-+#define ddi_prop_lookup_string(x1, x2, x3, x4, x5) (*x5 = NULL)
-+#define ddi_prop_free(x) (void)0
-+#define ddi_root_node() (void)0
-
- extern int ddi_strtoul(const char *, char **, int, unsigned long *);
- extern int ddi_strtol(const char *, char **, int, long *);
-diff --git a/include/sys/sunldi.h b/include/sys/sunldi.h
-index ec84202..3f7f9b3 100644
---- a/include/sys/sunldi.h
-+++ b/include/sys/sunldi.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SUNLDI_H
--#define _SPL_SUNLDI_H
-+#define _SPL_SUNLDI_H
-
- #include <sys/types.h>
- #include <linux/fs.h>
-@@ -32,6 +32,6 @@
- #include <linux/bio.h>
- #include <linux/blkdev.h>
-
--#define SECTOR_SIZE 512
-+#define SECTOR_SIZE 512
-
- #endif /* SPL_SUNLDI_H */
-diff --git a/include/sys/sysdc.h b/include/sys/sysdc.h
-index 14ab48a..b6c0cf0 100644
---- a/include/sys/sysdc.h
-+++ b/include/sys/sysdc.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SYSDC_H
--#define _SPL_SYSDC_H
-+#define _SPL_SYSDC_H
-
- #endif /* SPL_SYSDC_H */
-diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
-index a4a9f3e..c5c691b 100644
---- a/include/sys/sysmacros.h
-+++ b/include/sys/sysmacros.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SYSMACROS_H
--#define _SPL_SYSMACROS_H
-+#define _SPL_SYSMACROS_H
-
- #include <linux/module.h>
- #include <linux/sched.h>
-@@ -39,120 +39,122 @@
- #endif
-
- #ifndef _KERNEL
--#define _KERNEL __KERNEL__
-+#define _KERNEL __KERNEL__
- #endif
-
--#define FALSE 0
--#define TRUE 1
--
--#define INT8_MAX (127)
--#define INT8_MIN (-128)
--#define UINT8_MAX (255)
--#define UINT8_MIN (0)
--
--#define INT16_MAX (32767)
--#define INT16_MIN (-32768)
--#define UINT16_MAX (65535)
--#define UINT16_MIN (0)
--
--#define INT32_MAX INT_MAX
--#define INT32_MIN INT_MIN
--#define UINT32_MAX UINT_MAX
--#define UINT32_MIN UINT_MIN
--
--#define INT64_MAX LLONG_MAX
--#define INT64_MIN LLONG_MIN
--#define UINT64_MAX ULLONG_MAX
--#define UINT64_MIN ULLONG_MIN
--
--#define NBBY 8
--#define ENOTSUP EOPNOTSUPP
--
--#define MAXMSGLEN 256
--#define MAXNAMELEN 256
--#define MAXPATHLEN PATH_MAX
--#define MAXOFFSET_T LLONG_MAX
--#define MAXBSIZE 8192
--#define DEV_BSIZE 512
--#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
--
--#define proc_pageout NULL
--#define curproc current
--#define max_ncpus num_possible_cpus()
--#define boot_ncpus num_online_cpus()
--#define CPU_SEQID smp_processor_id()
--#define _NOTE(x)
--#define is_system_labeled() 0
-+#define FALSE 0
-+#define TRUE 1
-+
-+#define INT8_MAX (127)
-+#define INT8_MIN (-128)
-+#define UINT8_MAX (255)
-+#define UINT8_MIN (0)
-+
-+#define INT16_MAX (32767)
-+#define INT16_MIN (-32768)
-+#define UINT16_MAX (65535)
-+#define UINT16_MIN (0)
-+
-+#define INT32_MAX INT_MAX
-+#define INT32_MIN INT_MIN
-+#define UINT32_MAX UINT_MAX
-+#define UINT32_MIN UINT_MIN
-+
-+#define INT64_MAX LLONG_MAX
-+#define INT64_MIN LLONG_MIN
-+#define UINT64_MAX ULLONG_MAX
-+#define UINT64_MIN ULLONG_MIN
-+
-+#define NBBY 8
-+#define ENOTSUP EOPNOTSUPP
-+
-+#define MAXMSGLEN 256
-+#define MAXNAMELEN 256
-+#define MAXPATHLEN PATH_MAX
-+#define MAXOFFSET_T LLONG_MAX
-+#define MAXBSIZE 8192
-+#define DEV_BSIZE 512
-+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-+
-+#define proc_pageout NULL
-+#define curproc current
-+#define max_ncpus num_possible_cpus()
-+#define boot_ncpus num_online_cpus()
-+#define CPU_SEQID smp_processor_id()
-+#define _NOTE(x)
-+#define is_system_labeled() 0
-
- #ifndef RLIM64_INFINITY
--#define RLIM64_INFINITY (~0ULL)
-+#define RLIM64_INFINITY (~0ULL)
- #endif
-
--/* 0..MAX_PRIO-1: Process priority
-+/*
-+ * 0..MAX_PRIO-1: Process priority
- * 0..MAX_RT_PRIO-1: RT priority tasks
- * MAX_RT_PRIO..MAX_PRIO-1: SCHED_NORMAL tasks
- *
- * Treat shim tasks as SCHED_NORMAL tasks
- */
--#define minclsyspri (MAX_PRIO-1)
--#define maxclsyspri (MAX_RT_PRIO)
--#define defclsyspri (DEFAULT_PRIO)
-+#define minclsyspri (MAX_PRIO-1)
-+#define maxclsyspri (MAX_RT_PRIO)
-+#define defclsyspri (DEFAULT_PRIO)
-
- #ifndef NICE_TO_PRIO
--#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
-+#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
- #endif
- #ifndef PRIO_TO_NICE
--#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
-+#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
- #endif
-
- /*
- * Missing macros
- */
- #ifndef PAGESIZE
--#define PAGESIZE PAGE_SIZE
-+#define PAGESIZE PAGE_SIZE
- #endif
-
- #ifndef PAGESHIFT
--#define PAGESHIFT PAGE_SHIFT
-+#define PAGESHIFT PAGE_SHIFT
- #endif
-
- /* from Solaris sys/byteorder.h */
--#define BSWAP_8(x) ((x) & 0xff)
--#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8))
--#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16))
--#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32))
-+#define BSWAP_8(x) ((x) & 0xff)
-+#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8))
-+#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16))
-+#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32))
-
--/* Map some simple functions.
-+/*
-+ * Map some simple functions.
- */
--#define bzero(ptr,size) memset(ptr,0,size)
--#define bcopy(src,dest,size) memmove(dest,src,size)
--#define bcmp(src,dest,size) memcmp((src), (dest), (size_t)(size))
-+#define bzero(ptr, size) memset(ptr, 0, size)
-+#define bcopy(src, dest, size) memmove(dest, src, size)
-+#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size))
-
- /* Dtrace probes do not exist in the linux kernel */
- #ifdef DTRACE_PROBE
- #undef DTRACE_PROBE
- #endif /* DTRACE_PROBE */
--#define DTRACE_PROBE(a) ((void)0)
-+#define DTRACE_PROBE(a) ((void)0)
-
- #ifdef DTRACE_PROBE1
- #undef DTRACE_PROBE1
- #endif /* DTRACE_PROBE1 */
--#define DTRACE_PROBE1(a, b, c) ((void)0)
-+#define DTRACE_PROBE1(a, b, c) ((void)0)
-
- #ifdef DTRACE_PROBE2
- #undef DTRACE_PROBE2
- #endif /* DTRACE_PROBE2 */
--#define DTRACE_PROBE2(a, b, c, d, e) ((void)0)
-+#define DTRACE_PROBE2(a, b, c, d, e) ((void)0)
-
- #ifdef DTRACE_PROBE3
- #undef DTRACE_PROBE3
- #endif /* DTRACE_PROBE3 */
--#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0)
-+#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0)
-
- #ifdef DTRACE_PROBE4
- #undef DTRACE_PROBE4
- #endif /* DTRACE_PROBE4 */
--#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
-+#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
-
- /* Missing globals */
- extern char spl_version[32];
-@@ -167,39 +169,39 @@ extern void spl_cleanup(void);
- #define lowbit(x) __ffs(x)
-
- #define highbit64(x) fls64(x)
--#define makedevice(maj,min) makedev(maj,min)
-+#define makedevice(maj, min) makedev(maj, min)
-
- /* common macros */
- #ifndef MIN
--#define MIN(a, b) ((a) < (b) ? (a) : (b))
-+#define MIN(a, b) ((a) < (b) ? (a) : (b))
- #endif
- #ifndef MAX
--#define MAX(a, b) ((a) < (b) ? (b) : (a))
-+#define MAX(a, b) ((a) < (b) ? (b) : (a))
- #endif
- #ifndef ABS
--#define ABS(a) ((a) < 0 ? -(a) : (a))
-+#define ABS(a) ((a) < 0 ? -(a) : (a))
- #endif
- #ifndef DIV_ROUND_UP
--#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
- #endif
- #ifndef roundup
--#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
-+#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
- #endif
- #ifndef howmany
--#define howmany(x, y) (((x) + ((y) - 1)) / (y))
-+#define howmany(x, y) (((x) + ((y) - 1)) / (y))
- #endif
-
- /*
- * Compatibility macros/typedefs needed for Solaris -> Linux port
- */
--#define P2ALIGN(x, align) ((x) & -(align))
--#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1)
--#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1)
--#define P2PHASE(x, align) ((x) & ((align) - 1))
--#define P2NPHASE(x, align) (-(x) & ((align) - 1))
--#define ISP2(x) (((x) & ((x) - 1)) == 0)
--#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1))==0)
--#define P2BOUNDARY(off, len, align) \
-+#define P2ALIGN(x, align) ((x) & -(align))
-+#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1)
-+#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1)
-+#define P2PHASE(x, align) ((x) & ((align) - 1))
-+#define P2NPHASE(x, align) (-(x) & ((align) - 1))
-+#define ISP2(x) (((x) & ((x) - 1)) == 0)
-+#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
-+#define P2BOUNDARY(off, len, align) \
- (((off) ^ ((off) + (len) - 1)) > (align) - 1)
-
- /*
-@@ -214,28 +216,28 @@ extern void spl_cleanup(void);
- * or
- * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t)
- */
--#define P2ALIGN_TYPED(x, align, type) \
-- ((type)(x) & -(type)(align))
--#define P2PHASE_TYPED(x, align, type) \
-- ((type)(x) & ((type)(align) - 1))
--#define P2NPHASE_TYPED(x, align, type) \
-- (-(type)(x) & ((type)(align) - 1))
--#define P2ROUNDUP_TYPED(x, align, type) \
-- ((((type)(x) - 1) | ((type)(align) - 1)) + 1)
--#define P2END_TYPED(x, align, type) \
-- (-(~(type)(x) & -(type)(align)))
--#define P2PHASEUP_TYPED(x, align, phase, type) \
-- ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align)))
--#define P2CROSS_TYPED(x, y, align, type) \
-- (((type)(x) ^ (type)(y)) > (type)(align) - 1)
--#define P2SAMEHIGHBIT_TYPED(x, y, type) \
-- (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
-+#define P2ALIGN_TYPED(x, align, type) \
-+ ((type)(x) & -(type)(align))
-+#define P2PHASE_TYPED(x, align, type) \
-+ ((type)(x) & ((type)(align) - 1))
-+#define P2NPHASE_TYPED(x, align, type) \
-+ (-(type)(x) & ((type)(align) - 1))
-+#define P2ROUNDUP_TYPED(x, align, type) \
-+ ((((type)(x) - 1) | ((type)(align) - 1)) + 1)
-+#define P2END_TYPED(x, align, type) \
-+ (-(~(type)(x) & -(type)(align)))
-+#define P2PHASEUP_TYPED(x, align, phase, type) \
-+ ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align)))
-+#define P2CROSS_TYPED(x, y, align, type) \
-+ (((type)(x) ^ (type)(y)) > (type)(align) - 1)
-+#define P2SAMEHIGHBIT_TYPED(x, y, type) \
-+ (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
-
- #if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof)
-
- /* avoid any possibility of clashing with <stddef.h> version */
-
--#define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
-+#define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
- #endif
-
- #endif /* _SPL_SYSMACROS_H */
-diff --git a/include/sys/systeminfo.h b/include/sys/systeminfo.h
-index 5c0cc46..e80b9d4 100644
---- a/include/sys/systeminfo.h
-+++ b/include/sys/systeminfo.h
-@@ -23,14 +23,14 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SYSTEMINFO_H
--#define _SPL_SYSTEMINFO_H
-+#define _SPL_SYSTEMINFO_H
-
--#define HW_HOSTID_LEN 11 /* minimum buffer size needed */
-+#define HW_HOSTID_LEN 11 /* minimum buffer size needed */
- /* to hold a decimal or hex */
- /* hostid string */
-
- /* Supplemental definitions for Linux. */
--#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */
--#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */
-+#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */
-+#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */
-
- #endif /* SPL_SYSTEMINFO_H */
-diff --git a/include/sys/systm.h b/include/sys/systm.h
-index 3336fb3..358cc6f 100644
---- a/include/sys/systm.h
-+++ b/include/sys/systm.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SYSTM_H
--#define _SPL_SYSTM_H
-+#define _SPL_SYSTM_H
-
- #include <sys/sunddi.h>
-
-diff --git a/include/sys/t_lock.h b/include/sys/t_lock.h
-index 6c159f9..6cb8513 100644
---- a/include/sys/t_lock.h
-+++ b/include/sys/t_lock.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_T_LOCK_H
--#define _SPL_T_LOCK_H
-+#define _SPL_T_LOCK_H
-
- #include <sys/param.h>
- #include <sys/mutex.h>
-diff --git a/include/sys/taskq.h b/include/sys/taskq.h
-index c5ccec7..4d90a35 100644
---- a/include/sys/taskq.h
-+++ b/include/sys/taskq.h
-@@ -94,7 +94,7 @@ typedef struct taskq {
- taskqid_t tq_lowest_id; /* lowest pend/work id */
- struct list_head tq_free_list; /* free taskq_ent_t's */
- struct list_head tq_pend_list; /* pending taskq_ent_t's */
-- struct list_head tq_prio_list; /* priority pending taskq_ent_t's */
-+ struct list_head tq_prio_list; /* priority taskq_ent_t's */
- struct list_head tq_delay_list; /* delayed taskq_ent_t's */
- struct list_head tq_taskqs; /* all taskq_t's */
- spl_wait_queue_head_t tq_work_waitq; /* new work waitq */
-diff --git a/include/sys/thread.h b/include/sys/thread.h
-index 433a076..5894db7 100644
---- a/include/sys/thread.h
-+++ b/include/sys/thread.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_THREAD_H
--#define _SPL_THREAD_H
-+#define _SPL_THREAD_H
-
- #include <linux/module.h>
- #include <linux/mm.h>
-@@ -36,28 +36,30 @@
- /*
- * Thread interfaces
- */
--#define TP_MAGIC 0x53535353
-+#define TP_MAGIC 0x53535353
-
--#define TS_SLEEP TASK_INTERRUPTIBLE
--#define TS_RUN TASK_RUNNING
--#define TS_ZOMB EXIT_ZOMBIE
--#define TS_STOPPED TASK_STOPPED
-+#define TS_SLEEP TASK_INTERRUPTIBLE
-+#define TS_RUN TASK_RUNNING
-+#define TS_ZOMB EXIT_ZOMBIE
-+#define TS_STOPPED TASK_STOPPED
-
- typedef void (*thread_func_t)(void *);
-
--#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
-- __thread_create(stk, stksize, (thread_func_t)func, \
-- #func, arg, len, pp, state, pri)
--#define thread_exit() __thread_exit()
--#define thread_join(t) VERIFY(0)
--#define curthread current
--#define getcomm() current->comm
--#define getpid() current->pid
-+/* BEGIN CSTYLED */
-+#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
-+ __thread_create(stk, stksize, (thread_func_t)func, \
-+ #func, arg, len, pp, state, pri)
-+/* END CSTYLED */
-+
-+#define thread_exit() __thread_exit()
-+#define thread_join(t) VERIFY(0)
-+#define curthread current
-+#define getcomm() current->comm
-+#define getpid() current->pid
-
- extern kthread_t *__thread_create(caddr_t stk, size_t stksize,
-- thread_func_t func, const char *name,
-- void *args, size_t len, proc_t *pp,
-- int state, pri_t pri);
-+ thread_func_t func, const char *name, void *args, size_t len, proc_t *pp,
-+ int state, pri_t pri);
- extern void __thread_exit(void);
- extern struct task_struct *spl_kthread_create(int (*func)(void *),
- void *data, const char namefmt[], ...);
-diff --git a/include/sys/timer.h b/include/sys/timer.h
-index 33d577e..0d1f362 100644
---- a/include/sys/timer.h
-+++ b/include/sys/timer.h
-@@ -23,38 +23,37 @@
- \*****************************************************************************/
-
- #ifndef _SPL_TIMER_H
--#define _SPL_TIMER_H
-+#define _SPL_TIMER_H
-
- #include <linux/module.h>
- #include <linux/sched.h>
- #include <linux/timer.h>
-
--#define lbolt ((clock_t)jiffies)
--#define lbolt64 ((int64_t)get_jiffies_64())
-+#define lbolt ((clock_t)jiffies)
-+#define lbolt64 ((int64_t)get_jiffies_64())
-
--#define ddi_get_lbolt() ((clock_t)jiffies)
--#define ddi_get_lbolt64() ((int64_t)get_jiffies_64())
-+#define ddi_get_lbolt() ((clock_t)jiffies)
-+#define ddi_get_lbolt64() ((int64_t)get_jiffies_64())
-
--#define ddi_time_before(a, b) (typecheck(clock_t, a) && \
-+#define ddi_time_before(a, b) (typecheck(clock_t, a) && \
- typecheck(clock_t, b) && \
- ((a) - (b) < 0))
--#define ddi_time_after(a, b) ddi_time_before(b, a)
--#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b))
--#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a)
-+#define ddi_time_after(a, b) ddi_time_before(b, a)
-+#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b))
-+#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a)
-
--#define ddi_time_before64(a, b) (typecheck(int64_t, a) && \
-+#define ddi_time_before64(a, b) (typecheck(int64_t, a) && \
- typecheck(int64_t, b) && \
- ((a) - (b) < 0))
--#define ddi_time_after64(a, b) ddi_time_before64(b, a)
--#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b))
--#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a)
-+#define ddi_time_after64(a, b) ddi_time_before64(b, a)
-+#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b))
-+#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a)
-
--#define delay(ticks) schedule_timeout_uninterruptible(ticks)
-+#define delay(ticks) schedule_timeout_uninterruptible(ticks)
-
--#define SEC_TO_TICK(sec) ((sec) * HZ)
--#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms)
--#define USEC_TO_TICK(us) usecs_to_jiffies(us)
--#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC)
-+#define SEC_TO_TICK(sec) ((sec) * HZ)
-+#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms)
-+#define USEC_TO_TICK(us) usecs_to_jiffies(us)
-+#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC)
-
- #endif /* _SPL_TIMER_H */
--
-diff --git a/include/sys/tsd.h b/include/sys/tsd.h
-index 1894a82..48eaa80 100644
---- a/include/sys/tsd.h
-+++ b/include/sys/tsd.h
-@@ -22,14 +22,14 @@
- \*****************************************************************************/
-
- #ifndef _SPL_TSD_H
--#define _SPL_TSD_H
-+#define _SPL_TSD_H
-
- #include <sys/types.h>
-
--#define TSD_HASH_TABLE_BITS_DEFAULT 9
--#define TSD_KEYS_MAX 32768
--#define DTOR_PID (PID_MAX_LIMIT+1)
--#define PID_KEY (TSD_KEYS_MAX+1)
-+#define TSD_HASH_TABLE_BITS_DEFAULT 9
-+#define TSD_KEYS_MAX 32768
-+#define DTOR_PID (PID_MAX_LIMIT+1)
-+#define PID_KEY (TSD_KEYS_MAX+1)
-
- typedef void (*dtor_func_t)(void *);
-
-diff --git a/include/sys/types.h b/include/sys/types.h
-index d718ca0..2fe63b7 100644
---- a/include/sys/types.h
-+++ b/include/sys/types.h
-@@ -29,14 +29,14 @@
- #include <sys/sysmacros.h>
-
- #ifndef ULLONG_MAX
--#define ULLONG_MAX (~0ULL)
-+#define ULLONG_MAX (~0ULL)
- #endif
-
- #ifndef LLONG_MAX
--#define LLONG_MAX ((long long)(~0ULL>>1))
-+#define LLONG_MAX ((long long)(~0ULL>>1))
- #endif
-
--typedef enum { B_FALSE=0, B_TRUE=1 } boolean_t;
-+typedef enum { B_FALSE = 0, B_TRUE = 1 } boolean_t;
- typedef unsigned long intptr_t;
- typedef unsigned long ulong_t;
- typedef unsigned int uint_t;
-diff --git a/include/sys/u8_textprep.h b/include/sys/u8_textprep.h
-index 0a21c70..e10cb19 100644
---- a/include/sys/u8_textprep.h
-+++ b/include/sys/u8_textprep.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_U8_TEXTPREP_H
--#define _SPL_U8_TEXTPREP_H
-+#define _SPL_U8_TEXTPREP_H
-
- #endif /* SPL_U8_TEXTPREP_H */
-diff --git a/include/sys/uio.h b/include/sys/uio.h
-index 404c037..764beb9 100644
---- a/include/sys/uio.h
-+++ b/include/sys/uio.h
-@@ -24,7 +24,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_UIO_H
--#define _SPL_UIO_H
-+#define _SPL_UIO_H
-
- #include <linux/uio.h>
- #include <linux/blkdev.h>
-@@ -34,15 +34,15 @@
- typedef struct iovec iovec_t;
-
- typedef enum uio_rw {
-- UIO_READ = 0,
-- UIO_WRITE = 1,
-+ UIO_READ = 0,
-+ UIO_WRITE = 1,
- } uio_rw_t;
-
- typedef enum uio_seg {
-- UIO_USERSPACE = 0,
-- UIO_SYSSPACE = 1,
-- UIO_USERISPACE= 2,
-- UIO_BVEC = 3,
-+ UIO_USERSPACE = 0,
-+ UIO_SYSSPACE = 1,
-+ UIO_USERISPACE = 2,
-+ UIO_BVEC = 3,
- } uio_seg_t;
-
- typedef struct uio {
-@@ -71,7 +71,7 @@ typedef enum xuio_type {
- } xuio_type_t;
-
-
--#define UIOA_IOV_MAX 16
-+#define UIOA_IOV_MAX 16
-
- typedef struct uioa_page_s {
- int uioa_pfncnt;
-@@ -100,7 +100,7 @@ typedef struct xuio {
- } xu_ext;
- } xuio_t;
-
--#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv
--#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw
-+#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv
-+#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw
-
- #endif /* SPL_UIO_H */
-diff --git a/include/sys/unistd.h b/include/sys/unistd.h
-index e1d93c6..9391d1a 100644
---- a/include/sys/unistd.h
-+++ b/include/sys/unistd.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_UNISTD_H
--#define _SPL_UNISTD_H
-+#define _SPL_UNISTD_H
-
- #endif /* SPL_UNISTD_H */
-diff --git a/include/sys/user.h b/include/sys/user.h
-index 2b25dd3..3321407 100644
---- a/include/sys/user.h
-+++ b/include/sys/user.h
-@@ -21,7 +21,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_USER_H
--#define _SPL_USER_H
-+#define _SPL_USER_H
-
- /*
- * We have uf_info_t for areleasef(). We implement areleasef() using a global
-@@ -37,6 +37,6 @@
- struct uf_info;
- typedef struct uf_info uf_info_t;
-
--#define P_FINFO(x) ((uf_info_t *)x)
-+#define P_FINFO(x) ((uf_info_t *)x)
-
- #endif /* SPL_USER_H */
-diff --git a/include/sys/va_list.h b/include/sys/va_list.h
-index 9fa173b..388b4c9 100644
---- a/include/sys/va_list.h
-+++ b/include/sys/va_list.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_VA_LIST_H
--#define _SPL_VA_LIST_H
-+#define _SPL_VA_LIST_H
-
- #endif /* SPL_VA_LIST_H */
-diff --git a/include/sys/varargs.h b/include/sys/varargs.h
-index bf360ff..82185bc 100644
---- a/include/sys/varargs.h
-+++ b/include/sys/varargs.h
-@@ -23,8 +23,8 @@
- \*****************************************************************************/
-
- #ifndef _SPL_VARARGS_H
--#define _SPL_VARARGS_H
-+#define _SPL_VARARGS_H
-
--#define __va_list va_list
-+#define __va_list va_list
-
- #endif /* SPL_VARARGS_H */
-diff --git a/include/sys/vfs.h b/include/sys/vfs.h
-index f01dc11..d6fc1c3 100644
---- a/include/sys/vfs.h
-+++ b/include/sys/vfs.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_ZFS_H
--#define _SPL_ZFS_H
-+#define _SPL_ZFS_H
-
- #include <linux/mount.h>
- #include <linux/fs.h>
-@@ -40,7 +40,7 @@ typedef struct spl_fid {
- long fid_pad;
- struct {
- ushort_t len; /* length of data in bytes */
-- char data[MAXFIDSZ];/* data (variable len) */
-+ char data[MAXFIDSZ]; /* data (variable len) */
- } _fid;
- } un;
- } fid_t;
-diff --git a/include/sys/vfs_opreg.h b/include/sys/vfs_opreg.h
-index d3540c5..5909504 100644
---- a/include/sys/vfs_opreg.h
-+++ b/include/sys/vfs_opreg.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_OPREG_H
--#define _SPL_OPREG_H
-+#define _SPL_OPREG_H
-
- #endif /* SPL_OPREG_H */
-diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h
-index 9d334fe..059512b 100644
---- a/include/sys/vmsystm.h
-+++ b/include/sys/vmsystm.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_VMSYSTM_H
--#define _SPL_VMSYSTM_H
-+#define _SPL_VMSYSTM_H
-
- #include <linux/mmzone.h>
- #include <linux/mm.h>
-@@ -48,9 +48,9 @@ copyin(const void *from, void *to, size_t len)
- {
- /* On error copyin routine returns -1 */
- if (xcopyin(from, to, len))
-- return -1;
-+ return (-1);
-
-- return 0;
-+ return (0);
- }
-
- static __inline__ int
-@@ -58,9 +58,9 @@ copyout(const void *from, void *to, size_t len)
- {
- /* On error copyout routine returns -1 */
- if (xcopyout(from, to, len))
-- return -1;
-+ return (-1);
-
-- return 0;
-+ return (0);
- }
-
- static __inline__ int
-@@ -69,7 +69,7 @@ copyinstr(const void *from, void *to, size_t len, size_t *done)
- size_t rc;
-
- if (len == 0)
-- return -ENAMETOOLONG;
-+ return (-ENAMETOOLONG);
-
- /* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */
-
-@@ -78,7 +78,7 @@ copyinstr(const void *from, void *to, size_t len, size_t *done)
- if (done != NULL)
- *done = rc;
-
-- return 0;
-+ return (0);
- }
-
- #endif /* SPL_VMSYSTM_H */
-diff --git a/include/sys/vnode.h b/include/sys/vnode.h
-index ad7f8f4..0ed4794 100644
---- a/include/sys/vnode.h
-+++ b/include/sys/vnode.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_VNODE_H
--#define _SPL_VNODE_H
-+#define _SPL_VNODE_H
-
- #include <linux/module.h>
- #include <linux/syscalls.h>
-@@ -49,25 +49,25 @@
- * was properly split in to O_SYNC and O_DSYNC respectively.
- */
- #ifndef O_DSYNC
--#define O_DSYNC O_SYNC
-+#define O_DSYNC O_SYNC
- #endif
-
--#define FREAD 1
--#define FWRITE 2
--#define FCREAT O_CREAT
--#define FTRUNC O_TRUNC
--#define FOFFMAX O_LARGEFILE
--#define FSYNC O_SYNC
--#define FDSYNC O_DSYNC
--#define FRSYNC O_SYNC
--#define FEXCL O_EXCL
--#define FDIRECT O_DIRECT
--#define FAPPEND O_APPEND
-+#define FREAD 1
-+#define FWRITE 2
-+#define FCREAT O_CREAT
-+#define FTRUNC O_TRUNC
-+#define FOFFMAX O_LARGEFILE
-+#define FSYNC O_SYNC
-+#define FDSYNC O_DSYNC
-+#define FRSYNC O_SYNC
-+#define FEXCL O_EXCL
-+#define FDIRECT O_DIRECT
-+#define FAPPEND O_APPEND
-
--#define FNODSYNC 0x10000 /* fsync pseudo flag */
--#define FNOFOLLOW 0x20000 /* don't follow symlinks */
-+#define FNODSYNC 0x10000 /* fsync pseudo flag */
-+#define FNOFOLLOW 0x20000 /* don't follow symlinks */
-
--#define F_FREESP 11 /* Free file space */
-+#define F_FREESP 11 /* Free file space */
-
-
- /*
-@@ -79,30 +79,30 @@
- #undef AT_UID
- #undef AT_GID
-
--#define AT_MODE ATTR_MODE
--#define AT_UID ATTR_UID
--#define AT_GID ATTR_GID
--#define AT_SIZE ATTR_SIZE
--#define AT_ATIME ATTR_ATIME
--#define AT_MTIME ATTR_MTIME
--#define AT_CTIME ATTR_CTIME
-+#define AT_MODE ATTR_MODE
-+#define AT_UID ATTR_UID
-+#define AT_GID ATTR_GID
-+#define AT_SIZE ATTR_SIZE
-+#define AT_ATIME ATTR_ATIME
-+#define AT_MTIME ATTR_MTIME
-+#define AT_CTIME ATTR_CTIME
-
--#define ATTR_XVATTR (1 << 31)
--#define AT_XVATTR ATTR_XVATTR
-+#define ATTR_XVATTR (1 << 31)
-+#define AT_XVATTR ATTR_XVATTR
-
--#define ATTR_IATTR_MASK (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE | \
-+#define ATTR_IATTR_MASK (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE | \
- ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_FILE)
-
--#define CRCREAT 0x01
--#define RMFILE 0x02
-+#define CRCREAT 0x01
-+#define RMFILE 0x02
-
--#define B_INVAL 0x01
--#define B_TRUNC 0x02
-+#define B_INVAL 0x01
-+#define B_TRUNC 0x02
-
--#define LOOKUP_DIR 0x01
--#define LOOKUP_XATTR 0x02
--#define CREATE_XATTR_DIR 0x04
--#define ATTR_NOACLCHECK 0x20
-+#define LOOKUP_DIR 0x01
-+#define LOOKUP_XATTR 0x02
-+#define CREATE_XATTR_DIR 0x04
-+#define ATTR_NOACLCHECK 0x20
-
- typedef enum vtype {
- VNON = 0,
-@@ -121,8 +121,8 @@ typedef enum vtype {
-
- typedef struct vattr {
- enum vtype va_type; /* vnode type */
-- u_int va_mask; /* attribute bit-mask */
-- u_short va_mode; /* acc mode */
-+ uint_t va_mask; /* attribute bit-mask */
-+ ushort_t va_mode; /* acc mode */
- uid_t va_uid; /* owner uid */
- gid_t va_gid; /* owner gid */
- long va_fsid; /* fs id */
-@@ -168,12 +168,12 @@ void vn_free(vnode_t *vp);
- extern vtype_t vn_mode_to_vtype(mode_t);
- extern mode_t vn_vtype_to_mode(vtype_t);
- extern int vn_open(const char *path, uio_seg_t seg, int flags, int mode,
-- vnode_t **vpp, int x1, void *x2);
-+ vnode_t **vpp, int x1, void *x2);
- extern int vn_openat(const char *path, uio_seg_t seg, int flags, int mode,
-- vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd);
-+ vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd);
- extern int vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len,
-- offset_t off, uio_seg_t seg, int x1, rlim64_t x2,
-- void *x3, ssize_t *residp);
-+ offset_t off, uio_seg_t seg, int x1, rlim64_t x2,
-+ void *x3, ssize_t *residp);
- extern int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4);
- extern int vn_seek(vnode_t *vp, offset_t o, offset_t *op, void *ct);
-
-@@ -189,16 +189,16 @@ extern int vn_set_pwd(const char *filename);
- int spl_vn_init(void);
- void spl_vn_fini(void);
-
--#define VOP_CLOSE vn_close
--#define VOP_SEEK vn_seek
--#define VOP_GETATTR vn_getattr
--#define VOP_FSYNC vn_fsync
--#define VOP_SPACE vn_space
--#define VOP_PUTPAGE(vp, o, s, f, x1, x2) ((void)0)
--#define vn_is_readonly(vp) 0
--#define getf vn_getf
--#define releasef vn_releasef
--#define areleasef vn_areleasef
-+#define VOP_CLOSE vn_close
-+#define VOP_SEEK vn_seek
-+#define VOP_GETATTR vn_getattr
-+#define VOP_FSYNC vn_fsync
-+#define VOP_SPACE vn_space
-+#define VOP_PUTPAGE(vp, o, s, f, x1, x2) ((void)0)
-+#define vn_is_readonly(vp) 0
-+#define getf vn_getf
-+#define releasef vn_releasef
-+#define areleasef vn_areleasef
-
- extern vnode_t *rootdir;
-
-diff --git a/include/sys/zmod.h b/include/sys/zmod.h
-index 15b0bc8..c1d2524 100644
---- a/include/sys/zmod.h
-+++ b/include/sys/zmod.h
-@@ -20,7 +20,8 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
-+ *
- * z_compress_level/z_uncompress are nearly identical copies of the
- * compress2/uncompress functions provided by the official zlib package
- * available at http://zlib.net/. The only changes made we to slightly
-@@ -53,7 +54,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_ZMOD_H
--#define _SPL_ZMOD_H
-+#define _SPL_ZMOD_H
-
- #include <sys/types.h>
- #include <linux/zlib.h>
-diff --git a/include/sys/zone.h b/include/sys/zone.h
-index 5a3c086..47e83ba 100644
---- a/include/sys/zone.h
-+++ b/include/sys/zone.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_ZONE_H
--#define _SPL_ZONE_H
-+#define _SPL_ZONE_H
-
- #include <sys/byteorder.h>
-
-diff --git a/include/unistd.h b/include/unistd.h
-index e1d93c6..9391d1a 100644
---- a/include/unistd.h
-+++ b/include/unistd.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_UNISTD_H
--#define _SPL_UNISTD_H
-+#define _SPL_UNISTD_H
-
- #endif /* SPL_UNISTD_H */
-diff --git a/include/util/qsort.h b/include/util/qsort.h
-index e55c4f8..de0d350 100644
---- a/include/util/qsort.h
-+++ b/include/util/qsort.h
-@@ -23,10 +23,10 @@
- \*****************************************************************************/
-
- #ifndef _SPL_QSORT_H
--#define _SPL_QSORT_H
-+#define _SPL_QSORT_H
-
- #include <linux/sort.h>
-
--#define qsort(base, num, size, cmp) sort(base, num, size, cmp, NULL)
-+#define qsort(base, num, size, cmp) sort(base, num, size, cmp, NULL)
-
- #endif /* SPL_QSORT_H */
-diff --git a/include/util/sscanf.h b/include/util/sscanf.h
-index 23f0b5d..10e669d 100644
---- a/include/util/sscanf.h
-+++ b/include/util/sscanf.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_UTIL_SSCANF_H
--#define _SPL_UTIL_SSCANF_H
-+#define _SPL_UTIL_SSCANF_H
-
- #endif /* SPL_UTIL_SSCAN_H */
-diff --git a/include/vm/anon.h b/include/vm/anon.h
-index 9c9c239..049a326 100644
---- a/include/vm/anon.h
-+++ b/include/vm/anon.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_VM_ANON_H
--#define _SPL_VM_ANON_H
-+#define _SPL_VM_ANON_H
-
- #endif /* SPL_VM_ANON_H */
-diff --git a/include/vm/pvn.h b/include/vm/pvn.h
-index f3b3081..e56caf4 100644
---- a/include/vm/pvn.h
-+++ b/include/vm/pvn.h
-@@ -23,6 +23,6 @@
- \*****************************************************************************/
-
- #ifndef _SPL_VM_PVN_H
--#define _SPL_VM_PVN_H
-+#define _SPL_VM_PVN_H
-
- #endif /* SPL_VM_PVN_H */
-diff --git a/include/vm/seg_kmem.h b/include/vm/seg_kmem.h
-index 17df7b9..3ef2474 100644
---- a/include/vm/seg_kmem.h
-+++ b/include/vm/seg_kmem.h
-@@ -23,7 +23,7 @@
- \*****************************************************************************/
-
- #ifndef _SPL_SEG_KMEM_H
--#define _SPL_SEG_KMEM_H
-+#define _SPL_SEG_KMEM_H
-
- #include <sys/vmsystm.h>
-
-diff --git a/module/spl/spl-atomic.c b/module/spl/spl-atomic.c
-index c46252c..4e1e42c 100644
---- a/module/spl/spl-atomic.c
-+++ b/module/spl/spl-atomic.c
-@@ -20,18 +20,12 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Atomic Implementation.
- \*****************************************************************************/
-
- #include <sys/atomic.h>
-
--#ifdef DEBUG_SUBSYSTEM
--#undef DEBUG_SUBSYSTEM
--#endif
--
--#define DEBUG_SUBSYSTEM S_ATOMIC
--
- #ifdef ATOMIC_SPINLOCK
- /* Global atomic lock declarations */
- DEFINE_SPINLOCK(atomic32_lock);
-diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c
-index 4778fb2..f0060bb 100644
---- a/module/spl/spl-condvar.c
-+++ b/module/spl/spl-condvar.c
-@@ -335,8 +335,8 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time,
- * Compatibility wrapper for the cv_timedwait_hires() Illumos interface.
- */
- static clock_t
--cv_timedwait_hires_common(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
-- int flag, int state)
-+cv_timedwait_hires_common(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim,
-+ hrtime_t res, int flag, int state)
- {
- if (res > 1) {
- /*
-@@ -363,8 +363,8 @@ cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
- EXPORT_SYMBOL(cv_timedwait_hires);
-
- clock_t
--cv_timedwait_sig_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
-- int flag)
-+cv_timedwait_sig_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim,
-+ hrtime_t res, int flag)
- {
- return (cv_timedwait_hires_common(cvp, mp, tim, res, flag,
- TASK_INTERRUPTIBLE));
-diff --git a/module/spl/spl-cred.c b/module/spl/spl-cred.c
-index 1d486c1..f7f7d87 100644
---- a/module/spl/spl-cred.c
-+++ b/module/spl/spl-cred.c
-@@ -20,18 +20,12 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Credential Implementation.
- \*****************************************************************************/
-
- #include <sys/cred.h>
-
--#ifdef DEBUG_SUBSYSTEM
--#undef DEBUG_SUBSYSTEM
--#endif
--
--#define DEBUG_SUBSYSTEM S_CRED
--
- static int
- #ifdef HAVE_KUIDGID_T
- cr_groups_search(const struct group_info *group_info, kgid_t grp)
-@@ -43,7 +37,7 @@ cr_groups_search(const struct group_info *group_info, gid_t grp)
- int cmp;
-
- if (!group_info)
-- return 0;
-+ return (0);
-
- left = 0;
- right = group_info->ngroups;
-@@ -57,16 +51,16 @@ cr_groups_search(const struct group_info *group_info, gid_t grp)
- else if (cmp < 0)
- right = mid;
- else
-- return 1;
-+ return (1);
- }
-- return 0;
-+ return (0);
- }
-
- /* Hold a reference on the credential */
- void
- crhold(cred_t *cr)
- {
-- (void)get_cred((const cred_t *)cr);
-+ (void) get_cred((const cred_t *)cr);
- }
-
- /* Free a reference on the credential */
-@@ -96,7 +90,7 @@ crgetngroups(const cred_t *cr)
- rc = NGROUPS_PER_BLOCK;
- }
- #endif
-- return rc;
-+ return (rc);
- }
-
- /*
-@@ -119,7 +113,7 @@ crgetgroups(const cred_t *cr)
- if (gi->nblocks > 0)
- gids = KGIDP_TO_SGIDP(gi->blocks[0]);
- #endif
-- return gids;
-+ return (gids);
- }
-
- /* Check if the passed gid is available in supplied credential. */
-@@ -132,63 +126,63 @@ groupmember(gid_t gid, const cred_t *cr)
- gi = cr->group_info;
- rc = cr_groups_search(gi, SGID_TO_KGID(gid));
-
-- return rc;
-+ return (rc);
- }
-
- /* Return the effective user id */
- uid_t
- crgetuid(const cred_t *cr)
- {
-- return KUID_TO_SUID(cr->euid);
-+ return (KUID_TO_SUID(cr->euid));
- }
-
- /* Return the real user id */
- uid_t
- crgetruid(const cred_t *cr)
- {
-- return KUID_TO_SUID(cr->uid);
-+ return (KUID_TO_SUID(cr->uid));
- }
-
- /* Return the saved user id */
- uid_t
- crgetsuid(const cred_t *cr)
- {
-- return KUID_TO_SUID(cr->suid);
-+ return (KUID_TO_SUID(cr->suid));
- }
-
- /* Return the filesystem user id */
- uid_t
- crgetfsuid(const cred_t *cr)
- {
-- return KUID_TO_SUID(cr->fsuid);
-+ return (KUID_TO_SUID(cr->fsuid));
- }
-
- /* Return the effective group id */
- gid_t
- crgetgid(const cred_t *cr)
- {
-- return KGID_TO_SGID(cr->egid);
-+ return (KGID_TO_SGID(cr->egid));
- }
-
- /* Return the real group id */
- gid_t
- crgetrgid(const cred_t *cr)
- {
-- return KGID_TO_SGID(cr->gid);
-+ return (KGID_TO_SGID(cr->gid));
- }
-
- /* Return the saved group id */
- gid_t
- crgetsgid(const cred_t *cr)
- {
-- return KGID_TO_SGID(cr->sgid);
-+ return (KGID_TO_SGID(cr->sgid));
- }
-
- /* Return the filesystem group id */
- gid_t
- crgetfsgid(const cred_t *cr)
- {
-- return KGID_TO_SGID(cr->fsgid);
-+ return (KGID_TO_SGID(cr->fsgid));
- }
-
- EXPORT_SYMBOL(crhold);
-diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c
-index 2f66b6e..e089de2 100644
---- a/module/spl/spl-err.c
-+++ b/module/spl/spl-err.c
-@@ -20,7 +20,7 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Error Implementation.
- \*****************************************************************************/
-
-@@ -36,8 +36,7 @@
- */
- unsigned int spl_panic_halt;
- module_param(spl_panic_halt, uint, 0644);
--MODULE_PARM_DESC(spl_panic_halt,
-- "Cause kernel panic on assertion failures");
-+MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures");
-
- /*
- * Limit the number of stack traces dumped to not more than 5 every
-diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c
-index f6782da..80fc54c 100644
---- a/module/spl/spl-generic.c
-+++ b/module/spl/spl-generic.c
-@@ -20,7 +20,7 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Generic Implementation.
- \*****************************************************************************/
-
-@@ -109,13 +109,14 @@ spl_rand_next(uint64_t *s) {
-
- static inline void
- spl_rand_jump(uint64_t *s) {
-- static const uint64_t JUMP[] = { 0x8a5cd789635d2dff, 0x121fd2155c472f96 };
-+ static const uint64_t JUMP[] =
-+ { 0x8a5cd789635d2dff, 0x121fd2155c472f96 };
-
- uint64_t s0 = 0;
- uint64_t s1 = 0;
- int i, b;
-- for(i = 0; i < sizeof JUMP / sizeof *JUMP; i++)
-- for(b = 0; b < 64; b++) {
-+ for (i = 0; i < sizeof (JUMP) / sizeof (*JUMP); i++)
-+ for (b = 0; b < 64; b++) {
- if (JUMP[i] & 1ULL << b) {
- s0 ^= s[0];
- s1 ^= s[1];
-@@ -187,16 +188,16 @@ nlz64(uint64_t x) {
- register int n = 0;
-
- if (x == 0)
-- return 64;
-+ return (64);
-
-- if (x <= 0x00000000FFFFFFFFULL) {n = n + 32; x = x << 32;}
-- if (x <= 0x0000FFFFFFFFFFFFULL) {n = n + 16; x = x << 16;}
-- if (x <= 0x00FFFFFFFFFFFFFFULL) {n = n + 8; x = x << 8;}
-- if (x <= 0x0FFFFFFFFFFFFFFFULL) {n = n + 4; x = x << 4;}
-- if (x <= 0x3FFFFFFFFFFFFFFFULL) {n = n + 2; x = x << 2;}
-- if (x <= 0x7FFFFFFFFFFFFFFFULL) {n = n + 1;}
-+ if (x <= 0x00000000FFFFFFFFULL) { n = n + 32; x = x << 32; }
-+ if (x <= 0x0000FFFFFFFFFFFFULL) { n = n + 16; x = x << 16; }
-+ if (x <= 0x00FFFFFFFFFFFFFFULL) { n = n + 8; x = x << 8; }
-+ if (x <= 0x0FFFFFFFFFFFFFFFULL) { n = n + 4; x = x << 4; }
-+ if (x <= 0x3FFFFFFFFFFFFFFFULL) { n = n + 2; x = x << 2; }
-+ if (x <= 0x7FFFFFFFFFFFFFFFULL) { n = n + 1; }
-
-- return n;
-+ return (n);
- }
-
- /*
-@@ -207,7 +208,7 @@ static inline uint64_t
- __div_u64(uint64_t u, uint32_t v)
- {
- (void) do_div(u, v);
-- return u;
-+ return (u);
- }
-
- /*
-@@ -227,7 +228,7 @@ __udivdi3(uint64_t u, uint64_t v)
-
- if (v >> 32 == 0) { // If v < 2**32:
- if (u >> 32 < v) { // If u/v cannot overflow,
-- return __div_u64(u, v); // just do one division.
-+ return (__div_u64(u, v)); // just do one division.
- } else { // If u/v would overflow:
- u1 = u >> 32; // Break u into two halves.
- u0 = u & 0xFFFFFFFF;
-@@ -235,7 +236,7 @@ __udivdi3(uint64_t u, uint64_t v)
- k = u1 - q1 * v; // First remainder, < v.
- u0 += (k << 32);
- q0 = __div_u64(u0, v); // Seconds quotient digit.
-- return (q1 << 32) + q0;
-+ return ((q1 << 32) + q0);
- }
- } else { // If v >= 2**32:
- n = nlz64(v); // 0 <= n <= 31.
-@@ -249,7 +250,7 @@ __udivdi3(uint64_t u, uint64_t v)
- if ((u - q0 * v) >= v)
- q0 = q0 + 1; // Now q0 is correct.
-
-- return q0;
-+ return (q0);
- }
- }
- EXPORT_SYMBOL(__udivdi3);
-@@ -263,7 +264,7 @@ __divdi3(int64_t u, int64_t v)
- int64_t q, t;
- q = __udivdi3(abs64(u), abs64(v));
- t = (u ^ v) >> 63; // If u, v have different
-- return (q ^ t) - t; // signs, negate q.
-+ return ((q ^ t) - t); // signs, negate q.
- }
- EXPORT_SYMBOL(__divdi3);
-
-@@ -344,9 +345,11 @@ __aeabi_uldivmod(uint64_t u, uint64_t v)
- register uint32_t r2 asm("r2") = (mod & 0xFFFFFFFF);
- register uint32_t r3 asm("r3") = (mod >> 32);
-
-+ /* BEGIN CSTYLED */
- asm volatile(""
- : "+r"(r0), "+r"(r1), "+r"(r2),"+r"(r3) /* output */
- : "r"(r0), "r"(r1), "r"(r2), "r"(r3)); /* input */
-+ /* END CSTYLED */
-
- return; /* r0; */
- }
-@@ -367,9 +370,11 @@ __aeabi_ldivmod(int64_t u, int64_t v)
- register uint32_t r2 asm("r2") = (mod & 0xFFFFFFFF);
- register uint32_t r3 asm("r3") = (mod >> 32);
-
-+ /* BEGIN CSTYLED */
- asm volatile(""
- : "+r"(r0), "+r"(r1), "+r"(r2),"+r"(r3) /* output */
- : "r"(r0), "r"(r1), "r"(r2), "r"(r3)); /* input */
-+ /* END CSTYLED */
-
- return; /* r0; */
- }
-@@ -378,7 +383,8 @@ EXPORT_SYMBOL(__aeabi_ldivmod);
- #endif /* __arm || __arm__ */
- #endif /* BITS_PER_LONG */
-
--/* NOTE: The strtoxx behavior is solely based on my reading of the Solaris
-+/*
-+ * NOTE: The strtoxx behavior is solely based on my reading of the Solaris
- * ddi_strtol(9F) man page. I have not verified the behavior of these
- * functions against their Solaris counterparts. It is possible that I
- * may have misinterpreted the man page or the man page is incorrect.
-@@ -388,28 +394,28 @@ int ddi_strtol(const char *, char **, int, long *);
- int ddi_strtoull(const char *, char **, int, unsigned long long *);
- int ddi_strtoll(const char *, char **, int, long long *);
-
--#define define_ddi_strtoux(type, valtype) \
-+#define define_ddi_strtoux(type, valtype) \
- int ddi_strtou##type(const char *str, char **endptr, \
-- int base, valtype *result) \
-+ int base, valtype *result) \
- { \
- valtype last_value, value = 0; \
- char *ptr = (char *)str; \
- int flag = 1, digit; \
- \
- if (strlen(ptr) == 0) \
-- return EINVAL; \
-+ return (EINVAL); \
- \
- /* Auto-detect base based on prefix */ \
- if (!base) { \
- if (str[0] == '0') { \
-- if (tolower(str[1])=='x' && isxdigit(str[2])) { \
-+ if (tolower(str[1]) == 'x' && isxdigit(str[2])) { \
- base = 16; /* hex */ \
- ptr += 2; \
- } else if (str[1] >= '0' && str[1] < 8) { \
- base = 8; /* octal */ \
- ptr += 1; \
- } else { \
-- return EINVAL; \
-+ return (EINVAL); \
- } \
- } else { \
- base = 10; /* decimal */ \
-@@ -430,7 +436,7 @@ int ddi_strtou##type(const char *str, char **endptr, \
- last_value = value; \
- value = value * base + digit; \
- if (last_value > value) /* Overflow */ \
-- return ERANGE; \
-+ return (ERANGE); \
- \
- flag = 1; \
- ptr++; \
-@@ -442,12 +448,12 @@ int ddi_strtou##type(const char *str, char **endptr, \
- if (endptr) \
- *endptr = (char *)(flag ? ptr : str); \
- \
-- return 0; \
-+ return (0); \
- } \
-
--#define define_ddi_strtox(type, valtype) \
-+#define define_ddi_strtox(type, valtype) \
- int ddi_strto##type(const char *str, char **endptr, \
-- int base, valtype *result) \
-+ int base, valtype *result) \
- { \
- int rc; \
- \
-@@ -463,7 +469,7 @@ int ddi_strto##type(const char *str, char **endptr, \
- rc = ddi_strtou##type(str, endptr, base, result); \
- } \
- \
-- return rc; \
-+ return (rc); \
- }
-
- define_ddi_strtoux(l, unsigned long)
-@@ -482,10 +488,10 @@ ddi_copyin(const void *from, void *to, size_t len, int flags)
- /* Fake ioctl() issued by kernel, 'from' is a kernel address */
- if (flags & FKIOCTL) {
- memcpy(to, from, len);
-- return 0;
-+ return (0);
- }
-
-- return copyin(from, to, len);
-+ return (copyin(from, to, len));
- }
- EXPORT_SYMBOL(ddi_copyin);
-
-@@ -495,10 +501,10 @@ ddi_copyout(const void *from, void *to, size_t len, int flags)
- /* Fake ioctl() issued by kernel, 'from' is a kernel address */
- if (flags & FKIOCTL) {
- memcpy(to, from, len);
-- return 0;
-+ return (0);
- }
-
-- return copyout(from, to, len);
-+ return (copyout(from, to, len));
- }
- EXPORT_SYMBOL(ddi_copyout);
-
-@@ -559,7 +565,7 @@ hostid_read(uint32_t *hostid)
- return (error);
- }
-
-- if (size < sizeof(HW_HOSTID_MASK)) {
-+ if (size < sizeof (HW_HOSTID_MASK)) {
- kobj_close_file(file);
- return (EINVAL);
- }
-@@ -568,7 +574,7 @@ hostid_read(uint32_t *hostid)
- * Read directly into the variable like eglibc does.
- * Short reads are okay; native behavior is preserved.
- */
-- error = kobj_read_file(file, (char *)&value, sizeof(value), 0);
-+ error = kobj_read_file(file, (char *)&value, sizeof (value), 0);
- if (error < 0) {
- kobj_close_file(file);
- return (EIO);
-@@ -578,7 +584,7 @@ hostid_read(uint32_t *hostid)
- *hostid = (value & HW_HOSTID_MASK);
- kobj_close_file(file);
-
-- return 0;
-+ return (0);
- }
-
- /*
-@@ -704,7 +710,7 @@ spl_init(void)
- goto out10;
-
- printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION,
-- SPL_META_RELEASE, SPL_DEBUG_STR);
-+ SPL_META_RELEASE, SPL_DEBUG_STR);
- return (rc);
-
- out10:
-@@ -727,8 +733,8 @@ out2:
- spl_kvmem_fini();
- out1:
- printk(KERN_NOTICE "SPL: Failed to Load Solaris Porting Layer "
-- "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE,
-- SPL_DEBUG_STR, rc);
-+ "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE,
-+ SPL_DEBUG_STR, rc);
-
- return (rc);
- }
-@@ -737,7 +743,7 @@ static void __exit
- spl_fini(void)
- {
- printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n",
-- SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR);
-+ SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR);
- spl_zlib_fini();
- spl_kstat_fini();
- spl_proc_fini();
-diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c
-index 3668669..e4bcdd8 100644
---- a/module/spl/spl-kmem-cache.c
-+++ b/module/spl/spl-kmem-cache.c
-@@ -134,8 +134,8 @@ MODULE_PARM_DESC(spl_kmem_cache_slab_limit,
- * have been deemed costly by the kernel.
- */
- unsigned int spl_kmem_cache_kmem_limit =
-- ((1 << (PAGE_ALLOC_COSTLY_ORDER - 1)) * PAGE_SIZE) /
-- SPL_KMEM_CACHE_OBJ_PER_SLAB;
-+ ((1 << (PAGE_ALLOC_COSTLY_ORDER - 1)) * PAGE_SIZE) /
-+ SPL_KMEM_CACHE_OBJ_PER_SLAB;
- module_param(spl_kmem_cache_kmem_limit, uint, 0644);
- MODULE_PARM_DESC(spl_kmem_cache_kmem_limit,
- "Objects less than N bytes use the kmalloc");
-@@ -1000,15 +1000,15 @@ spl_kmem_cache_create(char *name, size_t size, size_t align,
- #endif
-
- #if defined(HAVE_KMEM_CACHE_CREATE_USERCOPY)
-- /*
-- * Newer grsec patchset uses kmem_cache_create_usercopy()
-- * instead of SLAB_USERCOPY flag
-- */
-- skc->skc_linux_cache = kmem_cache_create_usercopy(
-- skc->skc_name, size, align, slabflags, 0, size, NULL);
-+ /*
-+ * Newer grsec patchset uses kmem_cache_create_usercopy()
-+ * instead of SLAB_USERCOPY flag
-+ */
-+ skc->skc_linux_cache = kmem_cache_create_usercopy(
-+ skc->skc_name, size, align, slabflags, 0, size, NULL);
- #else
-- skc->skc_linux_cache = kmem_cache_create(
-- skc->skc_name, size, align, slabflags, NULL);
-+ skc->skc_linux_cache = kmem_cache_create(
-+ skc->skc_name, size, align, slabflags, NULL);
- #endif
- if (skc->skc_linux_cache == NULL) {
- rc = ENOMEM;
-@@ -1186,7 +1186,7 @@ spl_cache_grow_work(void *data)
- spl_kmem_alloc_t *ska = (spl_kmem_alloc_t *)data;
- spl_kmem_cache_t *skc = ska->ska_cache;
-
-- (void)__spl_cache_grow(skc, ska->ska_flags);
-+ (void) __spl_cache_grow(skc, ska->ska_flags);
-
- atomic_dec(&skc->skc_ref);
- smp_mb__before_atomic();
-diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
-index 41bec75..bf9c6b1 100755
---- a/module/spl/spl-kmem.c
-+++ b/module/spl/spl-kmem.c
-@@ -383,7 +383,7 @@ spl_kmem_free_track(const void *ptr, size_t size)
- {
- kmem_debug_t *dptr;
-
-- /* Ignore NULL pointer since we haven't tracked it at all*/
-+ /* Ignore NULL pointer since we haven't tracked it at all */
- if (ptr == NULL)
- return;
-
-diff --git a/module/spl/spl-kobj.c b/module/spl/spl-kobj.c
-index b79fcb8..500f246 100644
---- a/module/spl/spl-kobj.c
-+++ b/module/spl/spl-kobj.c
-@@ -20,7 +20,7 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Kobj Implementation.
- \*****************************************************************************/
-
-@@ -33,7 +33,7 @@ kobj_open_file(const char *name)
- vnode_t *vp;
- int rc;
-
-- file = kmalloc(sizeof(_buf_t), kmem_flags_convert(KM_SLEEP));
-+ file = kmalloc(sizeof (_buf_t), kmem_flags_convert(KM_SLEEP));
- if (file == NULL)
- return ((_buf_t *)-1UL);
-
-@@ -52,7 +52,7 @@ void
- kobj_close_file(struct _buf *file)
- {
- VOP_CLOSE(file->vp, 0, 0, 0, 0, 0);
-- kfree(file);
-+ kfree(file);
- } /* kobj_close_file() */
- EXPORT_SYMBOL(kobj_close_file);
-
-@@ -72,15 +72,15 @@ EXPORT_SYMBOL(kobj_read_file);
- int
- kobj_get_filesize(struct _buf *file, uint64_t *size)
- {
-- vattr_t vap;
-+ vattr_t vap;
- int rc;
-
- rc = VOP_GETATTR(file->vp, &vap, 0, 0, NULL);
- if (rc)
- return (rc);
-
-- *size = vap.va_size;
-+ *size = vap.va_size;
-
-- return (rc);
-+ return (rc);
- } /* kobj_get_filesize() */
- EXPORT_SYMBOL(kobj_get_filesize);
-diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
-index ed52653..d2baa49 100644
---- a/module/spl/spl-kstat.c
-+++ b/module/spl/spl-kstat.c
-@@ -20,7 +20,7 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Kstat Implementation.
- \*****************************************************************************/
-
-@@ -30,7 +30,7 @@
- #include <sys/cmn_err.h>
-
- #ifndef HAVE_PDE_DATA
--#define PDE_DATA(x) (PDE(x)->data)
-+#define PDE_DATA(x) (PDE(x)->data)
- #endif
-
- static kmutex_t kstat_module_lock;
-@@ -41,13 +41,13 @@ static int
- kstat_resize_raw(kstat_t *ksp)
- {
- if (ksp->ks_raw_bufsize == KSTAT_RAW_MAX)
-- return ENOMEM;
-+ return (ENOMEM);
-
- vmem_free(ksp->ks_raw_buf, ksp->ks_raw_bufsize);
- ksp->ks_raw_bufsize = MIN(ksp->ks_raw_bufsize * 2, KSTAT_RAW_MAX);
- ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP);
-
-- return 0;
-+ return (0);
- }
-
- void
-@@ -119,210 +119,212 @@ EXPORT_SYMBOL(kstat_runq_exit);
- static int
- kstat_seq_show_headers(struct seq_file *f)
- {
-- kstat_t *ksp = (kstat_t *)f->private;
-+ kstat_t *ksp = (kstat_t *)f->private;
- int rc = 0;
-
-- ASSERT(ksp->ks_magic == KS_MAGIC);
-+ ASSERT(ksp->ks_magic == KS_MAGIC);
-
-- seq_printf(f, "%d %d 0x%02x %d %d %lld %lld\n",
-- ksp->ks_kid, ksp->ks_type, ksp->ks_flags,
-- ksp->ks_ndata, (int)ksp->ks_data_size,
-- ksp->ks_crtime, ksp->ks_snaptime);
-+ seq_printf(f, "%d %d 0x%02x %d %d %lld %lld\n",
-+ ksp->ks_kid, ksp->ks_type, ksp->ks_flags,
-+ ksp->ks_ndata, (int)ksp->ks_data_size,
-+ ksp->ks_crtime, ksp->ks_snaptime);
-
- switch (ksp->ks_type) {
-- case KSTAT_TYPE_RAW:
-+ case KSTAT_TYPE_RAW:
- restart:
-- if (ksp->ks_raw_ops.headers) {
-- rc = ksp->ks_raw_ops.headers(
-- ksp->ks_raw_buf, ksp->ks_raw_bufsize);
-+ if (ksp->ks_raw_ops.headers) {
-+ rc = ksp->ks_raw_ops.headers(
-+ ksp->ks_raw_buf, ksp->ks_raw_bufsize);
- if (rc == ENOMEM && !kstat_resize_raw(ksp))
- goto restart;
- if (!rc)
-- seq_puts(f, ksp->ks_raw_buf);
-- } else {
-- seq_printf(f, "raw data\n");
-- }
-- break;
-- case KSTAT_TYPE_NAMED:
-- seq_printf(f, "%-31s %-4s %s\n",
-- "name", "type", "data");
-- break;
-- case KSTAT_TYPE_INTR:
-- seq_printf(f, "%-8s %-8s %-8s %-8s %-8s\n",
-- "hard", "soft", "watchdog",
-- "spurious", "multsvc");
-- break;
-- case KSTAT_TYPE_IO:
-- seq_printf(f,
-- "%-8s %-8s %-8s %-8s %-8s %-8s "
-- "%-8s %-8s %-8s %-8s %-8s %-8s\n",
-- "nread", "nwritten", "reads", "writes",
-- "wtime", "wlentime", "wupdate",
-- "rtime", "rlentime", "rupdate",
-- "wcnt", "rcnt");
-- break;
-- case KSTAT_TYPE_TIMER:
-- seq_printf(f,
-- "%-31s %-8s "
-- "%-8s %-8s %-8s %-8s %-8s\n",
-- "name", "events", "elapsed",
-- "min", "max", "start", "stop");
-- break;
-- default:
-- PANIC("Undefined kstat type %d\n", ksp->ks_type);
-- }
--
-- return -rc;
-+ seq_puts(f, ksp->ks_raw_buf);
-+ } else {
-+ seq_printf(f, "raw data\n");
-+ }
-+ break;
-+ case KSTAT_TYPE_NAMED:
-+ seq_printf(f, "%-31s %-4s %s\n",
-+ "name", "type", "data");
-+ break;
-+ case KSTAT_TYPE_INTR:
-+ seq_printf(f, "%-8s %-8s %-8s %-8s %-8s\n",
-+ "hard", "soft", "watchdog",
-+ "spurious", "multsvc");
-+ break;
-+ case KSTAT_TYPE_IO:
-+ seq_printf(f,
-+ "%-8s %-8s %-8s %-8s %-8s %-8s "
-+ "%-8s %-8s %-8s %-8s %-8s %-8s\n",
-+ "nread", "nwritten", "reads", "writes",
-+ "wtime", "wlentime", "wupdate",
-+ "rtime", "rlentime", "rupdate",
-+ "wcnt", "rcnt");
-+ break;
-+ case KSTAT_TYPE_TIMER:
-+ seq_printf(f,
-+ "%-31s %-8s "
-+ "%-8s %-8s %-8s %-8s %-8s\n",
-+ "name", "events", "elapsed",
-+ "min", "max", "start", "stop");
-+ break;
-+ default:
-+ PANIC("Undefined kstat type %d\n", ksp->ks_type);
-+ }
-+
-+ return (-rc);
- }
-
- static int
- kstat_seq_show_raw(struct seq_file *f, unsigned char *p, int l)
- {
-- int i, j;
-+ int i, j;
-
-- for (i = 0; ; i++) {
-- seq_printf(f, "%03x:", i);
-+ for (i = 0; ; i++) {
-+ seq_printf(f, "%03x:", i);
-
-- for (j = 0; j < 16; j++) {
-- if (i * 16 + j >= l) {
-- seq_printf(f, "\n");
-- goto out;
-- }
-+ for (j = 0; j < 16; j++) {
-+ if (i * 16 + j >= l) {
-+ seq_printf(f, "\n");
-+ goto out;
-+ }
-
-- seq_printf(f, " %02x", (unsigned char)p[i * 16 + j]);
-- }
-- seq_printf(f, "\n");
-- }
-+ seq_printf(f, " %02x", (unsigned char)p[i * 16 + j]);
-+ }
-+ seq_printf(f, "\n");
-+ }
- out:
-- return 0;
-+ return (0);
- }
-
- static int
- kstat_seq_show_named(struct seq_file *f, kstat_named_t *knp)
- {
-- seq_printf(f, "%-31s %-4d ", knp->name, knp->data_type);
--
-- switch (knp->data_type) {
-- case KSTAT_DATA_CHAR:
-- knp->value.c[15] = '\0'; /* NULL terminate */
-- seq_printf(f, "%-16s", knp->value.c);
-- break;
-- /* XXX - We need to be more careful able what tokens are
-- * used for each arch, for now this is correct for x86_64.
-- */
-- case KSTAT_DATA_INT32:
-- seq_printf(f, "%d", knp->value.i32);
-- break;
-- case KSTAT_DATA_UINT32:
-- seq_printf(f, "%u", knp->value.ui32);
-- break;
-- case KSTAT_DATA_INT64:
-- seq_printf(f, "%lld", (signed long long)knp->value.i64);
-- break;
-- case KSTAT_DATA_UINT64:
-- seq_printf(f, "%llu", (unsigned long long)knp->value.ui64);
-- break;
-- case KSTAT_DATA_LONG:
-- seq_printf(f, "%ld", knp->value.l);
-- break;
-- case KSTAT_DATA_ULONG:
-- seq_printf(f, "%lu", knp->value.ul);
-- break;
-- case KSTAT_DATA_STRING:
-- KSTAT_NAMED_STR_PTR(knp)
-- [KSTAT_NAMED_STR_BUFLEN(knp)-1] = '\0';
-- seq_printf(f, "%s", KSTAT_NAMED_STR_PTR(knp));
-- break;
-- default:
-- PANIC("Undefined kstat data type %d\n", knp->data_type);
-- }
--
-- seq_printf(f, "\n");
--
-- return 0;
-+ seq_printf(f, "%-31s %-4d ", knp->name, knp->data_type);
-+
-+ switch (knp->data_type) {
-+ case KSTAT_DATA_CHAR:
-+ knp->value.c[15] = '\0'; /* NULL terminate */
-+ seq_printf(f, "%-16s", knp->value.c);
-+ break;
-+ /*
-+ * NOTE - We need to be more careful able what tokens are
-+ * used for each arch, for now this is correct for x86_64.
-+ */
-+ case KSTAT_DATA_INT32:
-+ seq_printf(f, "%d", knp->value.i32);
-+ break;
-+ case KSTAT_DATA_UINT32:
-+ seq_printf(f, "%u", knp->value.ui32);
-+ break;
-+ case KSTAT_DATA_INT64:
-+ seq_printf(f, "%lld", (signed long long)knp->value.i64);
-+ break;
-+ case KSTAT_DATA_UINT64:
-+ seq_printf(f, "%llu",
-+ (unsigned long long)knp->value.ui64);
-+ break;
-+ case KSTAT_DATA_LONG:
-+ seq_printf(f, "%ld", knp->value.l);
-+ break;
-+ case KSTAT_DATA_ULONG:
-+ seq_printf(f, "%lu", knp->value.ul);
-+ break;
-+ case KSTAT_DATA_STRING:
-+ KSTAT_NAMED_STR_PTR(knp)
-+ [KSTAT_NAMED_STR_BUFLEN(knp)-1] = '\0';
-+ seq_printf(f, "%s", KSTAT_NAMED_STR_PTR(knp));
-+ break;
-+ default:
-+ PANIC("Undefined kstat data type %d\n", knp->data_type);
-+ }
-+
-+ seq_printf(f, "\n");
-+
-+ return (0);
- }
-
- static int
- kstat_seq_show_intr(struct seq_file *f, kstat_intr_t *kip)
- {
-- seq_printf(f, "%-8u %-8u %-8u %-8u %-8u\n",
-- kip->intrs[KSTAT_INTR_HARD],
-- kip->intrs[KSTAT_INTR_SOFT],
-- kip->intrs[KSTAT_INTR_WATCHDOG],
-- kip->intrs[KSTAT_INTR_SPURIOUS],
-- kip->intrs[KSTAT_INTR_MULTSVC]);
--
-- return 0;
-+ seq_printf(f, "%-8u %-8u %-8u %-8u %-8u\n",
-+ kip->intrs[KSTAT_INTR_HARD],
-+ kip->intrs[KSTAT_INTR_SOFT],
-+ kip->intrs[KSTAT_INTR_WATCHDOG],
-+ kip->intrs[KSTAT_INTR_SPURIOUS],
-+ kip->intrs[KSTAT_INTR_MULTSVC]);
-+
-+ return (0);
- }
-
- static int
- kstat_seq_show_io(struct seq_file *f, kstat_io_t *kip)
- {
-- seq_printf(f,
-- "%-8llu %-8llu %-8u %-8u %-8lld %-8lld "
-- "%-8lld %-8lld %-8lld %-8lld %-8u %-8u\n",
-- kip->nread, kip->nwritten,
-- kip->reads, kip->writes,
-- kip->wtime, kip->wlentime, kip->wlastupdate,
-- kip->rtime, kip->rlentime, kip->rlastupdate,
-- kip->wcnt, kip->rcnt);
--
-- return 0;
-+ seq_printf(f,
-+ "%-8llu %-8llu %-8u %-8u %-8lld %-8lld "
-+ "%-8lld %-8lld %-8lld %-8lld %-8u %-8u\n",
-+ kip->nread, kip->nwritten,
-+ kip->reads, kip->writes,
-+ kip->wtime, kip->wlentime, kip->wlastupdate,
-+ kip->rtime, kip->rlentime, kip->rlastupdate,
-+ kip->wcnt, kip->rcnt);
-+
-+ return (0);
- }
-
- static int
- kstat_seq_show_timer(struct seq_file *f, kstat_timer_t *ktp)
- {
-- seq_printf(f,
-- "%-31s %-8llu %-8lld %-8lld %-8lld %-8lld %-8lld\n",
-- ktp->name, ktp->num_events, ktp->elapsed_time,
-- ktp->min_time, ktp->max_time,
-- ktp->start_time, ktp->stop_time);
-+ seq_printf(f,
-+ "%-31s %-8llu %-8lld %-8lld %-8lld %-8lld %-8lld\n",
-+ ktp->name, ktp->num_events, ktp->elapsed_time,
-+ ktp->min_time, ktp->max_time,
-+ ktp->start_time, ktp->stop_time);
-
-- return 0;
-+ return (0);
- }
-
- static int
- kstat_seq_show(struct seq_file *f, void *p)
- {
-- kstat_t *ksp = (kstat_t *)f->private;
-- int rc = 0;
-+ kstat_t *ksp = (kstat_t *)f->private;
-+ int rc = 0;
-
-- ASSERT(ksp->ks_magic == KS_MAGIC);
-+ ASSERT(ksp->ks_magic == KS_MAGIC);
-
- switch (ksp->ks_type) {
-- case KSTAT_TYPE_RAW:
-+ case KSTAT_TYPE_RAW:
- restart:
-- if (ksp->ks_raw_ops.data) {
-- rc = ksp->ks_raw_ops.data(
-+ if (ksp->ks_raw_ops.data) {
-+ rc = ksp->ks_raw_ops.data(
- ksp->ks_raw_buf, ksp->ks_raw_bufsize, p);
- if (rc == ENOMEM && !kstat_resize_raw(ksp))
- goto restart;
- if (!rc)
-- seq_puts(f, ksp->ks_raw_buf);
-- } else {
-- ASSERT(ksp->ks_ndata == 1);
-- rc = kstat_seq_show_raw(f, ksp->ks_data,
-- ksp->ks_data_size);
-- }
-- break;
-- case KSTAT_TYPE_NAMED:
-- rc = kstat_seq_show_named(f, (kstat_named_t *)p);
-- break;
-- case KSTAT_TYPE_INTR:
-- rc = kstat_seq_show_intr(f, (kstat_intr_t *)p);
-- break;
-- case KSTAT_TYPE_IO:
-- rc = kstat_seq_show_io(f, (kstat_io_t *)p);
-- break;
-- case KSTAT_TYPE_TIMER:
-- rc = kstat_seq_show_timer(f, (kstat_timer_t *)p);
-- break;
-- default:
-- PANIC("Undefined kstat type %d\n", ksp->ks_type);
-- }
--
-- return -rc;
-+ seq_puts(f, ksp->ks_raw_buf);
-+ } else {
-+ ASSERT(ksp->ks_ndata == 1);
-+ rc = kstat_seq_show_raw(f, ksp->ks_data,
-+ ksp->ks_data_size);
-+ }
-+ break;
-+ case KSTAT_TYPE_NAMED:
-+ rc = kstat_seq_show_named(f, (kstat_named_t *)p);
-+ break;
-+ case KSTAT_TYPE_INTR:
-+ rc = kstat_seq_show_intr(f, (kstat_intr_t *)p);
-+ break;
-+ case KSTAT_TYPE_IO:
-+ rc = kstat_seq_show_io(f, (kstat_io_t *)p);
-+ break;
-+ case KSTAT_TYPE_TIMER:
-+ rc = kstat_seq_show_timer(f, (kstat_timer_t *)p);
-+ break;
-+ default:
-+ PANIC("Undefined kstat type %d\n", ksp->ks_type);
-+ }
-+
-+ return (-rc);
- }
-
- int
-@@ -333,79 +335,79 @@ kstat_default_update(kstat_t *ksp, int rw)
- if (rw == KSTAT_WRITE)
- return (EACCES);
-
-- return 0;
-+ return (0);
- }
-
- static void *
- kstat_seq_data_addr(kstat_t *ksp, loff_t n)
- {
-- void *rc = NULL;
-+ void *rc = NULL;
-
- switch (ksp->ks_type) {
-- case KSTAT_TYPE_RAW:
-- if (ksp->ks_raw_ops.addr)
-- rc = ksp->ks_raw_ops.addr(ksp, n);
-- else
-- rc = ksp->ks_data;
-- break;
-- case KSTAT_TYPE_NAMED:
-- rc = ksp->ks_data + n * sizeof(kstat_named_t);
-- break;
-- case KSTAT_TYPE_INTR:
-- rc = ksp->ks_data + n * sizeof(kstat_intr_t);
-- break;
-- case KSTAT_TYPE_IO:
-- rc = ksp->ks_data + n * sizeof(kstat_io_t);
-- break;
-- case KSTAT_TYPE_TIMER:
-- rc = ksp->ks_data + n * sizeof(kstat_timer_t);
-- break;
-- default:
-- PANIC("Undefined kstat type %d\n", ksp->ks_type);
-- }
--
-- return (rc);
-+ case KSTAT_TYPE_RAW:
-+ if (ksp->ks_raw_ops.addr)
-+ rc = ksp->ks_raw_ops.addr(ksp, n);
-+ else
-+ rc = ksp->ks_data;
-+ break;
-+ case KSTAT_TYPE_NAMED:
-+ rc = ksp->ks_data + n * sizeof (kstat_named_t);
-+ break;
-+ case KSTAT_TYPE_INTR:
-+ rc = ksp->ks_data + n * sizeof (kstat_intr_t);
-+ break;
-+ case KSTAT_TYPE_IO:
-+ rc = ksp->ks_data + n * sizeof (kstat_io_t);
-+ break;
-+ case KSTAT_TYPE_TIMER:
-+ rc = ksp->ks_data + n * sizeof (kstat_timer_t);
-+ break;
-+ default:
-+ PANIC("Undefined kstat type %d\n", ksp->ks_type);
-+ }
-+
-+ return (rc);
- }
-
- static void *
- kstat_seq_start(struct seq_file *f, loff_t *pos)
- {
-- loff_t n = *pos;
-- kstat_t *ksp = (kstat_t *)f->private;
-- ASSERT(ksp->ks_magic == KS_MAGIC);
-+ loff_t n = *pos;
-+ kstat_t *ksp = (kstat_t *)f->private;
-+ ASSERT(ksp->ks_magic == KS_MAGIC);
-
- mutex_enter(ksp->ks_lock);
-
-- if (ksp->ks_type == KSTAT_TYPE_RAW) {
-- ksp->ks_raw_bufsize = PAGE_SIZE;
-- ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP);
-- }
-+ if (ksp->ks_type == KSTAT_TYPE_RAW) {
-+ ksp->ks_raw_bufsize = PAGE_SIZE;
-+ ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP);
-+ }
-
-- /* Dynamically update kstat, on error existing kstats are used */
-- (void) ksp->ks_update(ksp, KSTAT_READ);
-+ /* Dynamically update kstat, on error existing kstats are used */
-+ (void) ksp->ks_update(ksp, KSTAT_READ);
-
- ksp->ks_snaptime = gethrtime();
-
-- if (!n && kstat_seq_show_headers(f))
-+ if (!n && kstat_seq_show_headers(f))
- return (NULL);
-
-- if (n >= ksp->ks_ndata)
-- return (NULL);
-+ if (n >= ksp->ks_ndata)
-+ return (NULL);
-
-- return (kstat_seq_data_addr(ksp, n));
-+ return (kstat_seq_data_addr(ksp, n));
- }
-
- static void *
- kstat_seq_next(struct seq_file *f, void *p, loff_t *pos)
- {
-- kstat_t *ksp = (kstat_t *)f->private;
-- ASSERT(ksp->ks_magic == KS_MAGIC);
-+ kstat_t *ksp = (kstat_t *)f->private;
-+ ASSERT(ksp->ks_magic == KS_MAGIC);
-
-- ++*pos;
-- if (*pos >= ksp->ks_ndata)
-- return (NULL);
-+ ++*pos;
-+ if (*pos >= ksp->ks_ndata)
-+ return (NULL);
-
-- return (kstat_seq_data_addr(ksp, *pos));
-+ return (kstat_seq_data_addr(ksp, *pos));
- }
-
- static void
-@@ -421,10 +423,10 @@ kstat_seq_stop(struct seq_file *f, void *v)
- }
-
- static struct seq_operations kstat_seq_ops = {
-- .show = kstat_seq_show,
-- .start = kstat_seq_start,
-- .next = kstat_seq_next,
-- .stop = kstat_seq_stop,
-+ .show = kstat_seq_show,
-+ .start = kstat_seq_start,
-+ .next = kstat_seq_next,
-+ .stop = kstat_seq_stop,
- };
-
- static kstat_module_t *
-@@ -465,28 +467,28 @@ kstat_delete_module(kstat_module_t *module)
- ASSERT(list_empty(&module->ksm_kstat_list));
- remove_proc_entry(module->ksm_name, proc_spl_kstat);
- list_del(&module->ksm_module_list);
-- kmem_free(module, sizeof(kstat_module_t));
-+ kmem_free(module, sizeof (kstat_module_t));
- }
-
- static int
- proc_kstat_open(struct inode *inode, struct file *filp)
- {
-- struct seq_file *f;
-- int rc;
-+ struct seq_file *f;
-+ int rc;
-
-- rc = seq_open(filp, &kstat_seq_ops);
-- if (rc)
-- return rc;
-+ rc = seq_open(filp, &kstat_seq_ops);
-+ if (rc)
-+ return (rc);
-
-- f = filp->private_data;
-- f->private = PDE_DATA(inode);
-+ f = filp->private_data;
-+ f->private = PDE_DATA(inode);
-
-- return rc;
-+ return (rc);
- }
-
- static ssize_t
--proc_kstat_write(struct file *filp, const char __user *buf,
-- size_t len, loff_t *ppos)
-+proc_kstat_write(struct file *filp, const char __user *buf, size_t len,
-+ loff_t *ppos)
- {
- struct seq_file *f = filp->private_data;
- kstat_t *ksp = f->private;
-@@ -527,8 +529,8 @@ EXPORT_SYMBOL(__kstat_set_raw_ops);
-
- kstat_t *
- __kstat_create(const char *ks_module, int ks_instance, const char *ks_name,
-- const char *ks_class, uchar_t ks_type, uint_t ks_ndata,
-- uchar_t ks_flags)
-+ const char *ks_class, uchar_t ks_type, uint_t ks_ndata,
-+ uchar_t ks_flags)
- {
- kstat_t *ksp;
-
-@@ -538,24 +540,24 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name,
- ASSERT(!(ks_flags & KSTAT_FLAG_UNSUPPORTED));
-
- if ((ks_type == KSTAT_TYPE_INTR) || (ks_type == KSTAT_TYPE_IO))
-- ASSERT(ks_ndata == 1);
-+ ASSERT(ks_ndata == 1);
-
-- ksp = kmem_zalloc(sizeof(*ksp), KM_SLEEP);
-+ ksp = kmem_zalloc(sizeof (*ksp), KM_SLEEP);
- if (ksp == NULL)
-- return ksp;
-+ return (ksp);
-
- mutex_enter(&kstat_module_lock);
- ksp->ks_kid = kstat_id;
-- kstat_id++;
-+ kstat_id++;
- mutex_exit(&kstat_module_lock);
-
-- ksp->ks_magic = KS_MAGIC;
-+ ksp->ks_magic = KS_MAGIC;
- mutex_init(&ksp->ks_private_lock, NULL, MUTEX_DEFAULT, NULL);
- ksp->ks_lock = &ksp->ks_private_lock;
- INIT_LIST_HEAD(&ksp->ks_list);
-
- ksp->ks_crtime = gethrtime();
-- ksp->ks_snaptime = ksp->ks_crtime;
-+ ksp->ks_snaptime = ksp->ks_crtime;
- strncpy(ksp->ks_module, ks_module, KSTAT_STRLEN);
- ksp->ks_instance = ks_instance;
- strncpy(ksp->ks_name, ks_name, KSTAT_STRLEN);
-@@ -571,41 +573,41 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name,
- ksp->ks_raw_bufsize = 0;
-
- switch (ksp->ks_type) {
-- case KSTAT_TYPE_RAW:
-- ksp->ks_ndata = 1;
-- ksp->ks_data_size = ks_ndata;
-- break;
-- case KSTAT_TYPE_NAMED:
-- ksp->ks_ndata = ks_ndata;
-- ksp->ks_data_size = ks_ndata * sizeof(kstat_named_t);
-- break;
-- case KSTAT_TYPE_INTR:
-- ksp->ks_ndata = ks_ndata;
-- ksp->ks_data_size = ks_ndata * sizeof(kstat_intr_t);
-- break;
-- case KSTAT_TYPE_IO:
-- ksp->ks_ndata = ks_ndata;
-- ksp->ks_data_size = ks_ndata * sizeof(kstat_io_t);
-- break;
-- case KSTAT_TYPE_TIMER:
-- ksp->ks_ndata = ks_ndata;
-- ksp->ks_data_size = ks_ndata * sizeof(kstat_timer_t);
-- break;
-- default:
-- PANIC("Undefined kstat type %d\n", ksp->ks_type);
-- }
-+ case KSTAT_TYPE_RAW:
-+ ksp->ks_ndata = 1;
-+ ksp->ks_data_size = ks_ndata;
-+ break;
-+ case KSTAT_TYPE_NAMED:
-+ ksp->ks_ndata = ks_ndata;
-+ ksp->ks_data_size = ks_ndata * sizeof (kstat_named_t);
-+ break;
-+ case KSTAT_TYPE_INTR:
-+ ksp->ks_ndata = ks_ndata;
-+ ksp->ks_data_size = ks_ndata * sizeof (kstat_intr_t);
-+ break;
-+ case KSTAT_TYPE_IO:
-+ ksp->ks_ndata = ks_ndata;
-+ ksp->ks_data_size = ks_ndata * sizeof (kstat_io_t);
-+ break;
-+ case KSTAT_TYPE_TIMER:
-+ ksp->ks_ndata = ks_ndata;
-+ ksp->ks_data_size = ks_ndata * sizeof (kstat_timer_t);
-+ break;
-+ default:
-+ PANIC("Undefined kstat type %d\n", ksp->ks_type);
-+ }
-
- if (ksp->ks_flags & KSTAT_FLAG_VIRTUAL) {
-- ksp->ks_data = NULL;
-- } else {
-- ksp->ks_data = kmem_zalloc(ksp->ks_data_size, KM_SLEEP);
-- if (ksp->ks_data == NULL) {
-- kmem_free(ksp, sizeof(*ksp));
-- ksp = NULL;
-- }
-- }
--
-- return ksp;
-+ ksp->ks_data = NULL;
-+ } else {
-+ ksp->ks_data = kmem_zalloc(ksp->ks_data_size, KM_SLEEP);
-+ if (ksp->ks_data == NULL) {
-+ kmem_free(ksp, sizeof (*ksp));
-+ ksp = NULL;
-+ }
-+ }
-+
-+ return (ksp);
- }
- EXPORT_SYMBOL(__kstat_create);
-
-@@ -706,9 +708,7 @@ __kstat_delete(kstat_t *ksp)
-
- ksp->ks_lock = NULL;
- mutex_destroy(&ksp->ks_private_lock);
-- kmem_free(ksp, sizeof(*ksp));
--
-- return;
-+ kmem_free(ksp, sizeof (*ksp));
- }
- EXPORT_SYMBOL(__kstat_delete);
-
-@@ -717,7 +717,7 @@ spl_kstat_init(void)
- {
- mutex_init(&kstat_module_lock, NULL, MUTEX_DEFAULT, NULL);
- INIT_LIST_HEAD(&kstat_module_list);
-- kstat_id = 0;
-+ kstat_id = 0;
- return (0);
- }
-
-@@ -727,4 +727,3 @@ spl_kstat_fini(void)
- ASSERT(list_empty(&kstat_module_list));
- mutex_destroy(&kstat_module_lock);
- }
--
-diff --git a/module/spl/spl-mutex.c b/module/spl/spl-mutex.c
-index a29d488..dfb26bf 100644
---- a/module/spl/spl-mutex.c
-+++ b/module/spl/spl-mutex.c
-@@ -20,17 +20,11 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Mutex Implementation.
- \*****************************************************************************/
-
- #include <sys/mutex.h>
-
--#ifdef DEBUG_SUBSYSTEM
--#undef DEBUG_SUBSYSTEM
--#endif
--
--#define DEBUG_SUBSYSTEM S_MUTEX
--
- int spl_mutex_init(void) { return 0; }
- void spl_mutex_fini(void) { }
-diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c
-index 05c1a5d..60d6bbb 100644
---- a/module/spl/spl-proc.c
-+++ b/module/spl/spl-proc.c
-@@ -20,7 +20,7 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Proc Implementation.
- \*****************************************************************************/
-
-@@ -37,7 +37,7 @@
- #include <linux/uaccess.h>
- #include <linux/version.h>
-
--#if defined(CONSTIFY_PLUGIN) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
-+#if defined(CONSTIFY_PLUGIN) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
- typedef struct ctl_table __no_const spl_ctl_table;
- #else
- typedef struct ctl_table spl_ctl_table;
-@@ -55,56 +55,57 @@ static struct proc_dir_entry *proc_spl_taskq = NULL;
- struct proc_dir_entry *proc_spl_kstat = NULL;
-
- static int
--proc_copyin_string(char *kbuffer, int kbuffer_size,
-- const char *ubuffer, int ubuffer_size)
-+proc_copyin_string(char *kbuffer, int kbuffer_size, const char *ubuffer,
-+ int ubuffer_size)
- {
-- int size;
-+ int size;
-
-- if (ubuffer_size > kbuffer_size)
-- return -EOVERFLOW;
-+ if (ubuffer_size > kbuffer_size)
-+ return (-EOVERFLOW);
-
-- if (copy_from_user((void *)kbuffer, (void *)ubuffer, ubuffer_size))
-- return -EFAULT;
-+ if (copy_from_user((void *)kbuffer, (void *)ubuffer, ubuffer_size))
-+ return (-EFAULT);
-
-- /* strip trailing whitespace */
-- size = strnlen(kbuffer, ubuffer_size);
-- while (size-- >= 0)
-- if (!isspace(kbuffer[size]))
-- break;
-+ /* strip trailing whitespace */
-+ size = strnlen(kbuffer, ubuffer_size);
-+ while (size-- >= 0)
-+ if (!isspace(kbuffer[size]))
-+ break;
-
-- /* empty string */
-- if (size < 0)
-- return -EINVAL;
-+ /* empty string */
-+ if (size < 0)
-+ return (-EINVAL);
-
-- /* no space to terminate */
-- if (size == kbuffer_size)
-- return -EOVERFLOW;
-+ /* no space to terminate */
-+ if (size == kbuffer_size)
-+ return (-EOVERFLOW);
-
-- kbuffer[size + 1] = 0;
-- return 0;
-+ kbuffer[size + 1] = 0;
-+ return (0);
- }
-
- static int
- proc_copyout_string(char *ubuffer, int ubuffer_size,
-- const char *kbuffer, char *append)
-+ const char *kbuffer, char *append)
- {
-- /* NB if 'append' != NULL, it's a single character to append to the
-- * copied out string - usually "\n", for /proc entries and
-- * (i.e. a terminating zero byte) for sysctl entries
-- */
-- int size = MIN(strlen(kbuffer), ubuffer_size);
-+ /*
-+ * NB if 'append' != NULL, it's a single character to append to the
-+ * copied out string - usually "\n", for /proc entries and
-+ * (i.e. a terminating zero byte) for sysctl entries
-+ */
-+ int size = MIN(strlen(kbuffer), ubuffer_size);
-
-- if (copy_to_user(ubuffer, kbuffer, size))
-- return -EFAULT;
-+ if (copy_to_user(ubuffer, kbuffer, size))
-+ return (-EFAULT);
-
-- if (append != NULL && size < ubuffer_size) {
-- if (copy_to_user(ubuffer + size, append, 1))
-- return -EFAULT;
-+ if (append != NULL && size < ubuffer_size) {
-+ if (copy_to_user(ubuffer + size, append, 1))
-+ return (-EFAULT);
-
-- size++;
-- }
-+ size++;
-+ }
-
-- return size;
-+ return (size);
- }
-
- #ifdef DEBUG_KMEM
-@@ -112,27 +113,27 @@ static int
- proc_domemused(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
- {
-- int rc = 0;
-- unsigned long min = 0, max = ~0, val;
-- spl_ctl_table dummy = *table;
--
-- dummy.data = &val;
-- dummy.proc_handler = &proc_dointvec;
-- dummy.extra1 = &min;
-- dummy.extra2 = &max;
--
-- if (write) {
-- *ppos += *lenp;
-- } else {
--# ifdef HAVE_ATOMIC64_T
-- val = atomic64_read((atomic64_t *)table->data);
--# else
-- val = atomic_read((atomic_t *)table->data);
--# endif /* HAVE_ATOMIC64_T */
-- rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos);
-- }
--
-- return (rc);
-+ int rc = 0;
-+ unsigned long min = 0, max = ~0, val;
-+ spl_ctl_table dummy = *table;
-+
-+ dummy.data = &val;
-+ dummy.proc_handler = &proc_dointvec;
-+ dummy.extra1 = &min;
-+ dummy.extra2 = &max;
-+
-+ if (write) {
-+ *ppos += *lenp;
-+ } else {
-+#ifdef HAVE_ATOMIC64_T
-+ val = atomic64_read((atomic64_t *)table->data);
-+#else
-+ val = atomic_read((atomic_t *)table->data);
-+#endif /* HAVE_ATOMIC64_T */
-+ rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos);
-+ }
-+
-+ return (rc);
- }
- #endif /* DEBUG_KMEM */
-
-@@ -140,23 +141,23 @@ static int
- proc_doslab(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
- {
-- int rc = 0;
-- unsigned long min = 0, max = ~0, val = 0, mask;
-- spl_ctl_table dummy = *table;
-- spl_kmem_cache_t *skc;
-+ int rc = 0;
-+ unsigned long min = 0, max = ~0, val = 0, mask;
-+ spl_ctl_table dummy = *table;
-+ spl_kmem_cache_t *skc;
-
-- dummy.data = &val;
-- dummy.proc_handler = &proc_dointvec;
-- dummy.extra1 = &min;
-- dummy.extra2 = &max;
-+ dummy.data = &val;
-+ dummy.proc_handler = &proc_dointvec;
-+ dummy.extra1 = &min;
-+ dummy.extra2 = &max;
-
-- if (write) {
-- *ppos += *lenp;
-- } else {
-- down_read(&spl_kmem_cache_sem);
-- mask = (unsigned long)table->data;
-+ if (write) {
-+ *ppos += *lenp;
-+ } else {
-+ down_read(&spl_kmem_cache_sem);
-+ mask = (unsigned long)table->data;
-
-- list_for_each_entry(skc, &spl_kmem_cache_list, skc_list) {
-+ list_for_each_entry(skc, &spl_kmem_cache_list, skc_list) {
-
- /* Only use slabs of the correct kmem/vmem type */
- if (!(skc->skc_flags & mask))
-@@ -165,58 +166,61 @@ proc_doslab(struct ctl_table *table, int write,
- /* Sum the specified field for selected slabs */
- switch (mask & (KMC_TOTAL | KMC_ALLOC | KMC_MAX)) {
- case KMC_TOTAL:
-- val += skc->skc_slab_size * skc->skc_slab_total;
-+ val += skc->skc_slab_size * skc->skc_slab_total;
- break;
- case KMC_ALLOC:
-- val += skc->skc_obj_size * skc->skc_obj_alloc;
-+ val += skc->skc_obj_size * skc->skc_obj_alloc;
- break;
- case KMC_MAX:
-- val += skc->skc_obj_size * skc->skc_obj_max;
-+ val += skc->skc_obj_size * skc->skc_obj_max;
- break;
- }
-- }
-+ }
-
-- up_read(&spl_kmem_cache_sem);
-- rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos);
-- }
-+ up_read(&spl_kmem_cache_sem);
-+ rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos);
-+ }
-
-- return (rc);
-+ return (rc);
- }
-
- static int
- proc_dohostid(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
- {
-- int len, rc = 0;
-- char *end, str[32];
--
-- if (write) {
-- /* We can't use proc_doulongvec_minmax() in the write
-- * case here because hostid while a hex value has no
-- * leading 0x which confuses the helper function. */
-- rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
-- if (rc < 0)
-- return (rc);
--
-- spl_hostid = simple_strtoul(str, &end, 16);
-- if (str == end)
-- return (-EINVAL);
--
-- } else {
-- len = snprintf(str, sizeof(str), "%lx",
-+ int len, rc = 0;
-+ char *end, str[32];
-+
-+ if (write) {
-+ /*
-+ * We can't use proc_doulongvec_minmax() in the write
-+ * case here because hostid while a hex value has no
-+ * leading 0x which confuses the helper function.
-+ */
-+ rc = proc_copyin_string(str, sizeof (str), buffer, *lenp);
-+ if (rc < 0)
-+ return (rc);
-+
-+ spl_hostid = simple_strtoul(str, &end, 16);
-+ if (str == end)
-+ return (-EINVAL);
-+
-+ } else {
-+ len = snprintf(str, sizeof (str), "%lx",
- (unsigned long) zone_get_hostid(NULL));
-- if (*ppos >= len)
-- rc = 0;
-- else
-- rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
--
-- if (rc >= 0) {
-- *lenp = rc;
-- *ppos += rc;
-- }
-- }
--
-- return (rc);
-+ if (*ppos >= len)
-+ rc = 0;
-+ else
-+ rc = proc_copyout_string(buffer,
-+ *lenp, str + *ppos, "\n");
-+
-+ if (rc >= 0) {
-+ *lenp = rc;
-+ *ppos += rc;
-+ }
-+ }
-+
-+ return (rc);
- }
-
- static void
-@@ -229,11 +233,11 @@ taskq_seq_show_headers(struct seq_file *f)
-
- /* indices into the lheads array below */
- #define LHEAD_PEND 0
--#define LHEAD_PRIO 1
--#define LHEAD_DELAY 2
--#define LHEAD_WAIT 3
--#define LHEAD_ACTIVE 4
--#define LHEAD_SIZE 5
-+#define LHEAD_PRIO 1
-+#define LHEAD_DELAY 2
-+#define LHEAD_WAIT 3
-+#define LHEAD_ACTIVE 4
-+#define LHEAD_SIZE 5
-
- static unsigned int spl_max_show_tasks = 512;
- module_param(spl_max_show_tasks, uint, 0644);
-@@ -287,7 +291,7 @@ taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
- spin_unlock_irqrestore(&tq->tq_wait_waitq.lock, wflags);
-
- /* show the base taskq contents */
-- snprintf(name, sizeof(name), "%s/%d", tq->tq_name, tq->tq_instance);
-+ snprintf(name, sizeof (name), "%s/%d", tq->tq_name, tq->tq_instance);
- seq_printf(f, "%-25s ", name);
- seq_printf(f, "%5d %5d %5d %5d %5d %5d %12d %5d %10x\n",
- tq->tq_nactive, tq->tq_nthreads, tq->tq_nspawn,
-@@ -299,7 +303,8 @@ taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
- j = 0;
- list_for_each_entry(tqt, &tq->tq_active_list, tqt_active_list) {
- if (j == 0)
-- seq_printf(f, "\t%s:", list_names[LHEAD_ACTIVE]);
-+ seq_printf(f, "\t%s:",
-+ list_names[LHEAD_ACTIVE]);
- else if (j == 2) {
- seq_printf(f, "\n\t ");
- j = 0;
-@@ -403,32 +408,32 @@ taskq_seq_next(struct seq_file *f, void *p, loff_t *pos)
-
- ++*pos;
- return ((tq->tq_taskqs.next == &tq_list) ?
-- NULL : list_entry(tq->tq_taskqs.next, taskq_t, tq_taskqs));
-+ NULL : list_entry(tq->tq_taskqs.next, taskq_t, tq_taskqs));
- }
-
- static void
- slab_seq_show_headers(struct seq_file *f)
- {
-- seq_printf(f,
-- "--------------------- cache ----------"
-- "--------------------------------------------- "
-- "----- slab ------ "
-- "---- object ----- "
-- "--- emergency ---\n");
-- seq_printf(f,
-- "name "
-- " flags size alloc slabsize objsize "
-- "total alloc max "
-- "total alloc max "
-- "dlock alloc max\n");
-+ seq_printf(f,
-+ "--------------------- cache ----------"
-+ "--------------------------------------------- "
-+ "----- slab ------ "
-+ "---- object ----- "
-+ "--- emergency ---\n");
-+ seq_printf(f,
-+ "name "
-+ " flags size alloc slabsize objsize "
-+ "total alloc max "
-+ "total alloc max "
-+ "dlock alloc max\n");
- }
-
- static int
- slab_seq_show(struct seq_file *f, void *p)
- {
-- spl_kmem_cache_t *skc = p;
-+ spl_kmem_cache_t *skc = p;
-
-- ASSERT(skc->skc_magic == SKC_MAGIC);
-+ ASSERT(skc->skc_magic == SKC_MAGIC);
-
- /*
- * Backed by Linux slab see /proc/slabinfo.
-@@ -436,48 +441,48 @@ slab_seq_show(struct seq_file *f, void *p)
- if (skc->skc_flags & KMC_SLAB)
- return (0);
-
-- spin_lock(&skc->skc_lock);
-- seq_printf(f, "%-36s ", skc->skc_name);
-- seq_printf(f, "0x%05lx %9lu %9lu %8u %8u "
-- "%5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n",
-- (long unsigned)skc->skc_flags,
-- (long unsigned)(skc->skc_slab_size * skc->skc_slab_total),
-- (long unsigned)(skc->skc_obj_size * skc->skc_obj_alloc),
-- (unsigned)skc->skc_slab_size,
-- (unsigned)skc->skc_obj_size,
-- (long unsigned)skc->skc_slab_total,
-- (long unsigned)skc->skc_slab_alloc,
-- (long unsigned)skc->skc_slab_max,
-- (long unsigned)skc->skc_obj_total,
-- (long unsigned)skc->skc_obj_alloc,
-- (long unsigned)skc->skc_obj_max,
-- (long unsigned)skc->skc_obj_deadlock,
-- (long unsigned)skc->skc_obj_emergency,
-- (long unsigned)skc->skc_obj_emergency_max);
--
-- spin_unlock(&skc->skc_lock);
--
-- return 0;
-+ spin_lock(&skc->skc_lock);
-+ seq_printf(f, "%-36s ", skc->skc_name);
-+ seq_printf(f, "0x%05lx %9lu %9lu %8u %8u "
-+ "%5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n",
-+ (long unsigned)skc->skc_flags,
-+ (long unsigned)(skc->skc_slab_size * skc->skc_slab_total),
-+ (long unsigned)(skc->skc_obj_size * skc->skc_obj_alloc),
-+ (unsigned)skc->skc_slab_size,
-+ (unsigned)skc->skc_obj_size,
-+ (long unsigned)skc->skc_slab_total,
-+ (long unsigned)skc->skc_slab_alloc,
-+ (long unsigned)skc->skc_slab_max,
-+ (long unsigned)skc->skc_obj_total,
-+ (long unsigned)skc->skc_obj_alloc,
-+ (long unsigned)skc->skc_obj_max,
-+ (long unsigned)skc->skc_obj_deadlock,
-+ (long unsigned)skc->skc_obj_emergency,
-+ (long unsigned)skc->skc_obj_emergency_max);
-+
-+ spin_unlock(&skc->skc_lock);
-+
-+ return (0);
- }
-
- static void *
- slab_seq_start(struct seq_file *f, loff_t *pos)
- {
-- struct list_head *p;
-- loff_t n = *pos;
-+ struct list_head *p;
-+ loff_t n = *pos;
-
- down_read(&spl_kmem_cache_sem);
-- if (!n)
-- slab_seq_show_headers(f);
-+ if (!n)
-+ slab_seq_show_headers(f);
-
-- p = spl_kmem_cache_list.next;
-- while (n--) {
-- p = p->next;
-- if (p == &spl_kmem_cache_list)
-- return (NULL);
-- }
-+ p = spl_kmem_cache_list.next;
-+ while (n--) {
-+ p = p->next;
-+ if (p == &spl_kmem_cache_list)
-+ return (NULL);
-+ }
-
-- return (list_entry(p, spl_kmem_cache_t, skc_list));
-+ return (list_entry(p, spl_kmem_cache_t, skc_list));
- }
-
- static void *
-@@ -485,9 +490,9 @@ slab_seq_next(struct seq_file *f, void *p, loff_t *pos)
- {
- spl_kmem_cache_t *skc = p;
-
-- ++*pos;
-- return ((skc->skc_list.next == &spl_kmem_cache_list) ?
-- NULL : list_entry(skc->skc_list.next,spl_kmem_cache_t,skc_list));
-+ ++*pos;
-+ return ((skc->skc_list.next == &spl_kmem_cache_list) ?
-+ NULL : list_entry(skc->skc_list.next, spl_kmem_cache_t, skc_list));
- }
-
- static void
-@@ -497,23 +502,23 @@ slab_seq_stop(struct seq_file *f, void *v)
- }
-
- static struct seq_operations slab_seq_ops = {
-- .show = slab_seq_show,
-- .start = slab_seq_start,
-- .next = slab_seq_next,
-- .stop = slab_seq_stop,
-+ .show = slab_seq_show,
-+ .start = slab_seq_start,
-+ .next = slab_seq_next,
-+ .stop = slab_seq_stop,
- };
-
- static int
- proc_slab_open(struct inode *inode, struct file *filp)
- {
-- return seq_open(filp, &slab_seq_ops);
-+ return (seq_open(filp, &slab_seq_ops));
- }
-
- static struct file_operations proc_slab_operations = {
-- .open = proc_slab_open,
-- .read = seq_read,
-- .llseek = seq_lseek,
-- .release = seq_release,
-+ .open = proc_slab_open,
-+ .read = seq_read,
-+ .llseek = seq_lseek,
-+ .release = seq_release,
- };
-
- static void
-@@ -523,122 +528,122 @@ taskq_seq_stop(struct seq_file *f, void *v)
- }
-
- static struct seq_operations taskq_all_seq_ops = {
-- .show = taskq_all_seq_show,
-- .start = taskq_seq_start,
-- .next = taskq_seq_next,
-- .stop = taskq_seq_stop,
-+ .show = taskq_all_seq_show,
-+ .start = taskq_seq_start,
-+ .next = taskq_seq_next,
-+ .stop = taskq_seq_stop,
- };
-
- static struct seq_operations taskq_seq_ops = {
-- .show = taskq_seq_show,
-- .start = taskq_seq_start,
-- .next = taskq_seq_next,
-- .stop = taskq_seq_stop,
-+ .show = taskq_seq_show,
-+ .start = taskq_seq_start,
-+ .next = taskq_seq_next,
-+ .stop = taskq_seq_stop,
- };
-
- static int
- proc_taskq_all_open(struct inode *inode, struct file *filp)
- {
-- return seq_open(filp, &taskq_all_seq_ops);
-+ return (seq_open(filp, &taskq_all_seq_ops));
- }
-
- static int
- proc_taskq_open(struct inode *inode, struct file *filp)
- {
-- return seq_open(filp, &taskq_seq_ops);
-+ return (seq_open(filp, &taskq_seq_ops));
- }
-
- static struct file_operations proc_taskq_all_operations = {
-- .open = proc_taskq_all_open,
-- .read = seq_read,
-- .llseek = seq_lseek,
-- .release = seq_release,
-+ .open = proc_taskq_all_open,
-+ .read = seq_read,
-+ .llseek = seq_lseek,
-+ .release = seq_release,
- };
-
- static struct file_operations proc_taskq_operations = {
-- .open = proc_taskq_open,
-- .read = seq_read,
-- .llseek = seq_lseek,
-- .release = seq_release,
-+ .open = proc_taskq_open,
-+ .read = seq_read,
-+ .llseek = seq_lseek,
-+ .release = seq_release,
- };
-
- static struct ctl_table spl_kmem_table[] = {
- #ifdef DEBUG_KMEM
-- {
-- .procname = "kmem_used",
-- .data = &kmem_alloc_used,
--# ifdef HAVE_ATOMIC64_T
-- .maxlen = sizeof(atomic64_t),
--# else
-- .maxlen = sizeof(atomic_t),
--# endif /* HAVE_ATOMIC64_T */
-- .mode = 0444,
-- .proc_handler = &proc_domemused,
-- },
-- {
-- .procname = "kmem_max",
-- .data = &kmem_alloc_max,
-- .maxlen = sizeof(unsigned long),
-- .extra1 = &table_min,
-- .extra2 = &table_max,
-- .mode = 0444,
-- .proc_handler = &proc_doulongvec_minmax,
-- },
-+ {
-+ .procname = "kmem_used",
-+ .data = &kmem_alloc_used,
-+#ifdef HAVE_ATOMIC64_T
-+ .maxlen = sizeof (atomic64_t),
-+#else
-+ .maxlen = sizeof (atomic_t),
-+#endif /* HAVE_ATOMIC64_T */
-+ .mode = 0444,
-+ .proc_handler = &proc_domemused,
-+ },
-+ {
-+ .procname = "kmem_max",
-+ .data = &kmem_alloc_max,
-+ .maxlen = sizeof (unsigned long),
-+ .extra1 = &table_min,
-+ .extra2 = &table_max,
-+ .mode = 0444,
-+ .proc_handler = &proc_doulongvec_minmax,
-+ },
- #endif /* DEBUG_KMEM */
-- {
-- .procname = "slab_kmem_total",
-- .data = (void *)(KMC_KMEM | KMC_TOTAL),
-- .maxlen = sizeof(unsigned long),
-- .extra1 = &table_min,
-- .extra2 = &table_max,
-- .mode = 0444,
-- .proc_handler = &proc_doslab,
-- },
-- {
-- .procname = "slab_kmem_alloc",
-- .data = (void *)(KMC_KMEM | KMC_ALLOC),
-- .maxlen = sizeof(unsigned long),
-- .extra1 = &table_min,
-- .extra2 = &table_max,
-- .mode = 0444,
-- .proc_handler = &proc_doslab,
-- },
-- {
-- .procname = "slab_kmem_max",
-- .data = (void *)(KMC_KMEM | KMC_MAX),
-- .maxlen = sizeof(unsigned long),
-- .extra1 = &table_min,
-- .extra2 = &table_max,
-- .mode = 0444,
-- .proc_handler = &proc_doslab,
-- },
-- {
-- .procname = "slab_vmem_total",
-- .data = (void *)(KMC_VMEM | KMC_TOTAL),
-- .maxlen = sizeof(unsigned long),
-- .extra1 = &table_min,
-- .extra2 = &table_max,
-- .mode = 0444,
-- .proc_handler = &proc_doslab,
-- },
-- {
-- .procname = "slab_vmem_alloc",
-- .data = (void *)(KMC_VMEM | KMC_ALLOC),
-- .maxlen = sizeof(unsigned long),
-- .extra1 = &table_min,
-- .extra2 = &table_max,
-- .mode = 0444,
-- .proc_handler = &proc_doslab,
-- },
-- {
-- .procname = "slab_vmem_max",
-- .data = (void *)(KMC_VMEM | KMC_MAX),
-- .maxlen = sizeof(unsigned long),
-- .extra1 = &table_min,
-- .extra2 = &table_max,
-- .mode = 0444,
-- .proc_handler = &proc_doslab,
-- },
-+ {
-+ .procname = "slab_kmem_total",
-+ .data = (void *)(KMC_KMEM | KMC_TOTAL),
-+ .maxlen = sizeof (unsigned long),
-+ .extra1 = &table_min,
-+ .extra2 = &table_max,
-+ .mode = 0444,
-+ .proc_handler = &proc_doslab,
-+ },
-+ {
-+ .procname = "slab_kmem_alloc",
-+ .data = (void *)(KMC_KMEM | KMC_ALLOC),
-+ .maxlen = sizeof (unsigned long),
-+ .extra1 = &table_min,
-+ .extra2 = &table_max,
-+ .mode = 0444,
-+ .proc_handler = &proc_doslab,
-+ },
-+ {
-+ .procname = "slab_kmem_max",
-+ .data = (void *)(KMC_KMEM | KMC_MAX),
-+ .maxlen = sizeof (unsigned long),
-+ .extra1 = &table_min,
-+ .extra2 = &table_max,
-+ .mode = 0444,
-+ .proc_handler = &proc_doslab,
-+ },
-+ {
-+ .procname = "slab_vmem_total",
-+ .data = (void *)(KMC_VMEM | KMC_TOTAL),
-+ .maxlen = sizeof (unsigned long),
-+ .extra1 = &table_min,
-+ .extra2 = &table_max,
-+ .mode = 0444,
-+ .proc_handler = &proc_doslab,
-+ },
-+ {
-+ .procname = "slab_vmem_alloc",
-+ .data = (void *)(KMC_VMEM | KMC_ALLOC),
-+ .maxlen = sizeof (unsigned long),
-+ .extra1 = &table_min,
-+ .extra2 = &table_max,
-+ .mode = 0444,
-+ .proc_handler = &proc_doslab,
-+ },
-+ {
-+ .procname = "slab_vmem_max",
-+ .data = (void *)(KMC_VMEM | KMC_MAX),
-+ .maxlen = sizeof (unsigned long),
-+ .extra1 = &table_min,
-+ .extra2 = &table_max,
-+ .mode = 0444,
-+ .proc_handler = &proc_doslab,
-+ },
- {},
- };
-
-@@ -647,43 +652,44 @@ static struct ctl_table spl_kstat_table[] = {
- };
-
- static struct ctl_table spl_table[] = {
-- /* NB No .strategy entries have been provided since
-- * sysctl(8) prefers to go via /proc for portability.
-- */
-- {
-- .procname = "version",
-- .data = spl_version,
-- .maxlen = sizeof(spl_version),
-- .mode = 0444,
-- .proc_handler = &proc_dostring,
-- },
-- {
-- .procname = "hostid",
-- .data = &spl_hostid,
-- .maxlen = sizeof(unsigned long),
-- .mode = 0644,
-- .proc_handler = &proc_dohostid,
-- },
-+ /*
-+ * NB No .strategy entries have been provided since
-+ * sysctl(8) prefers to go via /proc for portability.
-+ */
-+ {
-+ .procname = "version",
-+ .data = spl_version,
-+ .maxlen = sizeof (spl_version),
-+ .mode = 0444,
-+ .proc_handler = &proc_dostring,
-+ },
-+ {
-+ .procname = "hostid",
-+ .data = &spl_hostid,
-+ .maxlen = sizeof (unsigned long),
-+ .mode = 0644,
-+ .proc_handler = &proc_dohostid,
-+ },
- {
-- .procname = "kmem",
-- .mode = 0555,
-- .child = spl_kmem_table,
-+ .procname = "kmem",
-+ .mode = 0555,
-+ .child = spl_kmem_table,
- },
- {
-- .procname = "kstat",
-- .mode = 0555,
-- .child = spl_kstat_table,
-+ .procname = "kstat",
-+ .mode = 0555,
-+ .child = spl_kstat_table,
- },
-- {},
-+ {},
- };
-
- static struct ctl_table spl_dir[] = {
-- {
-- .procname = "spl",
-- .mode = 0555,
-- .child = spl_table,
-- },
-- {}
-+ {
-+ .procname = "spl",
-+ .mode = 0555,
-+ .child = spl_table,
-+ },
-+ {}
- };
-
- static struct ctl_table spl_root[] = {
-@@ -703,7 +709,7 @@ spl_proc_init(void)
- {
- int rc = 0;
-
-- spl_header = register_sysctl_table(spl_root);
-+ spl_header = register_sysctl_table(spl_root);
- if (spl_header == NULL)
- return (-EUNATCH);
-
-@@ -727,48 +733,48 @@ spl_proc_init(void)
- goto out;
- }
-
-- proc_spl_kmem = proc_mkdir("kmem", proc_spl);
-- if (proc_spl_kmem == NULL) {
-- rc = -EUNATCH;
-+ proc_spl_kmem = proc_mkdir("kmem", proc_spl);
-+ if (proc_spl_kmem == NULL) {
-+ rc = -EUNATCH;
- goto out;
- }
-
- proc_spl_kmem_slab = proc_create_data("slab", 0444,
- proc_spl_kmem, &proc_slab_operations, NULL);
-- if (proc_spl_kmem_slab == NULL) {
-+ if (proc_spl_kmem_slab == NULL) {
- rc = -EUNATCH;
- goto out;
- }
-
-- proc_spl_kstat = proc_mkdir("kstat", proc_spl);
-- if (proc_spl_kstat == NULL) {
-- rc = -EUNATCH;
-+ proc_spl_kstat = proc_mkdir("kstat", proc_spl);
-+ if (proc_spl_kstat == NULL) {
-+ rc = -EUNATCH;
- goto out;
- }
- out:
- if (rc) {
- remove_proc_entry("kstat", proc_spl);
-- remove_proc_entry("slab", proc_spl_kmem);
-+ remove_proc_entry("slab", proc_spl_kmem);
- remove_proc_entry("kmem", proc_spl);
- remove_proc_entry("taskq-all", proc_spl);
- remove_proc_entry("taskq", proc_spl);
- remove_proc_entry("spl", NULL);
-- unregister_sysctl_table(spl_header);
-+ unregister_sysctl_table(spl_header);
- }
-
-- return (rc);
-+ return (rc);
- }
-
- void
- spl_proc_fini(void)
- {
- remove_proc_entry("kstat", proc_spl);
-- remove_proc_entry("slab", proc_spl_kmem);
-+ remove_proc_entry("slab", proc_spl_kmem);
- remove_proc_entry("kmem", proc_spl);
- remove_proc_entry("taskq-all", proc_spl);
- remove_proc_entry("taskq", proc_spl);
- remove_proc_entry("spl", NULL);
-
-- ASSERT(spl_header != NULL);
-- unregister_sysctl_table(spl_header);
-+ ASSERT(spl_header != NULL);
-+ unregister_sysctl_table(spl_header);
- }
-diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c
-index d99ef4f..bf7ee2f 100644
---- a/module/spl/spl-rwlock.c
-+++ b/module/spl/spl-rwlock.c
-@@ -20,18 +20,12 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Reader/Writer Lock Implementation.
- \*****************************************************************************/
-
- #include <sys/rwlock.h>
-
--#ifdef DEBUG_SUBSYSTEM
--#undef DEBUG_SUBSYSTEM
--#endif
--
--#define DEBUG_SUBSYSTEM S_RWLOCK
--
- #if defined(CONFIG_PREEMPT_RT_FULL)
-
- #include <linux/rtmutex.h>
-@@ -94,7 +88,7 @@ __rwsem_tryupgrade(struct rw_semaphore *rwsem)
- static int
- __rwsem_tryupgrade(struct rw_semaphore *rwsem)
- {
-- typeof (rwsem->count) val;
-+ typeof(rwsem->count) val;
- val = cmpxchg(&rwsem->count, SPL_RWSEM_SINGLE_READER_VALUE,
- SPL_RWSEM_SINGLE_WRITER_VALUE);
- return (val == SPL_RWSEM_SINGLE_READER_VALUE);
-diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c
-index ae26bdb..2919a94 100644
---- a/module/spl/spl-taskq.c
-+++ b/module/spl/spl-taskq.c
-@@ -87,7 +87,7 @@ taskq_find_by_name(const char *name)
- list_for_each_prev(tql, &tq_list) {
- tq = list_entry(tql, taskq_t, tq_taskqs);
- if (strcmp(name, tq->tq_name) == 0)
-- return tq->tq_instance;
-+ return (tq->tq_instance);
- }
- return (-1);
- }
-@@ -573,7 +573,8 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
- ASSERT(tq->tq_nactive <= tq->tq_nthreads);
- if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) {
- /* Dynamic taskq may be able to spawn another thread */
-- if (!(tq->tq_flags & TASKQ_DYNAMIC) || taskq_thread_spawn(tq) == 0)
-+ if (!(tq->tq_flags & TASKQ_DYNAMIC) ||
-+ taskq_thread_spawn(tq) == 0)
- goto out;
- }
-
-@@ -686,7 +687,8 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags,
-
- if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) {
- /* Dynamic taskq may be able to spawn another thread */
-- if (!(tq->tq_flags & TASKQ_DYNAMIC) || taskq_thread_spawn(tq) == 0)
-+ if (!(tq->tq_flags & TASKQ_DYNAMIC) ||
-+ taskq_thread_spawn(tq) == 0)
- goto out2;
- flags |= TQ_FRONT;
- }
-@@ -786,7 +788,8 @@ taskq_thread_spawn_task(void *arg)
-
- if (taskq_thread_create(tq) == NULL) {
- /* restore spawning count if failed */
-- spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class);
-+ spin_lock_irqsave_nested(&tq->tq_lock, flags,
-+ tq->tq_lock_class);
- tq->tq_nspawn--;
- spin_unlock_irqrestore(&tq->tq_lock, flags);
- }
-@@ -1146,7 +1149,8 @@ taskq_destroy(taskq_t *tq)
- while (tq->tq_nspawn) {
- spin_unlock_irqrestore(&tq->tq_lock, flags);
- schedule_timeout_interruptible(1);
-- spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class);
-+ spin_lock_irqsave_nested(&tq->tq_lock, flags,
-+ tq->tq_lock_class);
- }
-
- /*
-@@ -1239,16 +1243,16 @@ param_set_taskq_kick(const char *val, struct kernel_param *kp)
-
- #ifdef module_param_cb
- static const struct kernel_param_ops param_ops_taskq_kick = {
-- .set = param_set_taskq_kick,
-- .get = param_get_uint,
-+ .set = param_set_taskq_kick,
-+ .get = param_get_uint,
- };
- module_param_cb(spl_taskq_kick, &param_ops_taskq_kick, &spl_taskq_kick, 0644);
- #else
- module_param_call(spl_taskq_kick, param_set_taskq_kick, param_get_uint,
-- &spl_taskq_kick, 0644);
-+ &spl_taskq_kick, 0644);
- #endif
- MODULE_PARM_DESC(spl_taskq_kick,
-- "Write nonzero to kick stuck taskqs to spawn more threads");
-+ "Write nonzero to kick stuck taskqs to spawn more threads");
-
- int
- spl_taskq_init(void)
-diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c
-index b0f4d57..357d0ca 100644
---- a/module/spl/spl-thread.c
-+++ b/module/spl/spl-thread.c
-@@ -20,7 +20,7 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Thread Implementation.
- \*****************************************************************************/
-
-@@ -33,8 +33,8 @@
- */
- typedef struct thread_priv_s {
- unsigned long tp_magic; /* Magic */
-- int tp_name_size; /* Name size */
-- char *tp_name; /* Name (without _thread suffix) */
-+ int tp_name_size; /* Name size */
-+ char *tp_name; /* Name (without _thread suffix) */
- void (*tp_func)(void *); /* Registered function */
- void *tp_args; /* Args to be passed to function */
- size_t tp_len; /* Len to be passed to function */
-@@ -55,12 +55,12 @@ thread_generic_wrapper(void *arg)
- set_current_state(tp->tp_state);
- set_user_nice((kthread_t *)current, PRIO_TO_NICE(tp->tp_pri));
- kmem_free(tp->tp_name, tp->tp_name_size);
-- kmem_free(tp, sizeof(thread_priv_t));
-+ kmem_free(tp, sizeof (thread_priv_t));
-
- if (func)
- func(args);
-
-- return 0;
-+ return (0);
- }
-
- void
-@@ -72,9 +72,11 @@ __thread_exit(void)
- }
- EXPORT_SYMBOL(__thread_exit);
-
--/* thread_create() may block forever if it cannot create a thread or
-+/*
-+ * thread_create() may block forever if it cannot create a thread or
- * allocate memory. This is preferable to returning a NULL which Solaris
-- * style callers likely never check for... since it can't fail. */
-+ * style callers likely never check for... since it can't fail.
-+ */
- kthread_t *
- __thread_create(caddr_t stk, size_t stksize, thread_func_t func,
- const char *name, void *args, size_t len, proc_t *pp,
-@@ -88,7 +90,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func,
- /* Variable stack size unsupported */
- ASSERT(stk == NULL);
-
-- tp = kmem_alloc(sizeof(thread_priv_t), KM_PUSHPAGE);
-+ tp = kmem_alloc(sizeof (thread_priv_t), KM_PUSHPAGE);
- if (tp == NULL)
- return (NULL);
-
-@@ -96,14 +98,15 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func,
- tp->tp_name_size = strlen(name) + 1;
-
- tp->tp_name = kmem_alloc(tp->tp_name_size, KM_PUSHPAGE);
-- if (tp->tp_name == NULL) {
-- kmem_free(tp, sizeof(thread_priv_t));
-+ if (tp->tp_name == NULL) {
-+ kmem_free(tp, sizeof (thread_priv_t));
- return (NULL);
- }
-
- strncpy(tp->tp_name, name, tp->tp_name_size);
-
-- /* Strip trailing "_thread" from passed name which will be the func
-+ /*
-+ * Strip trailing "_thread" from passed name which will be the func
- * name since the exposed API has no parameter for passing a name.
- */
- p = strstr(tp->tp_name, "_thread");
-@@ -117,7 +120,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func,
- tp->tp_pri = pri;
-
- tsk = spl_kthread_create(thread_generic_wrapper, (void *)tp,
-- "%s", tp->tp_name);
-+ "%s", tp->tp_name);
- if (IS_ERR(tsk))
- return (NULL);
-
-@@ -139,7 +142,7 @@ spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...)
- char name[TASK_COMM_LEN];
-
- va_start(args, namefmt);
-- vsnprintf(name, sizeof(name), namefmt, args);
-+ vsnprintf(name, sizeof (name), namefmt, args);
- va_end(args);
- do {
- tsk = kthread_create(func, data, "%s", name);
-diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
-index a804e10..75d8936 100644
---- a/module/spl/spl-vnode.c
-+++ b/module/spl/spl-vnode.c
-@@ -20,7 +20,7 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) Vnode Implementation.
- \*****************************************************************************/
-
-@@ -43,27 +43,27 @@ vtype_t
- vn_mode_to_vtype(mode_t mode)
- {
- if (S_ISREG(mode))
-- return VREG;
-+ return (VREG);
-
- if (S_ISDIR(mode))
-- return VDIR;
-+ return (VDIR);
-
- if (S_ISCHR(mode))
-- return VCHR;
-+ return (VCHR);
-
- if (S_ISBLK(mode))
-- return VBLK;
-+ return (VBLK);
-
- if (S_ISFIFO(mode))
-- return VFIFO;
-+ return (VFIFO);
-
- if (S_ISLNK(mode))
-- return VLNK;
-+ return (VLNK);
-
- if (S_ISSOCK(mode))
-- return VSOCK;
-+ return (VSOCK);
-
-- return VNON;
-+ return (VNON);
- } /* vn_mode_to_vtype() */
- EXPORT_SYMBOL(vn_mode_to_vtype);
-
-@@ -71,27 +71,27 @@ mode_t
- vn_vtype_to_mode(vtype_t vtype)
- {
- if (vtype == VREG)
-- return S_IFREG;
-+ return (S_IFREG);
-
- if (vtype == VDIR)
-- return S_IFDIR;
-+ return (S_IFDIR);
-
- if (vtype == VCHR)
-- return S_IFCHR;
-+ return (S_IFCHR);
-
- if (vtype == VBLK)
-- return S_IFBLK;
-+ return (S_IFBLK);
-
- if (vtype == VFIFO)
-- return S_IFIFO;
-+ return (S_IFIFO);
-
- if (vtype == VLNK)
-- return S_IFLNK;
-+ return (S_IFLNK);
-
- if (vtype == VSOCK)
-- return S_IFSOCK;
-+ return (S_IFSOCK);
-
-- return VNON;
-+ return (VNON);
- } /* vn_vtype_to_mode() */
- EXPORT_SYMBOL(vn_vtype_to_mode);
-
-@@ -135,7 +135,8 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
- if (!(flags & FCREAT) && (flags & FWRITE))
- flags |= FEXCL;
-
-- /* Note for filp_open() the two low bits must be remapped to mean:
-+ /*
-+ * Note for filp_open() the two low bits must be remapped to mean:
- * 01 - read-only -> 00 read-only
- * 10 - write-only -> 01 write-only
- * 11 - read-write -> 10 read-write
-@@ -148,7 +149,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
- fp = filp_open(path, flags, mode);
-
- if (flags & FCREAT)
-- (void)xchg(&current->fs->umask, saved_umask);
-+ (void) xchg(&current->fs->umask, saved_umask);
-
- if (IS_ERR(fp))
- return (-PTR_ERR(fp));
-@@ -187,7 +188,7 @@ EXPORT_SYMBOL(vn_open);
-
- int
- vn_openat(const char *path, uio_seg_t seg, int flags, int mode,
-- vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd)
-+ vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd)
- {
- char *realpath;
- int len, rc;
-@@ -199,7 +200,7 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode,
- if (!realpath)
- return (ENOMEM);
-
-- (void)snprintf(realpath, len, "/%s", path);
-+ (void) snprintf(realpath, len, "/%s", path);
- rc = vn_open(realpath, seg, flags, mode, vpp, x1, x2);
- kfree(realpath);
-
-@@ -259,9 +260,11 @@ vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4)
- } /* vn_close() */
- EXPORT_SYMBOL(vn_close);
-
--/* vn_seek() does not actually seek it only performs bounds checking on the
-+/*
-+ * vn_seek() does not actually seek it only performs bounds checking on the
- * proposed seek. We perform minimal checking and allow vn_rdwr() to catch
-- * anything more serious. */
-+ * anything more serious.
-+ */
- int
- vn_seek(vnode_t *vp, offset_t ooff, offset_t *noffp, void *ct)
- {
-@@ -293,26 +296,27 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
- if (rc)
- return (-rc);
-
-- vap->va_type = vn_mode_to_vtype(stat.mode);
-- vap->va_mode = stat.mode;
-- vap->va_uid = KUID_TO_SUID(stat.uid);
-- vap->va_gid = KGID_TO_SGID(stat.gid);
-- vap->va_fsid = 0;
-- vap->va_nodeid = stat.ino;
-- vap->va_nlink = stat.nlink;
-- vap->va_size = stat.size;
-- vap->va_blksize = stat.blksize;
-- vap->va_atime = stat.atime;
-- vap->va_mtime = stat.mtime;
-- vap->va_ctime = stat.ctime;
-- vap->va_rdev = stat.rdev;
-- vap->va_nblocks = stat.blocks;
-+ vap->va_type = vn_mode_to_vtype(stat.mode);
-+ vap->va_mode = stat.mode;
-+ vap->va_uid = KUID_TO_SUID(stat.uid);
-+ vap->va_gid = KGID_TO_SGID(stat.gid);
-+ vap->va_fsid = 0;
-+ vap->va_nodeid = stat.ino;
-+ vap->va_nlink = stat.nlink;
-+ vap->va_size = stat.size;
-+ vap->va_blksize = stat.blksize;
-+ vap->va_atime = stat.atime;
-+ vap->va_mtime = stat.mtime;
-+ vap->va_ctime = stat.ctime;
-+ vap->va_rdev = stat.rdev;
-+ vap->va_nblocks = stat.blocks;
-
- return (0);
- }
- EXPORT_SYMBOL(vn_getattr);
-
--int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4)
-+int
-+vn_fsync(vnode_t *vp, int flags, void *x3, void *x4)
- {
- int datasync = 0;
- int error;
-@@ -412,22 +416,22 @@ EXPORT_SYMBOL(vn_space);
- static file_t *
- file_find(int fd, struct task_struct *task)
- {
-- file_t *fp;
-+ file_t *fp;
-
-- list_for_each_entry(fp, &vn_file_list, f_list) {
-+ list_for_each_entry(fp, &vn_file_list, f_list) {
- if (fd == fp->f_fd && fp->f_task == task) {
- ASSERT(atomic_read(&fp->f_ref) != 0);
-- return fp;
-+ return (fp);
- }
- }
-
-- return NULL;
-+ return (NULL);
- } /* file_find() */
-
- file_t *
- vn_getf(int fd)
- {
-- struct kstat stat;
-+ struct kstat stat;
- struct file *lfp;
- file_t *fp;
- vnode_t *vp;
-@@ -482,13 +486,14 @@ vn_getf(int fd)
- goto out_fget;
-
- #if defined(HAVE_4ARGS_VFS_GETATTR)
-- rc = vfs_getattr(&lfp->f_path, &stat, STATX_TYPE, AT_STATX_SYNC_AS_STAT);
-+ rc = vfs_getattr(&lfp->f_path, &stat, STATX_TYPE,
-+ AT_STATX_SYNC_AS_STAT);
- #elif defined(HAVE_2ARGS_VFS_GETATTR)
- rc = vfs_getattr(&lfp->f_path, &stat);
- #else
- rc = vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat);
- #endif
-- if (rc)
-+ if (rc)
- goto out_vnode;
-
- mutex_enter(&vp->v_lock);
-@@ -515,7 +520,7 @@ out_mutex:
- mutex_exit(&fp->f_lock);
- kmem_cache_free(vn_file_cache, fp);
- out:
-- return (NULL);
-+ return (NULL);
- } /* getf() */
- EXPORT_SYMBOL(getf);
-
-@@ -556,12 +561,10 @@ vn_areleasef(int fd, uf_info_t *fip)
- return;
- }
-
-- list_del(&fp->f_list);
-+ list_del(&fp->f_list);
- releasef_locked(fp);
- }
- spin_unlock(&vn_file_lock);
--
-- return;
- } /* releasef() */
- EXPORT_SYMBOL(areleasef);
-
-@@ -596,34 +599,34 @@ vn_set_fs_pwd(struct fs_struct *fs, struct path *path)
- int
- vn_set_pwd(const char *filename)
- {
-- struct path path;
-- mm_segment_t saved_fs;
-- int rc;
--
-- /*
-- * user_path_dir() and __user_walk() both expect 'filename' to be
-- * a user space address so we must briefly increase the data segment
-- * size to ensure strncpy_from_user() does not fail with -EFAULT.
-- */
-- saved_fs = get_fs();
-- set_fs(get_ds());
--
-- rc = user_path_dir(filename, &path);
-- if (rc)
-+ struct path path;
-+ mm_segment_t saved_fs;
-+ int rc;
-+
-+ /*
-+ * user_path_dir() and __user_walk() both expect 'filename' to be
-+ * a user space address so we must briefly increase the data segment
-+ * size to ensure strncpy_from_user() does not fail with -EFAULT.
-+ */
-+ saved_fs = get_fs();
-+ set_fs(get_ds());
-+
-+ rc = user_path_dir(filename, &path);
-+ if (rc)
- goto out;
-
-- rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS);
-- if (rc)
-+ rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS);
-+ if (rc)
- goto dput_and_out;
-
-- vn_set_fs_pwd(current->fs, &path);
-+ vn_set_fs_pwd(current->fs, &path);
-
- dput_and_out:
-- path_put(&path);
-+ path_put(&path);
- out:
- set_fs(saved_fs);
-
-- return (-rc);
-+ return (-rc);
- } /* vn_set_pwd() */
- EXPORT_SYMBOL(vn_set_pwd);
-
-@@ -651,10 +654,10 @@ vn_file_cache_constructor(void *buf, void *cdrarg, int kmflags)
- file_t *fp = buf;
-
- atomic_set(&fp->f_ref, 0);
-- mutex_init(&fp->f_lock, NULL, MUTEX_DEFAULT, NULL);
-+ mutex_init(&fp->f_lock, NULL, MUTEX_DEFAULT, NULL);
- INIT_LIST_HEAD(&fp->f_list);
-
-- return (0);
-+ return (0);
- } /* file_cache_constructor() */
-
- static void
-@@ -669,29 +672,26 @@ int
- spl_vn_init(void)
- {
- vn_cache = kmem_cache_create("spl_vn_cache",
-- sizeof(struct vnode), 64,
-- vn_cache_constructor,
-- vn_cache_destructor,
-- NULL, NULL, NULL, 0);
-+ sizeof (struct vnode), 64, vn_cache_constructor,
-+ vn_cache_destructor, NULL, NULL, NULL, 0);
-
- vn_file_cache = kmem_cache_create("spl_vn_file_cache",
-- sizeof(file_t), 64,
-- vn_file_cache_constructor,
-- vn_file_cache_destructor,
-- NULL, NULL, NULL, 0);
-+ sizeof (file_t), 64, vn_file_cache_constructor,
-+ vn_file_cache_destructor, NULL, NULL, NULL, 0);
-+
- return (0);
- } /* vn_init() */
-
- void
- spl_vn_fini(void)
- {
-- file_t *fp, *next_fp;
-+ file_t *fp, *next_fp;
- int leaked = 0;
-
- spin_lock(&vn_file_lock);
-
-- list_for_each_entry_safe(fp, next_fp, &vn_file_list, f_list) {
-- list_del(&fp->f_list);
-+ list_for_each_entry_safe(fp, next_fp, &vn_file_list, f_list) {
-+ list_del(&fp->f_list);
- releasef_locked(fp);
- leaked++;
- }
-@@ -703,6 +703,4 @@ spl_vn_fini(void)
-
- kmem_cache_destroy(vn_file_cache);
- kmem_cache_destroy(vn_cache);
--
-- return;
- } /* vn_fini() */
-diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c
-index 9405dc8..7c166e9 100644
---- a/module/spl/spl-xdr.c
-+++ b/module/spl/spl-xdr.c
-@@ -17,7 +17,7 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
- * Solaris Porting Layer (SPL) XDR Implementation.
- \*****************************************************************************/
-
-@@ -163,12 +163,12 @@ xdrmem_control(XDR *xdrs, int req, void *info)
- struct xdr_bytesrec *rec = (struct xdr_bytesrec *) info;
-
- if (req != XDR_GET_BYTES_AVAIL)
-- return FALSE;
-+ return (FALSE);
-
- rec->xc_is_last_record = TRUE; /* always TRUE in xdrmem streams */
- rec->xc_num_avail = xdrs->x_addr_end - xdrs->x_addr;
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
-@@ -178,13 +178,13 @@ xdrmem_enc_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt)
- uint_t pad;
-
- if (size < cnt)
-- return FALSE; /* Integer overflow */
-+ return (FALSE); /* Integer overflow */
-
- if (xdrs->x_addr > xdrs->x_addr_end)
-- return FALSE;
-+ return (FALSE);
-
- if (xdrs->x_addr_end - xdrs->x_addr < size)
-- return FALSE;
-+ return (FALSE);
-
- memcpy(xdrs->x_addr, cp, cnt);
-
-@@ -196,7 +196,7 @@ xdrmem_enc_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt)
- xdrs->x_addr += pad;
- }
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
-@@ -207,13 +207,13 @@ xdrmem_dec_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt)
- uint_t pad;
-
- if (size < cnt)
-- return FALSE; /* Integer overflow */
-+ return (FALSE); /* Integer overflow */
-
- if (xdrs->x_addr > xdrs->x_addr_end)
-- return FALSE;
-+ return (FALSE);
-
- if (xdrs->x_addr_end - xdrs->x_addr < size)
-- return FALSE;
-+ return (FALSE);
-
- memcpy(cp, xdrs->x_addr, cnt);
- xdrs->x_addr += cnt;
-@@ -222,38 +222,38 @@ xdrmem_dec_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt)
- if (pad > 0) {
- /* An inverted memchr() would be useful here... */
- if (memcmp(&zero, xdrs->x_addr, pad) != 0)
-- return FALSE;
-+ return (FALSE);
-
- xdrs->x_addr += pad;
- }
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
- xdrmem_enc_uint32(XDR *xdrs, uint32_t val)
- {
-- if (xdrs->x_addr + sizeof(uint32_t) > xdrs->x_addr_end)
-- return FALSE;
-+ if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end)
-+ return (FALSE);
-
- *((uint32_t *) xdrs->x_addr) = cpu_to_be32(val);
-
-- xdrs->x_addr += sizeof(uint32_t);
-+ xdrs->x_addr += sizeof (uint32_t);
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
- xdrmem_dec_uint32(XDR *xdrs, uint32_t *val)
- {
-- if (xdrs->x_addr + sizeof(uint32_t) > xdrs->x_addr_end)
-- return FALSE;
-+ if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end)
-+ return (FALSE);
-
- *val = be32_to_cpu(*((uint32_t *) xdrs->x_addr));
-
-- xdrs->x_addr += sizeof(uint32_t);
-+ xdrs->x_addr += sizeof (uint32_t);
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
-@@ -261,10 +261,10 @@ xdrmem_enc_char(XDR *xdrs, char *cp)
- {
- uint32_t val;
-
-- BUILD_BUG_ON(sizeof(char) != 1);
-+ BUILD_BUG_ON(sizeof (char) != 1);
- val = *((unsigned char *) cp);
-
-- return xdrmem_enc_uint32(xdrs, val);
-+ return (xdrmem_enc_uint32(xdrs, val));
- }
-
- static bool_t
-@@ -272,10 +272,10 @@ xdrmem_dec_char(XDR *xdrs, char *cp)
- {
- uint32_t val;
-
-- BUILD_BUG_ON(sizeof(char) != 1);
-+ BUILD_BUG_ON(sizeof (char) != 1);
-
- if (!xdrmem_dec_uint32(xdrs, &val))
-- return FALSE;
-+ return (FALSE);
-
- /*
- * If any of the 3 other bytes are non-zero then val will be greater
-@@ -283,19 +283,19 @@ xdrmem_dec_char(XDR *xdrs, char *cp)
- * not have a char encoded in it.
- */
- if (val > 0xff)
-- return FALSE;
-+ return (FALSE);
-
- *((unsigned char *) cp) = val;
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
- xdrmem_enc_ushort(XDR *xdrs, unsigned short *usp)
- {
-- BUILD_BUG_ON(sizeof(unsigned short) != 2);
-+ BUILD_BUG_ON(sizeof (unsigned short) != 2);
-
-- return xdrmem_enc_uint32(xdrs, *usp);
-+ return (xdrmem_enc_uint32(xdrs, *usp));
- }
-
- static bool_t
-@@ -303,48 +303,48 @@ xdrmem_dec_ushort(XDR *xdrs, unsigned short *usp)
- {
- uint32_t val;
-
-- BUILD_BUG_ON(sizeof(unsigned short) != 2);
-+ BUILD_BUG_ON(sizeof (unsigned short) != 2);
-
- if (!xdrmem_dec_uint32(xdrs, &val))
-- return FALSE;
-+ return (FALSE);
-
- /*
- * Short ints are not in the RFC, but we assume similar logic as in
- * xdrmem_dec_char().
- */
- if (val > 0xffff)
-- return FALSE;
-+ return (FALSE);
-
- *usp = val;
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
- xdrmem_enc_uint(XDR *xdrs, unsigned *up)
- {
-- BUILD_BUG_ON(sizeof(unsigned) != 4);
-+ BUILD_BUG_ON(sizeof (unsigned) != 4);
-
-- return xdrmem_enc_uint32(xdrs, *up);
-+ return (xdrmem_enc_uint32(xdrs, *up));
- }
-
- static bool_t
- xdrmem_dec_uint(XDR *xdrs, unsigned *up)
- {
-- BUILD_BUG_ON(sizeof(unsigned) != 4);
-+ BUILD_BUG_ON(sizeof (unsigned) != 4);
-
-- return xdrmem_dec_uint32(xdrs, (uint32_t *) up);
-+ return (xdrmem_dec_uint32(xdrs, (uint32_t *) up));
- }
-
- static bool_t
- xdrmem_enc_ulonglong(XDR *xdrs, u_longlong_t *ullp)
- {
-- BUILD_BUG_ON(sizeof(u_longlong_t) != 8);
-+ BUILD_BUG_ON(sizeof (u_longlong_t) != 8);
-
- if (!xdrmem_enc_uint32(xdrs, *ullp >> 32))
-- return FALSE;
-+ return (FALSE);
-
-- return xdrmem_enc_uint32(xdrs, *ullp & 0xffffffff);
-+ return (xdrmem_enc_uint32(xdrs, *ullp & 0xffffffff));
- }
-
- static bool_t
-@@ -352,16 +352,16 @@ xdrmem_dec_ulonglong(XDR *xdrs, u_longlong_t *ullp)
- {
- uint32_t low, high;
-
-- BUILD_BUG_ON(sizeof(u_longlong_t) != 8);
-+ BUILD_BUG_ON(sizeof (u_longlong_t) != 8);
-
- if (!xdrmem_dec_uint32(xdrs, &high))
-- return FALSE;
-+ return (FALSE);
- if (!xdrmem_dec_uint32(xdrs, &low))
-- return FALSE;
-+ return (FALSE);
-
- *ullp = ((u_longlong_t) high << 32) | low;
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
-@@ -372,18 +372,18 @@ xdr_enc_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize,
- caddr_t addr = *arrp;
-
- if (*sizep > maxsize || *sizep > UINT_MAX / elsize)
-- return FALSE;
-+ return (FALSE);
-
- if (!xdrmem_enc_uint(xdrs, sizep))
-- return FALSE;
-+ return (FALSE);
-
- for (i = 0; i < *sizep; i++) {
- if (!elproc(xdrs, addr))
-- return FALSE;
-+ return (FALSE);
- addr += elsize;
- }
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
-@@ -395,23 +395,23 @@ xdr_dec_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize,
- caddr_t addr;
-
- if (!xdrmem_dec_uint(xdrs, sizep))
-- return FALSE;
-+ return (FALSE);
-
- size = *sizep;
-
- if (size > maxsize || size > UINT_MAX / elsize)
-- return FALSE;
-+ return (FALSE);
-
- /*
- * The Solaris man page says: "If *arrp is NULL when decoding,
- * xdr_array() allocates memory and *arrp points to it".
- */
- if (*arrp == NULL) {
-- BUILD_BUG_ON(sizeof(uint_t) > sizeof(size_t));
-+ BUILD_BUG_ON(sizeof (uint_t) > sizeof (size_t));
-
- *arrp = kmem_alloc(size * elsize, KM_NOSLEEP);
- if (*arrp == NULL)
-- return FALSE;
-+ return (FALSE);
-
- alloc = TRUE;
- }
-@@ -422,12 +422,12 @@ xdr_dec_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize,
- if (!elproc(xdrs, addr)) {
- if (alloc)
- kmem_free(*arrp, size * elsize);
-- return FALSE;
-+ return (FALSE);
- }
- addr += elsize;
- }
-
-- return TRUE;
-+ return (TRUE);
- }
-
- static bool_t
-@@ -437,14 +437,14 @@ xdr_enc_string(XDR *xdrs, char **sp, const uint_t maxsize)
- uint_t len;
-
- if (slen > maxsize)
-- return FALSE;
-+ return (FALSE);
-
- len = slen;
-
- if (!xdrmem_enc_uint(xdrs, &len))
-- return FALSE;
-+ return (FALSE);
-
-- return xdrmem_enc_bytes(xdrs, *sp, len);
-+ return (xdrmem_enc_bytes(xdrs, *sp, len));
- }
-
- static bool_t
-@@ -454,21 +454,21 @@ xdr_dec_string(XDR *xdrs, char **sp, const uint_t maxsize)
- bool_t alloc = FALSE;
-
- if (!xdrmem_dec_uint(xdrs, &size))
-- return FALSE;
-+ return (FALSE);
-
- if (size > maxsize || size > UINT_MAX - 1)
-- return FALSE;
-+ return (FALSE);
-
- /*
- * Solaris man page: "If *sp is NULL when decoding, xdr_string()
- * allocates memory and *sp points to it".
- */
- if (*sp == NULL) {
-- BUILD_BUG_ON(sizeof(uint_t) > sizeof(size_t));
-+ BUILD_BUG_ON(sizeof (uint_t) > sizeof (size_t));
-
- *sp = kmem_alloc(size + 1, KM_NOSLEEP);
- if (*sp == NULL)
-- return FALSE;
-+ return (FALSE);
-
- alloc = TRUE;
- }
-@@ -481,34 +481,33 @@ xdr_dec_string(XDR *xdrs, char **sp, const uint_t maxsize)
-
- (*sp)[size] = '\0';
-
-- return TRUE;
-+ return (TRUE);
-
- fail:
- if (alloc)
- kmem_free(*sp, size + 1);
-
-- return FALSE;
-+ return (FALSE);
- }
-
- static struct xdr_ops xdrmem_encode_ops = {
-- .xdr_control = xdrmem_control,
-- .xdr_char = xdrmem_enc_char,
-- .xdr_u_short = xdrmem_enc_ushort,
-- .xdr_u_int = xdrmem_enc_uint,
-- .xdr_u_longlong_t = xdrmem_enc_ulonglong,
-- .xdr_opaque = xdrmem_enc_bytes,
-- .xdr_string = xdr_enc_string,
-- .xdr_array = xdr_enc_array
-+ .xdr_control = xdrmem_control,
-+ .xdr_char = xdrmem_enc_char,
-+ .xdr_u_short = xdrmem_enc_ushort,
-+ .xdr_u_int = xdrmem_enc_uint,
-+ .xdr_u_longlong_t = xdrmem_enc_ulonglong,
-+ .xdr_opaque = xdrmem_enc_bytes,
-+ .xdr_string = xdr_enc_string,
-+ .xdr_array = xdr_enc_array
- };
-
- static struct xdr_ops xdrmem_decode_ops = {
-- .xdr_control = xdrmem_control,
-- .xdr_char = xdrmem_dec_char,
-- .xdr_u_short = xdrmem_dec_ushort,
-- .xdr_u_int = xdrmem_dec_uint,
-- .xdr_u_longlong_t = xdrmem_dec_ulonglong,
-- .xdr_opaque = xdrmem_dec_bytes,
-- .xdr_string = xdr_dec_string,
-- .xdr_array = xdr_dec_array
-+ .xdr_control = xdrmem_control,
-+ .xdr_char = xdrmem_dec_char,
-+ .xdr_u_short = xdrmem_dec_ushort,
-+ .xdr_u_int = xdrmem_dec_uint,
-+ .xdr_u_longlong_t = xdrmem_dec_ulonglong,
-+ .xdr_opaque = xdrmem_dec_bytes,
-+ .xdr_string = xdr_dec_string,
-+ .xdr_array = xdr_dec_array
- };
--
-diff --git a/module/spl/spl-zlib.c b/module/spl/spl-zlib.c
-index 77c2a1d..37fedb1 100644
---- a/module/spl/spl-zlib.c
-+++ b/module/spl/spl-zlib.c
-@@ -20,7 +20,8 @@
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-- *****************************************************************************
-+ *
-+ *
- * z_compress_level/z_uncompress are nearly identical copies of the
- * compress2/uncompress functions provided by the official zlib package
- * available at http://zlib.net/. The only changes made we to slightly
-@@ -72,7 +73,7 @@ static spl_kmem_cache_t *zlib_workspace_cache;
- static void *
- zlib_workspace_alloc(int flags)
- {
-- return kmem_cache_alloc(zlib_workspace_cache, flags & ~(__GFP_FS));
-+ return (kmem_cache_alloc(zlib_workspace_cache, flags & ~(__GFP_FS)));
- }
-
- static void
-@@ -94,7 +95,7 @@ zlib_workspace_free(void *workspace)
- */
- int
- z_compress_level(void *dest, size_t *destLen, const void *source,
-- size_t sourceLen, int level)
-+ size_t sourceLen, int level)
- {
- z_stream stream;
- int err;
-@@ -105,30 +106,30 @@ z_compress_level(void *dest, size_t *destLen, const void *source,
- stream.avail_out = (uInt)*destLen;
-
- if ((size_t)stream.avail_out != *destLen)
-- return Z_BUF_ERROR;
-+ return (Z_BUF_ERROR);
-
- stream.workspace = zlib_workspace_alloc(KM_SLEEP);
- if (!stream.workspace)
-- return Z_MEM_ERROR;
-+ return (Z_MEM_ERROR);
-
- err = zlib_deflateInit(&stream, level);
- if (err != Z_OK) {
- zlib_workspace_free(stream.workspace);
-- return err;
-+ return (err);
- }
-
- err = zlib_deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- zlib_deflateEnd(&stream);
- zlib_workspace_free(stream.workspace);
-- return err == Z_OK ? Z_BUF_ERROR : err;
-+ return (err == Z_OK ? Z_BUF_ERROR : err);
- }
- *destLen = stream.total_out;
-
- err = zlib_deflateEnd(&stream);
- zlib_workspace_free(stream.workspace);
-
-- return err;
-+ return (err);
- }
- EXPORT_SYMBOL(z_compress_level);
-
-@@ -159,16 +160,16 @@ z_uncompress(void *dest, size_t *destLen, const void *source, size_t sourceLen)
- stream.avail_out = (uInt)*destLen;
-
- if ((size_t)stream.avail_out != *destLen)
-- return Z_BUF_ERROR;
-+ return (Z_BUF_ERROR);
-
- stream.workspace = zlib_workspace_alloc(KM_SLEEP);
- if (!stream.workspace)
-- return Z_MEM_ERROR;
-+ return (Z_MEM_ERROR);
-
- err = zlib_inflateInit(&stream);
- if (err != Z_OK) {
- zlib_workspace_free(stream.workspace);
-- return err;
-+ return (err);
- }
-
- err = zlib_inflate(&stream, Z_FINISH);
-@@ -177,17 +178,17 @@ z_uncompress(void *dest, size_t *destLen, const void *source, size_t sourceLen)
- zlib_workspace_free(stream.workspace);
-
- if (err == Z_NEED_DICT ||
-- (err == Z_BUF_ERROR && stream.avail_in == 0))
-- return Z_DATA_ERROR;
-+ (err == Z_BUF_ERROR && stream.avail_in == 0))
-+ return (Z_DATA_ERROR);
-
-- return err;
-+ return (err);
- }
- *destLen = stream.total_out;
-
- err = zlib_inflateEnd(&stream);
- zlib_workspace_free(stream.workspace);
-
-- return err;
-+ return (err);
- }
- EXPORT_SYMBOL(z_uncompress);
-
-@@ -203,15 +204,15 @@ spl_zlib_init(void)
- "spl_zlib_workspace_cache",
- size, 0, NULL, NULL, NULL, NULL, NULL,
- KMC_VMEM | KMC_NOEMERGENCY);
-- if (!zlib_workspace_cache)
-+ if (!zlib_workspace_cache)
- return (1);
-
-- return (0);
-+ return (0);
- }
-
- void
- spl_zlib_fini(void)
- {
- kmem_cache_destroy(zlib_workspace_cache);
-- zlib_workspace_cache = NULL;
-+ zlib_workspace_cache = NULL;
- }
---
-2.14.2
-
diff --git a/spl-patches/0007-Split-spl-build.m4.patch b/spl-patches/0007-Split-spl-build.m4.patch
deleted file mode 100644
index db884c9..0000000
--- a/spl-patches/0007-Split-spl-build.m4.patch
+++ /dev/null
@@ -1,2088 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Wed, 7 Feb 2018 11:50:24 -0800
-Subject: [PATCH] Split spl-build.m4
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Split the kernel interface configure checks in to seperate m4
-macro files. This is intended to facilitate moving the spl
-source code in to the zfs repository.
-
-Reviewed-by: Tony Hutter <***@llnl.gov>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #682
-(cherry picked from commit 6902e2839f7efe32dab97980aa4b4c151bdb4f5e)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- config/kernel-ctl-table-name.m4 | 18 +
- config/kernel-fallocate.m4 | 68 +++
- config/kernel-group-info.m4 | 21 +
- config/kernel-inode-lock.m4 | 23 +
- config/kernel-kmem-cache.m4 | 72 +++
- config/kernel-kuidgid.m4 | 28 +
- config/kernel-pde-data.m4 | 17 +
- config/kernel-rw.m4 | 57 +++
- config/kernel-rwsem.m4 | 75 +++
- config/kernel-sched.m4 | 56 ++
- config/kernel-set-fs-pwd.m4 | 39 ++
- config/kernel-shrinker.m4 | 125 +++++
- config/kernel-spinlock.m4 | 24 +
- config/kernel-timer.m4 | 32 ++
- config/kernel-trim-unused-symbols.m4 | 19 +
- config/kernel-truncate-range.m4 | 19 +
- config/kernel-urange-sleep.m4 | 21 +
- config/kernel-vfs-fsync.m4 | 17 +
- config/kernel-vfs-getattr.m4 | 62 +++
- config/kernel-wait.m4 | 76 +++
- config/kernel-zlib.m4 | 63 +++
- config/spl-build.m4 | 956 -----------------------------------
- 22 files changed, 932 insertions(+), 956 deletions(-)
- create mode 100644 config/kernel-ctl-table-name.m4
- create mode 100644 config/kernel-fallocate.m4
- create mode 100644 config/kernel-group-info.m4
- create mode 100644 config/kernel-inode-lock.m4
- create mode 100644 config/kernel-kmem-cache.m4
- create mode 100644 config/kernel-kuidgid.m4
- create mode 100644 config/kernel-pde-data.m4
- create mode 100644 config/kernel-rw.m4
- create mode 100644 config/kernel-rwsem.m4
- create mode 100644 config/kernel-sched.m4
- create mode 100644 config/kernel-set-fs-pwd.m4
- create mode 100644 config/kernel-shrinker.m4
- create mode 100644 config/kernel-spinlock.m4
- create mode 100644 config/kernel-timer.m4
- create mode 100644 config/kernel-trim-unused-symbols.m4
- create mode 100644 config/kernel-truncate-range.m4
- create mode 100644 config/kernel-urange-sleep.m4
- create mode 100644 config/kernel-vfs-fsync.m4
- create mode 100644 config/kernel-vfs-getattr.m4
- create mode 100644 config/kernel-wait.m4
- create mode 100644 config/kernel-zlib.m4
-
-diff --git a/config/kernel-ctl-table-name.m4 b/config/kernel-ctl-table-name.m4
-new file mode 100644
-index 0000000..8dd2e77
---- /dev/null
-+++ b/config/kernel-ctl-table-name.m4
-@@ -0,0 +1,18 @@
-+dnl #
-+dnl # 2.6.33 API change,
-+dnl # Removed .ctl_name from struct ctl_table.
-+dnl #
-+AC_DEFUN([SPL_AC_CTL_NAME], [
-+ AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/sysctl.h>
-+ ],[
-+ struct ctl_table ctl __attribute__ ((unused));
-+ ctl.ctl_name = 0;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-fallocate.m4 b/config/kernel-fallocate.m4
-new file mode 100644
-index 0000000..b8c82f4
---- /dev/null
-+++ b/config/kernel-fallocate.m4
-@@ -0,0 +1,68 @@
-+dnl #
-+dnl # Linux 2.6.38 - 3.x API
-+dnl #
-+AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [
-+ AC_MSG_CHECKING([whether fops->fallocate() exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
-+ struct file_operations fops __attribute__ ((unused)) = {
-+ .fallocate = fallocate,
-+ };
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+dnl #
-+dnl # Linux 2.6.x - 2.6.37 API
-+dnl #
-+AC_DEFUN([SPL_AC_KERNEL_INODE_FALLOCATE], [
-+ AC_MSG_CHECKING([whether iops->fallocate() exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
-+ struct inode_operations fops __attribute__ ((unused)) = {
-+ .fallocate = fallocate,
-+ };
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # PaX Linux 2.6.38 - 3.x API
-+dnl #
-+AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
-+ AC_MSG_CHECKING([whether fops->fallocate() exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
-+ struct file_operations_no_const fops __attribute__ ((unused)) = {
-+ .fallocate = fallocate,
-+ };
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # The fallocate callback was moved from the inode_operations
-+dnl # structure to the file_operations structure.
-+dnl #
-+AC_DEFUN([SPL_AC_KERNEL_FALLOCATE], [
-+ SPL_AC_KERNEL_FILE_FALLOCATE
-+ SPL_AC_KERNEL_INODE_FALLOCATE
-+ SPL_AC_PAX_KERNEL_FILE_FALLOCATE
-+])
-diff --git a/config/kernel-group-info.m4 b/config/kernel-group-info.m4
-new file mode 100644
-index 0000000..4db2bba
---- /dev/null
-+++ b/config/kernel-group-info.m4
-@@ -0,0 +1,21 @@
-+dnl #
-+dnl # 4.9 API change
-+dnl # group_info changed from 2d array via >blocks to 1d array via ->gid
-+dnl #
-+AC_DEFUN([SPL_AC_GROUP_INFO_GID], [
-+ AC_MSG_CHECKING([whether group_info->gid exists])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/cred.h>
-+ ],[
-+ struct group_info *gi = groups_alloc(1);
-+ gi->gid[0] = KGIDT_INIT(0);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_GROUP_INFO_GID, 1, [group_info->gid exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-diff --git a/config/kernel-inode-lock.m4 b/config/kernel-inode-lock.m4
-new file mode 100644
-index 0000000..2cc06a5
---- /dev/null
-+++ b/config/kernel-inode-lock.m4
-@@ -0,0 +1,23 @@
-+dnl #
-+dnl # 4.7 API change
-+dnl # i_mutex is changed to i_rwsem. Instead of directly using
-+dnl # i_mutex/i_rwsem, we should use inode_lock() and inode_lock_shared()
-+dnl # We test inode_lock_shared because inode_lock is introduced earlier.
-+dnl #
-+AC_DEFUN([SPL_AC_INODE_LOCK], [
-+ AC_MSG_CHECKING([whether inode_lock_shared() exists])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ struct inode *inode = NULL;
-+ inode_lock_shared(inode);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_INODE_LOCK_SHARED, 1, [yes])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-diff --git a/config/kernel-kmem-cache.m4 b/config/kernel-kmem-cache.m4
-new file mode 100644
-index 0000000..50a7fdb
---- /dev/null
-+++ b/config/kernel-kmem-cache.m4
-@@ -0,0 +1,72 @@
-+dnl #
-+dnl # 2.6.35 API change,
-+dnl # The cachep->gfpflags member was renamed cachep->allocflags. These are
-+dnl # private allocation flags which are applied when allocating a new slab
-+dnl # in kmem_getpages(). Unfortunately there is no public API for setting
-+dnl # non-default flags.
-+dnl #
-+AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
-+ AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/slab.h>
-+ ],[
-+ struct kmem_cache cachep __attribute__ ((unused));
-+ cachep.allocflags = GFP_KERNEL;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
-+ [struct kmem_cache has allocflags])
-+ ],[
-+ AC_MSG_RESULT(no)
-+
-+ AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/slab.h>
-+ ],[
-+ struct kmem_cache cachep __attribute__ ((unused));
-+ cachep.gfpflags = GFP_KERNEL;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
-+ [struct kmem_cache has gfpflags])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ ])
-+])
-+
-+dnl #
-+dnl # grsecurity API change,
-+dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by
-+dnl # kmem_cache_create_usercopy().
-+dnl #
-+AC_DEFUN([SPL_AC_KMEM_CACHE_CREATE_USERCOPY], [
-+ AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/slab.h>
-+ static void ctor(void *foo)
-+ {
-+ // fake ctor
-+ }
-+ ],[
-+ struct kmem_cache *skc_linux_cache;
-+ const char *name = "test";
-+ size_t size = 4096;
-+ size_t align = 8;
-+ unsigned long flags = 0;
-+ size_t useroffset = 0;
-+ size_t usersize = size - useroffset;
-+
-+ skc_linux_cache = kmem_cache_create_usercopy(
-+ name, size, align, flags, useroffset, usersize, ctor);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_KMEM_CACHE_CREATE_USERCOPY, 1,
-+ [kmem_cache_create_usercopy() exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-diff --git a/config/kernel-kuidgid.m4 b/config/kernel-kuidgid.m4
-new file mode 100644
-index 0000000..47d1937
---- /dev/null
-+++ b/config/kernel-kuidgid.m4
-@@ -0,0 +1,28 @@
-+dnl #
-+dnl # User namespaces, use kuid_t in place of uid_t
-+dnl # where available. Not strictly a user namespaces thing
-+dnl # but it should prevent surprises
-+dnl #
-+AC_DEFUN([SPL_AC_KUIDGID_T], [
-+ AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/uidgid.h>
-+ ], [
-+ kuid_t userid = KUIDT_INIT(0);
-+ kgid_t groupid = KGIDT_INIT(0);
-+ ],[
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/uidgid.h>
-+ ], [
-+ kuid_t userid = 0;
-+ kgid_t groupid = 0;
-+ ],[
-+ AC_MSG_RESULT(yes; optional)
-+ ],[
-+ AC_MSG_RESULT(yes; mandatory)
-+ AC_DEFINE(HAVE_KUIDGID_T, 1, [kuid_t/kgid_t in use])
-+ ])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-pde-data.m4 b/config/kernel-pde-data.m4
-new file mode 100644
-index 0000000..6aa5765
---- /dev/null
-+++ b/config/kernel-pde-data.m4
-@@ -0,0 +1,17 @@
-+dnl #
-+dnl # 3.10 API change,
-+dnl # PDE is replaced by PDE_DATA
-+dnl #
-+AC_DEFUN([SPL_AC_PDE_DATA], [
-+ AC_MSG_CHECKING([whether PDE_DATA() is available])
-+ SPL_LINUX_TRY_COMPILE_SYMBOL([
-+ #include <linux/proc_fs.h>
-+ ], [
-+ PDE_DATA(NULL);
-+ ], [PDE_DATA], [], [
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-rw.m4 b/config/kernel-rw.m4
-new file mode 100644
-index 0000000..23c14b7
---- /dev/null
-+++ b/config/kernel-rw.m4
-@@ -0,0 +1,57 @@
-+dnl #
-+dnl # 4.14 API change
-+dnl # kernel_write() which was introduced in 3.9 was updated to take
-+dnl # the offset as a pointer which is needed by vn_rdwr().
-+dnl #
-+AC_DEFUN([SPL_AC_KERNEL_WRITE], [
-+ AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ struct file *file = NULL;
-+ const void *buf = NULL;
-+ size_t count = 0;
-+ loff_t *pos = NULL;
-+ ssize_t ret;
-+
-+ ret = kernel_write(file, buf, count, pos);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_KERNEL_WRITE_PPOS, 1,
-+ [kernel_write() take loff_t pointer])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-+
-+dnl #
-+dnl # 4.14 API change
-+dnl # kernel_read() which has existed for forever was updated to take
-+dnl # the offset as a pointer which is needed by vn_rdwr().
-+dnl #
-+AC_DEFUN([SPL_AC_KERNEL_READ], [
-+ AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ struct file *file = NULL;
-+ void *buf = NULL;
-+ size_t count = 0;
-+ loff_t *pos = NULL;
-+ ssize_t ret;
-+
-+ ret = kernel_read(file, buf, count, pos);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_KERNEL_READ_PPOS, 1,
-+ [kernel_read() take loff_t pointer])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-diff --git a/config/kernel-rwsem.m4 b/config/kernel-rwsem.m4
-new file mode 100644
-index 0000000..aee20ae
---- /dev/null
-+++ b/config/kernel-rwsem.m4
-@@ -0,0 +1,75 @@
-+dnl #
-+dnl # 3.1 API Change
-+dnl #
-+dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
-+dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
-+dnl #
-+AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
-+ AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/rwsem.h>
-+ ],[
-+ struct rw_semaphore dummy_semaphore __attribute__ ((unused));
-+ raw_spinlock_t dummy_lock __attribute__ ((unused)) =
-+ __RAW_SPIN_LOCK_INITIALIZER(dummy_lock);
-+ dummy_semaphore.wait_lock = dummy_lock;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1,
-+ [struct rw_semaphore member wait_lock is raw_spinlock_t])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-+
-+dnl #
-+dnl # 3.16 API Change
-+dnl #
-+dnl # rwsem-spinlock "->activity" changed to "->count"
-+dnl #
-+AC_DEFUN([SPL_AC_RWSEM_ACTIVITY], [
-+ AC_MSG_CHECKING([whether struct rw_semaphore has member activity])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/rwsem.h>
-+ ],[
-+ struct rw_semaphore dummy_semaphore __attribute__ ((unused));
-+ dummy_semaphore.activity = 0;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_RWSEM_ACTIVITY, 1,
-+ [struct rw_semaphore has member activity])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-+
-+dnl #
-+dnl # 4.8 API Change
-+dnl #
-+dnl # rwsem "->count" changed to atomic_long_t type
-+dnl #
-+AC_DEFUN([SPL_AC_RWSEM_ATOMIC_LONG_COUNT], [
-+ AC_MSG_CHECKING(
-+ [whether struct rw_semaphore has atomic_long_t member count])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/rwsem.h>
-+ ],[
-+ DECLARE_RWSEM(dummy_semaphore);
-+ (void) atomic_long_read(&dummy_semaphore.count);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_RWSEM_ATOMIC_LONG_COUNT, 1,
-+ [struct rw_semaphore has atomic_long_t member count])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-diff --git a/config/kernel-sched.m4 b/config/kernel-sched.m4
-new file mode 100644
-index 0000000..5ae2167
---- /dev/null
-+++ b/config/kernel-sched.m4
-@@ -0,0 +1,56 @@
-+dnl #
-+dnl # 3.9 API change,
-+dnl # Moved things from linux/sched.h to linux/sched/rt.h
-+dnl #
-+AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
-+ [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/sched.h>
-+ #include <linux/sched/rt.h>
-+ ],[
-+ return 0;
-+ ],[
-+ AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
-+ AC_MSG_RESULT(yes)
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # 4.11 API change,
-+dnl # Moved things from linux/sched.h to linux/sched/signal.h
-+dnl #
-+AC_DEFUN([SPL_AC_SCHED_SIGNAL_HEADER],
-+ [AC_MSG_CHECKING([whether header linux/sched/signal.h exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/sched.h>
-+ #include <linux/sched/signal.h>
-+ ],[
-+ return 0;
-+ ],[
-+ AC_DEFINE(HAVE_SCHED_SIGNAL_HEADER, 1, [linux/sched/signal.h exists])
-+ AC_MSG_RESULT(yes)
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+dnl #
-+dnl # 3.19 API change
-+dnl # The io_schedule_timeout() function is present in all 2.6.32 kernels
-+dnl # but it was not exported until Linux 3.19. The RHEL 7.x kernels which
-+dnl # are based on a 3.10 kernel do export this symbol.
-+dnl #
-+AC_DEFUN([SPL_AC_IO_SCHEDULE_TIMEOUT], [
-+ AC_MSG_CHECKING([whether io_schedule_timeout() is available])
-+ SPL_LINUX_TRY_COMPILE_SYMBOL([
-+ #include <linux/sched.h>
-+ ], [
-+ (void) io_schedule_timeout(1);
-+ ], [io_schedule_timeout], [], [
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_IO_SCHEDULE_TIMEOUT, 1, [yes])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-set-fs-pwd.m4 b/config/kernel-set-fs-pwd.m4
-new file mode 100644
-index 0000000..849e7e6
---- /dev/null
-+++ b/config/kernel-set-fs-pwd.m4
-@@ -0,0 +1,39 @@
-+dnl #
-+dnl # 3.9 API change
-+dnl # set_fs_pwd takes const struct path *
-+dnl #
-+AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/spinlock.h>
-+ #include <linux/fs_struct.h>
-+ #include <linux/path.h>
-+ void (*const set_fs_pwd_func)
-+ (struct fs_struct *, const struct path *)
-+ = set_fs_pwd;
-+ ],[
-+ return 0;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
-+ [set_fs_pwd() needs const path *])
-+ ],[
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/spinlock.h>
-+ #include <linux/fs_struct.h>
-+ #include <linux/path.h>
-+ void (*const set_fs_pwd_func)
-+ (struct fs_struct *, struct path *)
-+ = set_fs_pwd;
-+ ],[
-+ return 0;
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ],[
-+ AC_MSG_ERROR(unknown)
-+ ])
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-diff --git a/config/kernel-shrinker.m4 b/config/kernel-shrinker.m4
-new file mode 100644
-index 0000000..6fc9b54
---- /dev/null
-+++ b/config/kernel-shrinker.m4
-@@ -0,0 +1,125 @@
-+AC_DEFUN([SPL_AC_SHRINKER_CALLBACK],[
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ dnl #
-+ dnl # 2.6.23 to 2.6.34 API change
-+ dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
-+ dnl #
-+ AC_MSG_CHECKING([whether old 2-argument shrinker exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/mm.h>
-+
-+ int shrinker_cb(int nr_to_scan, gfp_t gfp_mask);
-+ ],[
-+ struct shrinker cache_shrinker = {
-+ .shrink = shrinker_cb,
-+ .seeks = DEFAULT_SEEKS,
-+ };
-+ register_shrinker(&cache_shrinker);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1,
-+ [old shrinker callback wants 2 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ dnl #
-+ dnl # 2.6.35 - 2.6.39 API change
-+ dnl # ->shrink(struct shrinker *,
-+ dnl # int nr_to_scan, gfp_t gfp_mask)
-+ dnl #
-+ AC_MSG_CHECKING([whether old 3-argument shrinker exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/mm.h>
-+
-+ int shrinker_cb(struct shrinker *, int nr_to_scan,
-+ gfp_t gfp_mask);
-+ ],[
-+ struct shrinker cache_shrinker = {
-+ .shrink = shrinker_cb,
-+ .seeks = DEFAULT_SEEKS,
-+ };
-+ register_shrinker(&cache_shrinker);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
-+ [old shrinker callback wants 3 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ dnl #
-+ dnl # 3.0 - 3.11 API change
-+ dnl # ->shrink(struct shrinker *,
-+ dnl # struct shrink_control *sc)
-+ dnl #
-+ AC_MSG_CHECKING(
-+ [whether new 2-argument shrinker exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/mm.h>
-+
-+ int shrinker_cb(struct shrinker *,
-+ struct shrink_control *sc);
-+ ],[
-+ struct shrinker cache_shrinker = {
-+ .shrink = shrinker_cb,
-+ .seeks = DEFAULT_SEEKS,
-+ };
-+ register_shrinker(&cache_shrinker);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
-+ [new shrinker callback wants 2 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ dnl #
-+ dnl # 3.12 API change,
-+ dnl # ->shrink() is logically split in to
-+ dnl # ->count_objects() and ->scan_objects()
-+ dnl #
-+ AC_MSG_CHECKING(
-+ [whether ->count_objects callback exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/mm.h>
-+
-+ unsigned long shrinker_cb(
-+ struct shrinker *,
-+ struct shrink_control *sc);
-+ ],[
-+ struct shrinker cache_shrinker = {
-+ .count_objects = shrinker_cb,
-+ .scan_objects = shrinker_cb,
-+ .seeks = DEFAULT_SEEKS,
-+ };
-+ register_shrinker(&cache_shrinker);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
-+ 1, [->count_objects exists])
-+ ],[
-+ AC_MSG_ERROR(error)
-+ ])
-+ ])
-+ ])
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-+
-+dnl #
-+dnl # 2.6.39 API change,
-+dnl # Shrinker adjust to use common shrink_control structure.
-+dnl #
-+AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [
-+ AC_MSG_CHECKING([whether struct shrink_control exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/mm.h>
-+ ],[
-+ struct shrink_control sc __attribute__ ((unused));
-+
-+ sc.nr_to_scan = 0;
-+ sc.gfp_mask = GFP_KERNEL;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
-+ [struct shrink_control exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-spinlock.m4 b/config/kernel-spinlock.m4
-new file mode 100644
-index 0000000..136262d
---- /dev/null
-+++ b/config/kernel-spinlock.m4
-@@ -0,0 +1,24 @@
-+dnl #
-+dnl # 2.6.36 API change,
-+dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
-+dnl # a spinlock_t to improve the fastpath performance.
-+dnl #
-+AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
-+ AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/sched.h>
-+ #include <linux/fs_struct.h>
-+ ],[
-+ static struct fs_struct fs;
-+ spin_lock_init(&fs.lock);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
-+ [struct fs_struct uses spinlock_t])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-diff --git a/config/kernel-timer.m4 b/config/kernel-timer.m4
-new file mode 100644
-index 0000000..93b5158
---- /dev/null
-+++ b/config/kernel-timer.m4
-@@ -0,0 +1,32 @@
-+dnl #
-+dnl # 4.15 API change
-+dnl # https://lkml.org/lkml/2017/11/25/90
-+dnl # Check if timer_list.func get passed a timer_list or an unsigned long
-+dnl # (older kernels). Also sanity check the from_timer() and timer_setup()
-+dnl # macros are available as well, since they will be used in the same newer
-+dnl # kernels that support the new timer_list.func signature.
-+dnl #
-+AC_DEFUN([SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST], [
-+ AC_MSG_CHECKING([whether timer_list.function gets a timer_list])
-+ tmp_flags="$EXTRA_KCFLAGS"
-+ EXTRA_KCFLAGS="-Werror"
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/timer.h>
-+ void task_expire(struct timer_list *tl) {}
-+ ],[
-+ #ifndef from_timer
-+ #error "No from_timer() macro"
-+ #endif
-+
-+ struct timer_list timer;
-+ timer.function = task_expire;
-+ timer_setup(&timer, NULL, 0);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST, 1,
-+ [timer_list.function gets a timer_list])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+ EXTRA_KCFLAGS="$tmp_flags"
-+])
-diff --git a/config/kernel-trim-unused-symbols.m4 b/config/kernel-trim-unused-symbols.m4
-new file mode 100644
-index 0000000..d1ac2f3
---- /dev/null
-+++ b/config/kernel-trim-unused-symbols.m4
-@@ -0,0 +1,19 @@
-+dnl #
-+dnl # config trim unused symbols,
-+dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS DISABLED.
-+dnl #
-+AC_DEFUN([SPL_AC_CONFIG_TRIM_UNUSED_KSYMS], [
-+ AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
-+ SPL_LINUX_TRY_COMPILE([
-+ #if defined(CONFIG_TRIM_UNUSED_KSYMS)
-+ #error CONFIG_TRIM_UNUSED_KSYMS not defined
-+ #endif
-+ ],[ ],[
-+ AC_MSG_RESULT([yes])
-+ ],[
-+ AC_MSG_RESULT([no])
-+ AC_MSG_ERROR([
-+ *** This kernel has unused symbols trimming enabled, please disable.
-+ *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
-+ ])
-+])
-diff --git a/config/kernel-truncate-range.m4 b/config/kernel-truncate-range.m4
-new file mode 100644
-index 0000000..4b1600b
---- /dev/null
-+++ b/config/kernel-truncate-range.m4
-@@ -0,0 +1,19 @@
-+dnl #
-+dnl # 3.5 API change,
-+dnl # inode_operations.truncate_range removed
-+dnl #
-+AC_DEFUN([SPL_AC_INODE_TRUNCATE_RANGE], [
-+ AC_MSG_CHECKING([whether truncate_range() inode operation is available])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ struct inode_operations ops;
-+ ops.truncate_range = NULL;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
-+ [truncate_range() inode operation is available])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-urange-sleep.m4 b/config/kernel-urange-sleep.m4
-new file mode 100644
-index 0000000..85beca6
---- /dev/null
-+++ b/config/kernel-urange-sleep.m4
-@@ -0,0 +1,21 @@
-+dnl #
-+dnl # 2.6.36 API compatibility.
-+dnl # Added usleep_range timer.
-+dnl # usleep_range is a finer precision implementation of msleep
-+dnl # designed to be a drop-in replacement for udelay where a precise
-+dnl # sleep / busy-wait is unnecessary.
-+dnl #
-+AC_DEFUN([SPL_AC_USLEEP_RANGE], [
-+ AC_MSG_CHECKING([whether usleep_range() is available])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/delay.h>
-+ ],[
-+ usleep_range(0, 0);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_USLEEP_RANGE, 1,
-+ [usleep_range is available])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-vfs-fsync.m4 b/config/kernel-vfs-fsync.m4
-new file mode 100644
-index 0000000..3c42bf1
---- /dev/null
-+++ b/config/kernel-vfs-fsync.m4
-@@ -0,0 +1,17 @@
-+dnl #
-+dnl # 2.6.35 API change,
-+dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
-+dnl #
-+AC_DEFUN([SPL_AC_2ARGS_VFS_FSYNC], [
-+ AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ vfs_fsync(NULL, 0);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-vfs-getattr.m4 b/config/kernel-vfs-getattr.m4
-new file mode 100644
-index 0000000..7772cb5
---- /dev/null
-+++ b/config/kernel-vfs-getattr.m4
-@@ -0,0 +1,62 @@
-+dnl #
-+dnl # 4.11 API, ***@torvalds/linux
-+dnl # vfs_getattr(const struct path *p, struct kstat *s, u32 m, unsigned int f)
-+dnl #
-+AC_DEFUN([SPL_AC_4ARGS_VFS_GETATTR], [
-+ AC_MSG_CHECKING([whether vfs_getattr() wants 4 args])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ vfs_getattr((const struct path *)NULL,
-+ (struct kstat *)NULL,
-+ (u32)0,
-+ (unsigned int)0);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_4ARGS_VFS_GETATTR, 1,
-+ [vfs_getattr wants 4 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # 3.9 API
-+dnl # vfs_getattr(struct path *p, struct kstat *s)
-+dnl #
-+AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
-+ AC_MSG_CHECKING([whether vfs_getattr() wants 2 args])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ vfs_getattr((struct path *) NULL,
-+ (struct kstat *)NULL);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
-+ [vfs_getattr wants 2 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # <3.9 API
-+dnl # vfs_getattr(struct vfsmount *v, struct dentry *d, struct kstat *k)
-+dnl #
-+AC_DEFUN([SPL_AC_3ARGS_VFS_GETATTR], [
-+ AC_MSG_CHECKING([whether vfs_getattr() wants 3 args])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/fs.h>
-+ ],[
-+ vfs_getattr((struct vfsmount *)NULL,
-+ (struct dentry *)NULL,
-+ (struct kstat *)NULL);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_3ARGS_VFS_GETATTR, 1,
-+ [vfs_getattr wants 3 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-wait.m4 b/config/kernel-wait.m4
-new file mode 100644
-index 0000000..5f718a1
---- /dev/null
-+++ b/config/kernel-wait.m4
-@@ -0,0 +1,76 @@
-+dnl #
-+dnl # 3.17 API change,
-+dnl # wait_on_bit() no longer requires an action argument. The former
-+dnl # "wait_on_bit" interface required an 'action' function to be provided
-+dnl # which does the actual waiting. There were over 20 such functions in the
-+dnl # kernel, many of them identical, though most cases can be satisfied by one
-+dnl # of just two functions: one which uses io_schedule() and one which just
-+dnl # uses schedule(). This API change was made to consolidate all of those
-+dnl # redundant wait functions.
-+dnl #
-+AC_DEFUN([SPL_AC_WAIT_ON_BIT], [
-+ AC_MSG_CHECKING([whether wait_on_bit() takes an action])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/wait.h>
-+ ],[
-+ int (*action)(void *) = NULL;
-+ wait_on_bit(NULL, 0, action, 0);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_WAIT_ON_BIT_ACTION, 1, [yes])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+dnl #
-+dnl # 4.13 API change
-+dnl # Renamed struct wait_queue -> struct wait_queue_entry.
-+dnl #
-+AC_DEFUN([SPL_AC_WAIT_QUEUE_ENTRY_T], [
-+ AC_MSG_CHECKING([whether wait_queue_entry_t exists])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/wait.h>
-+ ],[
-+ wait_queue_entry_t *entry __attribute__ ((unused));
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_T, 1,
-+ [wait_queue_entry_t exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # 4.13 API change
-+dnl # Renamed wait_queue_head::task_list -> wait_queue_head::head
-+dnl # Renamed wait_queue_entry::task_list -> wait_queue_entry::entry
-+dnl #
-+AC_DEFUN([SPL_AC_WAIT_QUEUE_HEAD_ENTRY], [
-+ AC_MSG_CHECKING([whether wq_head->head and wq_entry->entry exist])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/wait.h>
-+
-+ #ifdef HAVE_WAIT_QUEUE_ENTRY_T
-+ typedef wait_queue_head_t spl_wait_queue_head_t;
-+ typedef wait_queue_entry_t spl_wait_queue_entry_t;
-+ #else
-+ typedef wait_queue_head_t spl_wait_queue_head_t;
-+ typedef wait_queue_t spl_wait_queue_entry_t;
-+ #endif
-+ ],[
-+ spl_wait_queue_head_t wq_head;
-+ spl_wait_queue_entry_t wq_entry;
-+ struct list_head *head __attribute__ ((unused));
-+ struct list_head *entry __attribute__ ((unused));
-+
-+ head = &wq_head.head;
-+ entry = &wq_entry.entry;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_WAIT_QUEUE_HEAD_ENTRY, 1,
-+ [wq_head->head and wq_entry->entry exist])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel-zlib.m4 b/config/kernel-zlib.m4
-new file mode 100644
-index 0000000..bb23646
---- /dev/null
-+++ b/config/kernel-zlib.m4
-@@ -0,0 +1,63 @@
-+dnl #
-+dnl # zlib inflate compat,
-+dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
-+dnl #
-+AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [
-+ AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
-+ SPL_LINUX_TRY_COMPILE([
-+ #if !defined(CONFIG_ZLIB_INFLATE) && \
-+ !defined(CONFIG_ZLIB_INFLATE_MODULE)
-+ #error CONFIG_ZLIB_INFLATE not defined
-+ #endif
-+ ],[ ],[
-+ AC_MSG_RESULT([yes])
-+ ],[
-+ AC_MSG_RESULT([no])
-+ AC_MSG_ERROR([
-+ *** This kernel does not include the required zlib inflate support.
-+ *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
-+ ])
-+])
-+
-+dnl #
-+dnl # zlib deflate compat,
-+dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
-+dnl #
-+AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
-+ AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
-+ SPL_LINUX_TRY_COMPILE([
-+ #if !defined(CONFIG_ZLIB_DEFLATE) && \
-+ !defined(CONFIG_ZLIB_DEFLATE_MODULE)
-+ #error CONFIG_ZLIB_DEFLATE not defined
-+ #endif
-+ ],[ ],[
-+ AC_MSG_RESULT([yes])
-+ ],[
-+ AC_MSG_RESULT([no])
-+ AC_MSG_ERROR([
-+ *** This kernel does not include the required zlib deflate support.
-+ *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
-+ ])
-+])
-+
-+dnl #
-+dnl # 2.6.39 API compat,
-+dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
-+dnl # This was done to avoid always having to allocate the maximum size
-+dnl # workspace (268K). The caller can now specific the windowBits and
-+dnl # memLevel compression parameters to get a smaller workspace.
-+dnl #
-+AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
-+ [AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
-+ SPL_LINUX_TRY_COMPILE([
-+ #include <linux/zlib.h>
-+ ],[
-+ return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
-+ [zlib_deflate_workspacesize() wants 2 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/spl-build.m4 b/config/spl-build.m4
-index afc8de6..553b5d5 100644
---- a/config/spl-build.m4
-+++ b/config/spl-build.m4
-@@ -753,959 +753,3 @@ AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
- AC_MSG_CHECKING([whether kernel defines atomic64_t])
- AC_MSG_RESULT([$have_atomic64_t])
- ])
--
--AC_DEFUN([SPL_AC_SHRINKER_CALLBACK],[
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- dnl #
-- dnl # 2.6.23 to 2.6.34 API change
-- dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
-- dnl #
-- AC_MSG_CHECKING([whether old 2-argument shrinker exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/mm.h>
--
-- int shrinker_cb(int nr_to_scan, gfp_t gfp_mask);
-- ],[
-- struct shrinker cache_shrinker = {
-- .shrink = shrinker_cb,
-- .seeks = DEFAULT_SEEKS,
-- };
-- register_shrinker(&cache_shrinker);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1,
-- [old shrinker callback wants 2 args])
-- ],[
-- AC_MSG_RESULT(no)
-- dnl #
-- dnl # 2.6.35 - 2.6.39 API change
-- dnl # ->shrink(struct shrinker *,
-- dnl # int nr_to_scan, gfp_t gfp_mask)
-- dnl #
-- AC_MSG_CHECKING([whether old 3-argument shrinker exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/mm.h>
--
-- int shrinker_cb(struct shrinker *, int nr_to_scan,
-- gfp_t gfp_mask);
-- ],[
-- struct shrinker cache_shrinker = {
-- .shrink = shrinker_cb,
-- .seeks = DEFAULT_SEEKS,
-- };
-- register_shrinker(&cache_shrinker);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
-- [old shrinker callback wants 3 args])
-- ],[
-- AC_MSG_RESULT(no)
-- dnl #
-- dnl # 3.0 - 3.11 API change
-- dnl # ->shrink(struct shrinker *,
-- dnl # struct shrink_control *sc)
-- dnl #
-- AC_MSG_CHECKING(
-- [whether new 2-argument shrinker exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/mm.h>
--
-- int shrinker_cb(struct shrinker *,
-- struct shrink_control *sc);
-- ],[
-- struct shrinker cache_shrinker = {
-- .shrink = shrinker_cb,
-- .seeks = DEFAULT_SEEKS,
-- };
-- register_shrinker(&cache_shrinker);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
-- [new shrinker callback wants 2 args])
-- ],[
-- AC_MSG_RESULT(no)
-- dnl #
-- dnl # 3.12 API change,
-- dnl # ->shrink() is logically split in to
-- dnl # ->count_objects() and ->scan_objects()
-- dnl #
-- AC_MSG_CHECKING(
-- [whether ->count_objects callback exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/mm.h>
--
-- unsigned long shrinker_cb(
-- struct shrinker *,
-- struct shrink_control *sc);
-- ],[
-- struct shrinker cache_shrinker = {
-- .count_objects = shrinker_cb,
-- .scan_objects = shrinker_cb,
-- .seeks = DEFAULT_SEEKS,
-- };
-- register_shrinker(&cache_shrinker);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
-- 1, [->count_objects exists])
-- ],[
-- AC_MSG_ERROR(error)
-- ])
-- ])
-- ])
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 2.6.33 API change,
--dnl # Removed .ctl_name from struct ctl_table.
--dnl #
--AC_DEFUN([SPL_AC_CTL_NAME], [
-- AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/sysctl.h>
-- ],[
-- struct ctl_table ctl __attribute__ ((unused));
-- ctl.ctl_name = 0;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 3.10 API change,
--dnl # PDE is replaced by PDE_DATA
--dnl #
--AC_DEFUN([SPL_AC_PDE_DATA], [
-- AC_MSG_CHECKING([whether PDE_DATA() is available])
-- SPL_LINUX_TRY_COMPILE_SYMBOL([
-- #include <linux/proc_fs.h>
-- ], [
-- PDE_DATA(NULL);
-- ], [PDE_DATA], [], [
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 3.9 API change
--dnl # set_fs_pwd takes const struct path *
--dnl #
--AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/spinlock.h>
-- #include <linux/fs_struct.h>
-- #include <linux/path.h>
-- void (*const set_fs_pwd_func)
-- (struct fs_struct *, const struct path *)
-- = set_fs_pwd;
-- ],[
-- return 0;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
-- [set_fs_pwd() needs const path *])
-- ],[
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/spinlock.h>
-- #include <linux/fs_struct.h>
-- #include <linux/path.h>
-- void (*const set_fs_pwd_func)
-- (struct fs_struct *, struct path *)
-- = set_fs_pwd;
-- ],[
-- return 0;
-- ],[
-- AC_MSG_RESULT(no)
-- ],[
-- AC_MSG_ERROR(unknown)
-- ])
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 2.6.36 API change,
--dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
--dnl # a spinlock_t to improve the fastpath performance.
--dnl #
--AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
-- AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/sched.h>
-- #include <linux/fs_struct.h>
-- ],[
-- static struct fs_struct fs;
-- spin_lock_init(&fs.lock);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
-- [struct fs_struct uses spinlock_t])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # User namespaces, use kuid_t in place of uid_t
--dnl # where available. Not strictly a user namespaces thing
--dnl # but it should prevent surprises
--dnl #
--AC_DEFUN([SPL_AC_KUIDGID_T], [
-- AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/uidgid.h>
-- ], [
-- kuid_t userid = KUIDT_INIT(0);
-- kgid_t groupid = KGIDT_INIT(0);
-- ],[
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/uidgid.h>
-- ], [
-- kuid_t userid = 0;
-- kgid_t groupid = 0;
-- ],[
-- AC_MSG_RESULT(yes; optional)
-- ],[
-- AC_MSG_RESULT(yes; mandatory)
-- AC_DEFINE(HAVE_KUIDGID_T, 1, [kuid_t/kgid_t in use])
-- ])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 2.6.35 API change,
--dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
--dnl #
--AC_DEFUN([SPL_AC_2ARGS_VFS_FSYNC], [
-- AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_fsync(NULL, 0);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 3.5 API change,
--dnl # inode_operations.truncate_range removed
--dnl #
--AC_DEFUN([SPL_AC_INODE_TRUNCATE_RANGE], [
-- AC_MSG_CHECKING([whether truncate_range() inode operation is available])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- struct inode_operations ops;
-- ops.truncate_range = NULL;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
-- [truncate_range() inode operation is available])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # Linux 2.6.38 - 3.x API
--dnl #
--AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [
-- AC_MSG_CHECKING([whether fops->fallocate() exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
-- struct file_operations fops __attribute__ ((unused)) = {
-- .fallocate = fallocate,
-- };
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # Linux 2.6.x - 2.6.37 API
--dnl #
--AC_DEFUN([SPL_AC_KERNEL_INODE_FALLOCATE], [
-- AC_MSG_CHECKING([whether iops->fallocate() exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
-- struct inode_operations fops __attribute__ ((unused)) = {
-- .fallocate = fallocate,
-- };
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # PaX Linux 2.6.38 - 3.x API
--dnl #
--AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
-- AC_MSG_CHECKING([whether fops->fallocate() exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
-- struct file_operations_no_const fops __attribute__ ((unused)) = {
-- .fallocate = fallocate,
-- };
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # The fallocate callback was moved from the inode_operations
--dnl # structure to the file_operations structure.
--dnl #
--AC_DEFUN([SPL_AC_KERNEL_FALLOCATE], [
-- SPL_AC_KERNEL_FILE_FALLOCATE
-- SPL_AC_KERNEL_INODE_FALLOCATE
-- SPL_AC_PAX_KERNEL_FILE_FALLOCATE
--])
--
--dnl #
--dnl # zlib inflate compat,
--dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
--dnl #
--AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [
-- AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
-- SPL_LINUX_TRY_COMPILE([
-- #if !defined(CONFIG_ZLIB_INFLATE) && \
-- !defined(CONFIG_ZLIB_INFLATE_MODULE)
-- #error CONFIG_ZLIB_INFLATE not defined
-- #endif
-- ],[ ],[
-- AC_MSG_RESULT([yes])
-- ],[
-- AC_MSG_RESULT([no])
-- AC_MSG_ERROR([
-- *** This kernel does not include the required zlib inflate support.
-- *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
-- ])
--])
--
--dnl #
--dnl # zlib deflate compat,
--dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
--dnl #
--AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
-- AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
-- SPL_LINUX_TRY_COMPILE([
-- #if !defined(CONFIG_ZLIB_DEFLATE) && \
-- !defined(CONFIG_ZLIB_DEFLATE_MODULE)
-- #error CONFIG_ZLIB_DEFLATE not defined
-- #endif
-- ],[ ],[
-- AC_MSG_RESULT([yes])
-- ],[
-- AC_MSG_RESULT([no])
-- AC_MSG_ERROR([
-- *** This kernel does not include the required zlib deflate support.
-- *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
-- ])
--])
--
--dnl #
--dnl # config trim unused symbols,
--dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS DISABLED.
--dnl #
--AC_DEFUN([SPL_AC_CONFIG_TRIM_UNUSED_KSYMS], [
-- AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
-- SPL_LINUX_TRY_COMPILE([
-- #if defined(CONFIG_TRIM_UNUSED_KSYMS)
-- #error CONFIG_TRIM_UNUSED_KSYMS not defined
-- #endif
-- ],[ ],[
-- AC_MSG_RESULT([yes])
-- ],[
-- AC_MSG_RESULT([no])
-- AC_MSG_ERROR([
-- *** This kernel has unused symbols trimming enabled, please disable.
-- *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
-- ])
--])
--
--dnl #
--dnl # 2.6.39 API compat,
--dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
--dnl # This was done to avoid always having to allocate the maximum size
--dnl # workspace (268K). The caller can now specific the windowBits and
--dnl # memLevel compression parameters to get a smaller workspace.
--dnl #
--AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
-- [AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/zlib.h>
-- ],[
-- return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
-- [zlib_deflate_workspacesize() wants 2 args])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 2.6.39 API change,
--dnl # Shrinker adjust to use common shrink_control structure.
--dnl #
--AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [
-- AC_MSG_CHECKING([whether struct shrink_control exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/mm.h>
-- ],[
-- struct shrink_control sc __attribute__ ((unused));
--
-- sc.nr_to_scan = 0;
-- sc.gfp_mask = GFP_KERNEL;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
-- [struct shrink_control exists])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 3.1 API Change
--dnl #
--dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
--dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
--dnl #
--AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
-- AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/rwsem.h>
-- ],[
-- struct rw_semaphore dummy_semaphore __attribute__ ((unused));
-- raw_spinlock_t dummy_lock __attribute__ ((unused)) =
-- __RAW_SPIN_LOCK_INITIALIZER(dummy_lock);
-- dummy_semaphore.wait_lock = dummy_lock;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1,
-- [struct rw_semaphore member wait_lock is raw_spinlock_t])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 3.16 API Change
--dnl #
--dnl # rwsem-spinlock "->activity" changed to "->count"
--dnl #
--AC_DEFUN([SPL_AC_RWSEM_ACTIVITY], [
-- AC_MSG_CHECKING([whether struct rw_semaphore has member activity])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/rwsem.h>
-- ],[
-- struct rw_semaphore dummy_semaphore __attribute__ ((unused));
-- dummy_semaphore.activity = 0;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_RWSEM_ACTIVITY, 1,
-- [struct rw_semaphore has member activity])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 4.8 API Change
--dnl #
--dnl # rwsem "->count" changed to atomic_long_t type
--dnl #
--AC_DEFUN([SPL_AC_RWSEM_ATOMIC_LONG_COUNT], [
-- AC_MSG_CHECKING(
-- [whether struct rw_semaphore has atomic_long_t member count])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/rwsem.h>
-- ],[
-- DECLARE_RWSEM(dummy_semaphore);
-- (void) atomic_long_read(&dummy_semaphore.count);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_RWSEM_ATOMIC_LONG_COUNT, 1,
-- [struct rw_semaphore has atomic_long_t member count])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 3.9 API change,
--dnl # Moved things from linux/sched.h to linux/sched/rt.h
--dnl #
--AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
-- [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/sched.h>
-- #include <linux/sched/rt.h>
-- ],[
-- return 0;
-- ],[
-- AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
-- AC_MSG_RESULT(yes)
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 4.11 API change,
--dnl # Moved things from linux/sched.h to linux/sched/signal.h
--dnl #
--AC_DEFUN([SPL_AC_SCHED_SIGNAL_HEADER],
-- [AC_MSG_CHECKING([whether header linux/sched/signal.h exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/sched.h>
-- #include <linux/sched/signal.h>
-- ],[
-- return 0;
-- ],[
-- AC_DEFINE(HAVE_SCHED_SIGNAL_HEADER, 1, [linux/sched/signal.h exists])
-- AC_MSG_RESULT(yes)
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 4.11 API, ***@torvalds/linux
--dnl # vfs_getattr(const struct path *p, struct kstat *s, u32 m, unsigned int f)
--dnl #
--AC_DEFUN([SPL_AC_4ARGS_VFS_GETATTR], [
-- AC_MSG_CHECKING([whether vfs_getattr() wants 4 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_getattr((const struct path *)NULL,
-- (struct kstat *)NULL,
-- (u32)0,
-- (unsigned int)0);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_4ARGS_VFS_GETATTR, 1,
-- [vfs_getattr wants 4 args])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 3.9 API
--dnl # vfs_getattr(struct path *p, struct kstat *s)
--dnl #
--AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
-- AC_MSG_CHECKING([whether vfs_getattr() wants 2 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_getattr((struct path *) NULL,
-- (struct kstat *)NULL);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
-- [vfs_getattr wants 2 args])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # <3.9 API
--dnl # vfs_getattr(struct vfsmount *v, struct dentry *d, struct kstat *k)
--dnl #
--AC_DEFUN([SPL_AC_3ARGS_VFS_GETATTR], [
-- AC_MSG_CHECKING([whether vfs_getattr() wants 3 args])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- vfs_getattr((struct vfsmount *)NULL,
-- (struct dentry *)NULL,
-- (struct kstat *)NULL);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_3ARGS_VFS_GETATTR, 1,
-- [vfs_getattr wants 3 args])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 2.6.36 API compatibility.
--dnl # Added usleep_range timer.
--dnl # usleep_range is a finer precision implementation of msleep
--dnl # designed to be a drop-in replacement for udelay where a precise
--dnl # sleep / busy-wait is unnecessary.
--dnl #
--AC_DEFUN([SPL_AC_USLEEP_RANGE], [
-- AC_MSG_CHECKING([whether usleep_range() is available])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/delay.h>
-- ],[
-- usleep_range(0, 0);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_USLEEP_RANGE, 1,
-- [usleep_range is available])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 2.6.35 API change,
--dnl # The cachep->gfpflags member was renamed cachep->allocflags. These are
--dnl # private allocation flags which are applied when allocating a new slab
--dnl # in kmem_getpages(). Unfortunately there is no public API for setting
--dnl # non-default flags.
--dnl #
--AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
-- AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/slab.h>
-- ],[
-- struct kmem_cache cachep __attribute__ ((unused));
-- cachep.allocflags = GFP_KERNEL;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
-- [struct kmem_cache has allocflags])
-- ],[
-- AC_MSG_RESULT(no)
--
-- AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/slab.h>
-- ],[
-- struct kmem_cache cachep __attribute__ ((unused));
-- cachep.gfpflags = GFP_KERNEL;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
-- [struct kmem_cache has gfpflags])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- ])
--])
--
--dnl #
--dnl # 3.17 API change,
--dnl # wait_on_bit() no longer requires an action argument. The former
--dnl # "wait_on_bit" interface required an 'action' function to be provided
--dnl # which does the actual waiting. There were over 20 such functions in the
--dnl # kernel, many of them identical, though most cases can be satisfied by one
--dnl # of just two functions: one which uses io_schedule() and one which just
--dnl # uses schedule(). This API change was made to consolidate all of those
--dnl # redundant wait functions.
--dnl #
--AC_DEFUN([SPL_AC_WAIT_ON_BIT], [
-- AC_MSG_CHECKING([whether wait_on_bit() takes an action])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/wait.h>
-- ],[
-- int (*action)(void *) = NULL;
-- wait_on_bit(NULL, 0, action, 0);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_WAIT_ON_BIT_ACTION, 1, [yes])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 4.7 API change
--dnl # i_mutex is changed to i_rwsem. Instead of directly using
--dnl # i_mutex/i_rwsem, we should use inode_lock() and inode_lock_shared()
--dnl # We test inode_lock_shared because inode_lock is introduced earlier.
--dnl #
--AC_DEFUN([SPL_AC_INODE_LOCK], [
-- AC_MSG_CHECKING([whether inode_lock_shared() exists])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- struct inode *inode = NULL;
-- inode_lock_shared(inode);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_INODE_LOCK_SHARED, 1, [yes])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 4.9 API change
--dnl # group_info changed from 2d array via >blocks to 1d array via ->gid
--dnl #
--AC_DEFUN([SPL_AC_GROUP_INFO_GID], [
-- AC_MSG_CHECKING([whether group_info->gid exists])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/cred.h>
-- ],[
-- struct group_info *gi = groups_alloc(1);
-- gi->gid[0] = KGIDT_INIT(0);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_GROUP_INFO_GID, 1, [group_info->gid exists])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # grsecurity API change,
--dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by
--dnl # kmem_cache_create_usercopy().
--dnl #
--AC_DEFUN([SPL_AC_KMEM_CACHE_CREATE_USERCOPY], [
-- AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/slab.h>
-- static void ctor(void *foo)
-- {
-- // fake ctor
-- }
-- ],[
-- struct kmem_cache *skc_linux_cache;
-- const char *name = "test";
-- size_t size = 4096;
-- size_t align = 8;
-- unsigned long flags = 0;
-- size_t useroffset = 0;
-- size_t usersize = size - useroffset;
--
-- skc_linux_cache = kmem_cache_create_usercopy(
-- name, size, align, flags, useroffset, usersize, ctor);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_KMEM_CACHE_CREATE_USERCOPY, 1,
-- [kmem_cache_create_usercopy() exists])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 4.13 API change
--dnl # Renamed struct wait_queue -> struct wait_queue_entry.
--dnl #
--AC_DEFUN([SPL_AC_WAIT_QUEUE_ENTRY_T], [
-- AC_MSG_CHECKING([whether wait_queue_entry_t exists])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/wait.h>
-- ],[
-- wait_queue_entry_t *entry __attribute__ ((unused));
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_T, 1,
-- [wait_queue_entry_t exists])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 4.13 API change
--dnl # Renamed wait_queue_head::task_list -> wait_queue_head::head
--dnl # Renamed wait_queue_entry::task_list -> wait_queue_entry::entry
--dnl #
--AC_DEFUN([SPL_AC_WAIT_QUEUE_HEAD_ENTRY], [
-- AC_MSG_CHECKING([whether wq_head->head and wq_entry->entry exist])
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/wait.h>
--
-- #ifdef HAVE_WAIT_QUEUE_ENTRY_T
-- typedef wait_queue_head_t spl_wait_queue_head_t;
-- typedef wait_queue_entry_t spl_wait_queue_entry_t;
-- #else
-- typedef wait_queue_head_t spl_wait_queue_head_t;
-- typedef wait_queue_t spl_wait_queue_entry_t;
-- #endif
-- ],[
-- spl_wait_queue_head_t wq_head;
-- spl_wait_queue_entry_t wq_entry;
-- struct list_head *head __attribute__ ((unused));
-- struct list_head *entry __attribute__ ((unused));
--
-- head = &wq_head.head;
-- entry = &wq_entry.entry;
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_WAIT_QUEUE_HEAD_ENTRY, 1,
-- [wq_head->head and wq_entry->entry exist])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 3.19 API change
--dnl # The io_schedule_timeout() function is present in all 2.6.32 kernels
--dnl # but it was not exported until Linux 3.19. The RHEL 7.x kernels which
--dnl # are based on a 3.10 kernel do export this symbol.
--dnl #
--AC_DEFUN([SPL_AC_IO_SCHEDULE_TIMEOUT], [
-- AC_MSG_CHECKING([whether io_schedule_timeout() is available])
-- SPL_LINUX_TRY_COMPILE_SYMBOL([
-- #include <linux/sched.h>
-- ], [
-- (void) io_schedule_timeout(1);
-- ], [io_schedule_timeout], [], [
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_IO_SCHEDULE_TIMEOUT, 1, [yes])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
--
--dnl #
--dnl # 4.14 API change
--dnl # kernel_write() which was introduced in 3.9 was updated to take
--dnl # the offset as a pointer which is needed by vn_rdwr().
--dnl #
--AC_DEFUN([SPL_AC_KERNEL_WRITE], [
-- AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- struct file *file = NULL;
-- const void *buf = NULL;
-- size_t count = 0;
-- loff_t *pos = NULL;
-- ssize_t ret;
--
-- ret = kernel_write(file, buf, count, pos);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_KERNEL_WRITE_PPOS, 1,
-- [kernel_write() take loff_t pointer])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 4.14 API change
--dnl # kernel_read() which has existed for forever was updated to take
--dnl # the offset as a pointer which is needed by vn_rdwr().
--dnl #
--AC_DEFUN([SPL_AC_KERNEL_READ], [
-- AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/fs.h>
-- ],[
-- struct file *file = NULL;
-- void *buf = NULL;
-- size_t count = 0;
-- loff_t *pos = NULL;
-- ssize_t ret;
--
-- ret = kernel_read(file, buf, count, pos);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_KERNEL_READ_PPOS, 1,
-- [kernel_read() take loff_t pointer])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
--
--dnl #
--dnl # 4.15 API change
--dnl # https://lkml.org/lkml/2017/11/25/90
--dnl # Check if timer_list.func get passed a timer_list or an unsigned long
--dnl # (older kernels). Also sanity check the from_timer() and timer_setup()
--dnl # macros are available as well, since they will be used in the same newer
--dnl # kernels that support the new timer_list.func signature.
--dnl #
--AC_DEFUN([SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST], [
-- AC_MSG_CHECKING([whether timer_list.function gets a timer_list])
-- tmp_flags="$EXTRA_KCFLAGS"
-- EXTRA_KCFLAGS="-Werror"
-- SPL_LINUX_TRY_COMPILE([
-- #include <linux/timer.h>
-- void task_expire(struct timer_list *tl) {}
-- ],[
-- #ifndef from_timer
-- #error "No from_timer() macro"
-- #endif
--
-- struct timer_list timer;
-- timer.function = task_expire;
-- timer_setup(&timer, NULL, 0);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST, 1,
-- [timer_list.function gets a timer_list])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
-- EXTRA_KCFLAGS="$tmp_flags"
--])
---
-2.14.2
-
diff --git a/spl-patches/0008-Fix-multiple-evaluations-of-VERIFY-and-ASSERT-on-fai.patch b/spl-patches/0008-Fix-multiple-evaluations-of-VERIFY-and-ASSERT-on-fai.patch
deleted file mode 100644
index 233c536..0000000
--- a/spl-patches/0008-Fix-multiple-evaluations-of-VERIFY-and-ASSERT-on-fai.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: DeHackEd <***@users.noreply.github.com>
-Date: Wed, 21 Feb 2018 17:54:26 -0500
-Subject: [PATCH] Fix multiple evaluations of VERIFY() and ASSERT() on failures
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Reviewed-by: loli10K <***@gmail.com>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: DHE <***@dehacked.net>
-Closes #684
-Closes #685
-(cherry picked from commit 610988f2dbf0e1c5811e6115d7ff8948b90a660e)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/sys/debug.h | 15 +++++++++------
- 1 file changed, 9 insertions(+), 6 deletions(-)
-
-diff --git a/include/sys/debug.h b/include/sys/debug.h
-index 6d683c2..b523ea1 100644
---- a/include/sys/debug.h
-+++ b/include/sys/debug.h
-@@ -63,12 +63,15 @@ void spl_dumpstack(void);
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "%s", "VERIFY(" #cond ") failed\n"))
-
--#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \
-- (void) ((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \
-- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
-- "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
-- "failed (" FMT " " #OP " " FMT ")\n", \
-- CAST (LEFT), CAST (RIGHT)))
-+#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) do { \
-+ TYPE _verify3_left = (TYPE)(LEFT); \
-+ TYPE _verify3_right = (TYPE)(RIGHT); \
-+ if (!(_verify3_left OP _verify3_right)) \
-+ spl_panic(__FILE__, __FUNCTION__, __LINE__, \
-+ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
-+ "failed (" FMT " " #OP " " FMT ")\n", \
-+ CAST (_verify3_left), CAST (_verify3_right)); \
-+ } while (0)
-
- #define VERIFY3B(x,y,z) VERIFY3_IMPL(x, y, z, boolean_t, "%d", (boolean_t))
- #define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long))
---
-2.14.2
-
diff --git a/spl-patches/0009-Staticize-kstat_default_update.patch b/spl-patches/0009-Staticize-kstat_default_update.patch
deleted file mode 100644
index 5b96ee3..0000000
--- a/spl-patches/0009-Staticize-kstat_default_update.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tomohiro Kusumi <***@osnexus.com>
-Date: Mon, 19 Feb 2018 19:23:53 +0900
-Subject: [PATCH] Staticize kstat_default_update()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This is only used via ->ks_update of `kstat_t *`.
-This isn't exported nor do headers have its prototype.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Tomohiro Kusumi <***@osnexus.com>
-Closes #686
-(cherry picked from commit 76ede57c7d927f34fcb5df30c3e7f2b2254ff5ed)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/spl/spl-kstat.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
-index d2baa49..e769510 100644
---- a/module/spl/spl-kstat.c
-+++ b/module/spl/spl-kstat.c
-@@ -327,7 +327,7 @@ restart:
- return (-rc);
- }
-
--int
-+static int
- kstat_default_update(kstat_t *ksp, int rw)
- {
- ASSERT(ksp != NULL);
---
-2.14.2
-
diff --git a/spl-patches/0010-Fix-function-name-typos.patch b/spl-patches/0010-Fix-function-name-typos.patch
deleted file mode 100644
index d19b759..0000000
--- a/spl-patches/0010-Fix-function-name-typos.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tomohiro Kusumi <***@osnexus.com>
-Date: Mon, 19 Feb 2018 20:40:38 +0900
-Subject: [PATCH] Fix function name typos
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-vn_init() and vn_fini() had been renamed by 12ff95ff in 2011.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Tomohiro Kusumi <***@osnexus.com>
-Closes #686
-(cherry picked from commit cfbcc0d4d74ea3ad279706b63e7a13290d3e130a)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/spl/spl-vnode.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
-index 75d8936..23008af 100644
---- a/module/spl/spl-vnode.c
-+++ b/module/spl/spl-vnode.c
-@@ -658,7 +658,7 @@ vn_file_cache_constructor(void *buf, void *cdrarg, int kmflags)
- INIT_LIST_HEAD(&fp->f_list);
-
- return (0);
--} /* file_cache_constructor() */
-+} /* vn_file_cache_constructor() */
-
- static void
- vn_file_cache_destructor(void *buf, void *cdrarg)
-@@ -680,7 +680,7 @@ spl_vn_init(void)
- vn_file_cache_destructor, NULL, NULL, NULL, 0);
-
- return (0);
--} /* vn_init() */
-+} /* spl_vn_init() */
-
- void
- spl_vn_fini(void)
-@@ -703,4 +703,4 @@ spl_vn_fini(void)
-
- kmem_cache_destroy(vn_file_cache);
- kmem_cache_destroy(vn_cache);
--} /* vn_fini() */
-+} /* spl_vn_fini() */
---
-2.14.2
-
diff --git a/spl-patches/0011-Fix-more-cstyle-warnings.patch b/spl-patches/0011-Fix-more-cstyle-warnings.patch
deleted file mode 100644
index 7745b17..0000000
--- a/spl-patches/0011-Fix-more-cstyle-warnings.patch
+++ /dev/null
@@ -1,391 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Sat, 24 Feb 2018 10:05:37 -0800
-Subject: [PATCH] Fix more cstyle warnings
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This patch contains no functional changes. It is solely intended
-to resolve cstyle warnings in order to facilitate moving the spl
-source code in to the zfs repository.
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed by: George Melikov <***@gmelikov.ru>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #687
-(cherry picked from commit 37a93c61226f3fd76f6f1e67291128a5d2d6d7c1)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/spl/spl-err.c | 5 ++++-
- module/spl/spl-generic.c | 11 ++++++++---
- module/spl/spl-kmem-cache.c | 5 ++++-
- module/spl/spl-kmem.c | 5 ++++-
- module/spl/spl-kstat.c | 17 ++++++++++-------
- module/spl/spl-proc.c | 18 ++++++++++--------
- module/spl/spl-thread.c | 3 +--
- module/spl/spl-vnode.c | 11 +++++------
- module/spl/spl-xdr.c | 10 +++++-----
- 9 files changed, 51 insertions(+), 34 deletions(-)
-
-diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c
-index e089de2..adfa555 100644
---- a/module/spl/spl-err.c
-+++ b/module/spl/spl-err.c
-@@ -34,9 +34,11 @@
- * analysis and other such goodies.
- * But we would still default to the current default of not to do that.
- */
-+/* BEGIN CSTYLED */
- unsigned int spl_panic_halt;
- module_param(spl_panic_halt, uint, 0644);
- MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures");
-+/* END CSTYLED */
-
- /*
- * Limit the number of stack traces dumped to not more than 5 every
-@@ -55,7 +57,8 @@ spl_dumpstack(void)
- EXPORT_SYMBOL(spl_dumpstack);
-
- int
--spl_panic(const char *file, const char *func, int line, const char *fmt, ...) {
-+spl_panic(const char *file, const char *func, int line, const char *fmt, ...)
-+{
- const char *newfile;
- char msg[MAXMSGLEN];
- va_list ap;
-diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c
-index 80fc54c..1098d9a 100644
---- a/module/spl/spl-generic.c
-+++ b/module/spl/spl-generic.c
-@@ -50,10 +50,12 @@
- char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE;
- EXPORT_SYMBOL(spl_version);
-
-+/* BEGIN CSTYLED */
- unsigned long spl_hostid = 0;
- EXPORT_SYMBOL(spl_hostid);
- module_param(spl_hostid, ulong, 0644);
- MODULE_PARM_DESC(spl_hostid, "The system hostid.");
-+/* END CSTYLED */
-
- proc_t p0;
- EXPORT_SYMBOL(p0);
-@@ -98,7 +100,8 @@ static DEFINE_PER_CPU(uint64_t[2], spl_pseudo_entropy);
- */
-
- static inline uint64_t
--spl_rand_next(uint64_t *s) {
-+spl_rand_next(uint64_t *s)
-+{
- uint64_t s1 = s[0];
- const uint64_t s0 = s[1];
- s[0] = s0;
-@@ -108,7 +111,8 @@ spl_rand_next(uint64_t *s) {
- }
-
- static inline void
--spl_rand_jump(uint64_t *s) {
-+spl_rand_jump(uint64_t *s)
-+{
- static const uint64_t JUMP[] =
- { 0x8a5cd789635d2dff, 0x121fd2155c472f96 };
-
-@@ -184,7 +188,8 @@ EXPORT_SYMBOL(random_get_pseudo_bytes);
- * Calculate number of leading of zeros for a 64-bit value.
- */
- static int
--nlz64(uint64_t x) {
-+nlz64(uint64_t x)
-+{
- register int n = 0;
-
- if (x == 0)
-diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c
-index e4bcdd8..c73a2fd 100644
---- a/module/spl/spl-kmem-cache.c
-+++ b/module/spl/spl-kmem-cache.c
-@@ -66,6 +66,7 @@
- * because it has been shown to improve responsiveness on low memory systems.
- * This policy may be changed by setting KMC_EXPIRE_AGE or KMC_EXPIRE_MEM.
- */
-+/* BEGIN CSTYLED */
- unsigned int spl_kmem_cache_expire = KMC_EXPIRE_MEM;
- EXPORT_SYMBOL(spl_kmem_cache_expire);
- module_param(spl_kmem_cache_expire, uint, 0644);
-@@ -148,6 +149,7 @@ unsigned int spl_kmem_cache_kmem_threads = 4;
- module_param(spl_kmem_cache_kmem_threads, uint, 0444);
- MODULE_PARM_DESC(spl_kmem_cache_kmem_threads,
- "Number of spl_kmem_cache threads");
-+/* END CSTYLED */
-
- /*
- * Slab allocation interfaces
-@@ -356,8 +358,9 @@ out:
- if (rc) {
- if (skc->skc_flags & KMC_OFFSLAB)
- list_for_each_entry_safe(sko,
-- n, &sks->sks_free_list, sko_list)
-+ n, &sks->sks_free_list, sko_list) {
- kv_free(skc, sko->sko_addr, offslab_size);
-+ }
-
- kv_free(skc, base, skc->skc_slab_size);
- sks = NULL;
-diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
-index bf9c6b1..e0d5510 100755
---- a/module/spl/spl-kmem.c
-+++ b/module/spl/spl-kmem.c
-@@ -44,6 +44,7 @@
- * allocations are quickly caught. These warnings may be disabled by setting
- * the threshold to zero.
- */
-+/* BEGIN CSTYLED */
- unsigned int spl_kmem_alloc_warn = MIN(16 * PAGE_SIZE, 64 * 1024);
- module_param(spl_kmem_alloc_warn, uint, 0644);
- MODULE_PARM_DESC(spl_kmem_alloc_warn,
-@@ -64,6 +65,7 @@ module_param(spl_kmem_alloc_max, uint, 0644);
- MODULE_PARM_DESC(spl_kmem_alloc_max,
- "Maximum size in bytes for a kmem_alloc()");
- EXPORT_SYMBOL(spl_kmem_alloc_max);
-+/* END CSTYLED */
-
- int
- kmem_debugging(void)
-@@ -520,10 +522,11 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
- printk(KERN_WARNING "%-16s %-5s %-16s %s:%s\n", "address",
- "size", "data", "func", "line");
-
-- list_for_each_entry(kd, list, kd_list)
-+ list_for_each_entry(kd, list, kd_list) {
- printk(KERN_WARNING "%p %-5d %-16s %s:%d\n", kd->kd_addr,
- (int)kd->kd_size, spl_sprintf_addr(kd, str, 17, 8),
- kd->kd_func, kd->kd_line);
-+ }
-
- spin_unlock_irqrestore(lock, flags);
- }
-diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
-index e769510..6970fcc 100644
---- a/module/spl/spl-kstat.c
-+++ b/module/spl/spl-kstat.c
-@@ -305,7 +305,7 @@ restart:
- } else {
- ASSERT(ksp->ks_ndata == 1);
- rc = kstat_seq_show_raw(f, ksp->ks_data,
-- ksp->ks_data_size);
-+ ksp->ks_data_size);
- }
- break;
- case KSTAT_TYPE_NAMED:
-@@ -434,9 +434,10 @@ kstat_find_module(char *name)
- {
- kstat_module_t *module;
-
-- list_for_each_entry(module, &kstat_module_list, ksm_module_list)
-+ list_for_each_entry(module, &kstat_module_list, ksm_module_list) {
- if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
- return (module);
-+ }
-
- return (NULL);
- }
-@@ -517,9 +518,9 @@ static struct file_operations proc_kstat_operations = {
-
- void
- __kstat_set_raw_ops(kstat_t *ksp,
-- int (*headers)(char *buf, size_t size),
-- int (*data)(char *buf, size_t size, void *data),
-- void *(*addr)(kstat_t *ksp, loff_t index))
-+ int (*headers)(char *buf, size_t size),
-+ int (*data)(char *buf, size_t size, void *data),
-+ void *(*addr)(kstat_t *ksp, loff_t index))
- {
- ksp->ks_raw_ops.headers = headers;
- ksp->ks_raw_ops.data = data;
-@@ -628,11 +629,12 @@ kstat_detect_collision(kstat_t *ksp)
-
- cp[0] = '\0';
- if ((module = kstat_find_module(parent)) != NULL) {
-- list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
-+ list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list) {
- if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {
- strfree(parent);
- return (EEXIST);
- }
-+ }
- }
-
- strfree(parent);
-@@ -665,9 +667,10 @@ __kstat_install(kstat_t *ksp)
- * Only one entry by this name per-module, on failure the module
- * shouldn't be deleted because we know it has at least one entry.
- */
-- list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
-+ list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list) {
- if (strncmp(tmp->ks_name, ksp->ks_name, KSTAT_STRLEN) == 0)
- goto out;
-+ }
-
- list_add_tail(&ksp->ks_list, &module->ksm_kstat_list);
-
-diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c
-index 60d6bbb..8ce5bbe 100644
---- a/module/spl/spl-proc.c
-+++ b/module/spl/spl-proc.c
-@@ -85,8 +85,8 @@ proc_copyin_string(char *kbuffer, int kbuffer_size, const char *ubuffer,
- }
-
- static int
--proc_copyout_string(char *ubuffer, int ubuffer_size,
-- const char *kbuffer, char *append)
-+proc_copyout_string(char *ubuffer, int ubuffer_size, const char *kbuffer,
-+ char *append)
- {
- /*
- * NB if 'append' != NULL, it's a single character to append to the
-@@ -239,9 +239,11 @@ taskq_seq_show_headers(struct seq_file *f)
- #define LHEAD_ACTIVE 4
- #define LHEAD_SIZE 5
-
-+/* BEGIN CSTYLED */
- static unsigned int spl_max_show_tasks = 512;
- module_param(spl_max_show_tasks, uint, 0644);
- MODULE_PARM_DESC(spl_max_show_tasks, "Max number of tasks shown in taskq proc");
-+/* END CSTYLED */
-
- static int
- taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
-@@ -719,15 +721,15 @@ spl_proc_init(void)
- goto out;
- }
-
-- proc_spl_taskq_all = proc_create_data("taskq-all", 0444,
-- proc_spl, &proc_taskq_all_operations, NULL);
-+ proc_spl_taskq_all = proc_create_data("taskq-all", 0444, proc_spl,
-+ &proc_taskq_all_operations, NULL);
- if (proc_spl_taskq_all == NULL) {
- rc = -EUNATCH;
- goto out;
- }
-
-- proc_spl_taskq = proc_create_data("taskq", 0444,
-- proc_spl, &proc_taskq_operations, NULL);
-+ proc_spl_taskq = proc_create_data("taskq", 0444, proc_spl,
-+ &proc_taskq_operations, NULL);
- if (proc_spl_taskq == NULL) {
- rc = -EUNATCH;
- goto out;
-@@ -739,8 +741,8 @@ spl_proc_init(void)
- goto out;
- }
-
-- proc_spl_kmem_slab = proc_create_data("slab", 0444,
-- proc_spl_kmem, &proc_slab_operations, NULL);
-+ proc_spl_kmem_slab = proc_create_data("slab", 0444, proc_spl_kmem,
-+ &proc_slab_operations, NULL);
- if (proc_spl_kmem_slab == NULL) {
- rc = -EUNATCH;
- goto out;
-diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c
-index 357d0ca..6f640fd 100644
---- a/module/spl/spl-thread.c
-+++ b/module/spl/spl-thread.c
-@@ -79,8 +79,7 @@ EXPORT_SYMBOL(__thread_exit);
- */
- kthread_t *
- __thread_create(caddr_t stk, size_t stksize, thread_func_t func,
-- const char *name, void *args, size_t len, proc_t *pp,
-- int state, pri_t pri)
-+ const char *name, void *args, size_t len, proc_t *pp, int state, pri_t pri)
- {
- thread_priv_t *tp;
- struct task_struct *tsk;
-diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
-index 23008af..74ae8fe 100644
---- a/module/spl/spl-vnode.c
-+++ b/module/spl/spl-vnode.c
-@@ -118,8 +118,8 @@ vn_free(vnode_t *vp)
- EXPORT_SYMBOL(vn_free);
-
- int
--vn_open(const char *path, uio_seg_t seg, int flags, int mode,
-- vnode_t **vpp, int x1, void *x2)
-+vn_open(const char *path, uio_seg_t seg, int flags, int mode, vnode_t **vpp,
-+ int x1, void *x2)
- {
- struct file *fp;
- struct kstat stat;
-@@ -210,7 +210,7 @@ EXPORT_SYMBOL(vn_openat);
-
- int
- vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off,
-- uio_seg_t seg, int ioflag, rlim64_t x2, void *x3, ssize_t *residp)
-+ uio_seg_t seg, int ioflag, rlim64_t x2, void *x3, ssize_t *residp)
- {
- struct file *fp = vp->v_file;
- loff_t offset = off;
-@@ -401,9 +401,8 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
- --end;
-
- vp->v_file->f_dentry->d_inode->i_op->truncate_range(
-- vp->v_file->f_dentry->d_inode,
-- bfp->l_start, end
-- );
-+ vp->v_file->f_dentry->d_inode, bfp->l_start, end);
-+
- return (0);
- }
- #endif
-diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c
-index 7c166e9..456887e 100644
---- a/module/spl/spl-xdr.c
-+++ b/module/spl/spl-xdr.c
-@@ -160,7 +160,7 @@ EXPORT_SYMBOL(xdrmem_create);
- static bool_t
- xdrmem_control(XDR *xdrs, int req, void *info)
- {
-- struct xdr_bytesrec *rec = (struct xdr_bytesrec *) info;
-+ struct xdr_bytesrec *rec = (struct xdr_bytesrec *)info;
-
- if (req != XDR_GET_BYTES_AVAIL)
- return (FALSE);
-@@ -236,7 +236,7 @@ xdrmem_enc_uint32(XDR *xdrs, uint32_t val)
- if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end)
- return (FALSE);
-
-- *((uint32_t *) xdrs->x_addr) = cpu_to_be32(val);
-+ *((uint32_t *)xdrs->x_addr) = cpu_to_be32(val);
-
- xdrs->x_addr += sizeof (uint32_t);
-
-@@ -249,7 +249,7 @@ xdrmem_dec_uint32(XDR *xdrs, uint32_t *val)
- if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end)
- return (FALSE);
-
-- *val = be32_to_cpu(*((uint32_t *) xdrs->x_addr));
-+ *val = be32_to_cpu(*((uint32_t *)xdrs->x_addr));
-
- xdrs->x_addr += sizeof (uint32_t);
-
-@@ -333,7 +333,7 @@ xdrmem_dec_uint(XDR *xdrs, unsigned *up)
- {
- BUILD_BUG_ON(sizeof (unsigned) != 4);
-
-- return (xdrmem_dec_uint32(xdrs, (uint32_t *) up));
-+ return (xdrmem_dec_uint32(xdrs, (uint32_t *)up));
- }
-
- static bool_t
-@@ -359,7 +359,7 @@ xdrmem_dec_ulonglong(XDR *xdrs, u_longlong_t *ullp)
- if (!xdrmem_dec_uint32(xdrs, &low))
- return (FALSE);
-
-- *ullp = ((u_longlong_t) high << 32) | low;
-+ *ullp = ((u_longlong_t)high << 32) | low;
-
- return (TRUE);
- }
---
-2.14.2
-
diff --git a/spl-patches/0012-Fix-spl-kmod-builds-when-using-rpm-4.14.patch b/spl-patches/0012-Fix-spl-kmod-builds-when-using-rpm-4.14.patch
deleted file mode 100644
index 7cde93d..0000000
--- a/spl-patches/0012-Fix-spl-kmod-builds-when-using-rpm-4.14.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: LOLi <***@users.noreply.github.com>
-Date: Fri, 9 Mar 2018 22:51:31 +0100
-Subject: [PATCH] Fix spl-kmod builds when using rpm >= 4.14
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-With rpm-software-management/***@5e94633 a package version containing
-invalid characters (most commonly a double '-') causes the kmod package
-generation to terminate with an error. This change takes advantage of
-the newly introduced rpm macro "_wrong_version_format_terminate_build"
-to allow kmod packages to be built.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: loli10K <***@gmail.com>
-Closes #691
-(cherry picked from commit 7d17023a33bb6f064e013dd99862e62b719f1e26)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- config/spl-build.m4 | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/config/spl-build.m4 b/config/spl-build.m4
-index 553b5d5..9c97e64 100644
---- a/config/spl-build.m4
-+++ b/config/spl-build.m4
-@@ -231,6 +231,7 @@ AC_DEFUN([SPL_AC_RPM], [
- RPM_DEFINE_COMMON='--define "$(DEBUG_SPL) 1" --define "$(DEBUG_KMEM) 1" --define "$(DEBUG_KMEM_TRACKING) 1"'
- RPM_DEFINE_UTIL=
- RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"'
-+ RPM_DEFINE_KMOD+=' --define "_wrong_version_format_terminate_build 0"'
- RPM_DEFINE_DKMS=
-
- SRPM_DEFINE_COMMON='--define "build_src_rpm 1"'
---
-2.14.2
-
diff --git a/spl-patches/0013-Tag-spl-0.7.7.patch b/spl-patches/0013-Tag-spl-0.7.7.patch
deleted file mode 100644
index 88e44ec..0000000
--- a/spl-patches/0013-Tag-spl-0.7.7.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Wed, 14 Mar 2018 16:16:00 -0700
-Subject: [PATCH] Tag spl-0.7.7
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-META file and changelog updated.
-
-Signed-off-by: Tony Hutter <***@llnl.gov>
-(cherry picked from commit 2f52bf4a84b1a3520cccd5cee1415ce85b91d04f)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- rpm/generic/spl-kmod.spec.in | 3 +++
- rpm/generic/spl.spec.in | 3 +++
- META | 2 +-
- 3 files changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/rpm/generic/spl-kmod.spec.in b/rpm/generic/spl-kmod.spec.in
-index eb38c21..6af292d 100644
---- a/rpm/generic/spl-kmod.spec.in
-+++ b/rpm/generic/spl-kmod.spec.in
-@@ -167,6 +167,9 @@ chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/*
- rm -rf $RPM_BUILD_ROOT
-
- %changelog
-+* Wed Mar 14 2018 Tony Hutter <***@llnl.gov> - 0.7.7-1
-+- Released 0.7.7-1, detailed release notes are available at:
-+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.7
- * Thu Feb 01 2018 Tony Hutter <***@llnl.gov> - 0.7.6-1
- - Released 0.7.6-1, detailed release notes are available at:
- - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.6
-diff --git a/rpm/generic/spl.spec.in b/rpm/generic/spl.spec.in
-index 0338a47..b693bdc 100644
---- a/rpm/generic/spl.spec.in
-+++ b/rpm/generic/spl.spec.in
-@@ -34,6 +34,9 @@ make install DESTDIR=%{?buildroot}
- %{_mandir}/man5/*
-
- %changelog
-+* Wed Mar 14 2018 Tony Hutter <***@llnl.gov> - 0.7.7-1
-+- Released 0.7.7-1, detailed release notes are available at:
-+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.7
- * Thu Feb 01 2018 Tony Hutter <***@llnl.gov> - 0.7.6-1
- - Released 0.7.6-1, detailed release notes are available at:
- - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.6
-diff --git a/META b/META
-index 4b0c0bb..64a07f1 100644
---- a/META
-+++ b/META
-@@ -1,7 +1,7 @@
- Meta: 1
- Name: spl
- Branch: 1.0
--Version: 0.7.6
-+Version: 0.7.7
- Release: 1
- Release-Tags: relext
- License: GPL
---
-2.14.2
-
diff --git a/spl-patches/0014-Tag-spl-0.7.8.patch b/spl-patches/0014-Tag-spl-0.7.8.patch
deleted file mode 100644
index 85a281a..0000000
--- a/spl-patches/0014-Tag-spl-0.7.8.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Mon, 9 Apr 2018 14:31:47 -0700
-Subject: [PATCH] Tag spl-0.7.8
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-META file and changelog updated.
-
-Signed-off-by: Tony Hutter <***@llnl.gov>
-(cherry picked from commit 557af2687fd70191120beb406f644392de39f747)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- rpm/generic/spl-kmod.spec.in | 3 +++
- rpm/generic/spl.spec.in | 3 +++
- META | 2 +-
- 3 files changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/rpm/generic/spl-kmod.spec.in b/rpm/generic/spl-kmod.spec.in
-index 6af292d..a604e1f 100644
---- a/rpm/generic/spl-kmod.spec.in
-+++ b/rpm/generic/spl-kmod.spec.in
-@@ -167,6 +167,9 @@ chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/*
- rm -rf $RPM_BUILD_ROOT
-
- %changelog
-+* Mon Apr 09 2018 Tony Hutter <***@llnl.gov> - 0.7.8-1
-+- Released 0.7.8-1, detailed release notes are available at:
-+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.8
- * Wed Mar 14 2018 Tony Hutter <***@llnl.gov> - 0.7.7-1
- - Released 0.7.7-1, detailed release notes are available at:
- - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.7
-diff --git a/rpm/generic/spl.spec.in b/rpm/generic/spl.spec.in
-index b693bdc..e7a718a 100644
---- a/rpm/generic/spl.spec.in
-+++ b/rpm/generic/spl.spec.in
-@@ -34,6 +34,9 @@ make install DESTDIR=%{?buildroot}
- %{_mandir}/man5/*
-
- %changelog
-+* Mon Apr 09 2018 Tony Hutter <***@llnl.gov> - 0.7.8-1
-+- Released 0.7.8-1, detailed release notes are available at:
-+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.8
- * Wed Mar 14 2018 Tony Hutter <***@llnl.gov> - 0.7.7-1
- - Released 0.7.7-1, detailed release notes are available at:
- - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.7
-diff --git a/META b/META
-index 64a07f1..0a5132f 100644
---- a/META
-+++ b/META
-@@ -1,7 +1,7 @@
- Meta: 1
- Name: spl
- Branch: 1.0
--Version: 0.7.7
-+Version: 0.7.8
- Release: 1
- Release-Tags: relext
- License: GPL
---
-2.14.2
-
diff --git a/spl-patches/series b/spl-patches/series
index 84344e9..20724b7 100644
--- a/spl-patches/series
+++ b/spl-patches/series
@@ -1,14 +1 @@
0001-remove-DKMS-and-module-build.patch
-0002-Allow-longer-SPA-names-in-stats.patch
-0003-Remove-vn_rename-and-vn_remove.patch
-0004-Remove-all-spin_is_locked-calls.patch
-0005-Add-cv_timedwait_io.patch
-0006-Fix-cstyle-warnings.patch
-0007-Split-spl-build.m4.patch
-0008-Fix-multiple-evaluations-of-VERIFY-and-ASSERT-on-fai.patch
-0009-Staticize-kstat_default_update.patch
-0010-Fix-function-name-typos.patch
-0011-Fix-more-cstyle-warnings.patch
-0012-Fix-spl-kmod-builds-when-using-rpm-4.14.patch
-0013-Tag-spl-0.7.7.patch
-0014-Tag-spl-0.7.8.patch
--
2.11.0
Stoiko Ivanov
2018-05-22 07:18:02 UTC
Permalink
Signed-off-by: Stoiko Ivanov <***@proxmox.com>
---
...0001-remove-DKMS-modules-and-dracut-build.patch | 62 +-
...ort-with-d-dev-disk-by-id-in-scan-service.patch | 6 +-
.../0003-always-load-ZFS-module-on-boot.patch | 4 +-
...e-enable-debug-fail-when-given-bogus-args.patch | 89 ---
...ement-enable-debuginfo-to-force-debuginfo.patch | 122 ----
...-configure-option-to-enable-gcov-analysis.patch | 121 ----
...fno-inline-compile-option-more-accessible.patch | 43 --
...d-support-for-enable-code-coverage-option.patch | 399 -----------
zfs-patches/0009-Update-codecov.yml.patch | 97 ---
...0010-Fix-enable-code-coverage-debug-build.patch | 35 -
...Remove-vn_rename-and-vn_remove-dependency.patch | 153 ----
...ystemd-on-Debian-based-distributions-6963.patch | 102 ---
.../0013-ZTS-Fix-create-o_ashift-test-case.patch | 137 ----
...an-error-message-before-MMP-suspends-pool.patch | 49 --
..._-RPM-macros-usage-on-Debian-based-distri.patch | 85 ---
...-in-qat_compress.c-for-vmalloc-addr-check.patch | 39 -
...0017-Fix-default-libdir-for-Debian-Ubuntu.patch | 52 --
...e-deprecated-zfs_arc_p_aggressive_disable.patch | 71 --
...6-Source-file-zfs_acl.c-function-zfs_acls.patch | 51 --
...0020-Linux-4.16-compat-inode_set_iversion.patch | 145 ----
....11-compat-avoid-refcount_t-name-conflict.patch | 53 --
...db-c-traverse-stop-on-damaged-objset-root.patch | 116 ---
...23-Fix-zle_decompress-out-of-bound-access.patch | 40 --
...-Fix-racy-assignment-of-zcb.zcb_haderrors.patch | 59 --
zfs-patches/0025-Fix-zdb-R-decompression.patch | 130 ----
zfs-patches/0026-Fix-zdb-E-segfault.patch | 50 --
...27-Fix-zdb-ed-on-objset-for-exported-pool.patch | 217 ------
...andle-zap_add-failures-in-mixed-case-mode.patch | 553 ---------------
...ould-use-a-fixed-tag-for-spa_config-locks.patch | 56 --
...-contrib-initramfs-add-missing-conf.d-zfs.patch | 66 --
...31-zfs-receive-fails-with-dataset-is-busy.patch | 90 ---
...7-zio_remove_child-panic-due-to-already-d.patch | 247 -------
.../0033-Clarify-zinject-8-explanation-of-e.patch | 40 --
...-Fix-config-issues-frame-size-and-headers.patch | 199 ------
...35-Correct-count_uberblocks-in-mmp.kshlib.patch | 38 -
...036-Add-SMART-attributes-for-SSD-and-NVMe.patch | 131 ----
...dprobe-to-fail-when-called-within-systemd.patch | 52 --
...nux-4.16-compat-use-correct-_dec_and_test.patch | 85 ---
...itiate-MMP-writes-while-pool-is-suspended.patch | 39 -
...duration-and-error-in-mmp_history-entries.patch | 237 -------
...0041-Fix-free-memory-calculation-on-v3.14.patch | 451 ------------
.../0042-Add-scrub-after-resilver-zed-script.patch | 516 --------------
...SMART-self-test-results-to-zpool-status-c.patch | 322 ---------
...ool-8-list-example-to-match-actual-format.patch | 66 --
zfs-patches/0045-Fix-some-typos.patch | 275 -------
...Increment-zil_itx_needcopy_bytes-properly.patch | 46 --
...Change-checksum-IO-delay-ratelimit-values.patch | 201 ------
...048-Linux-4.16-compat-get_disk_and_module.patch | 98 ---
...etect-long-config-lock-acquisition-in-mmp.patch | 46 --
...-namespaces-into-account-in-policy-checks.patch | 786 ---------------------
...nd-inuse-tests-don-t-pass-with-real-disks.patch | 232 ------
...2-Fix-zfs-kmod-builds-when-using-rpm-4.14.patch | 39 -
.../0053-Handle-zio_resume-and-mmp-off.patch | 60 --
...4-Fix-MMP-write-frequency-for-large-pools.patch | 72 --
zfs-patches/0055-Tag-zfs-0.7.7.patch | 63 --
...6-Revert-Handle-zap_add-failures-in-mixed.patch | 551 ---------------
zfs-patches/0057-Tag-zfs-0.7.8.patch | 63 --
zfs-patches/series | 54 --
58 files changed, 36 insertions(+), 8265 deletions(-)
delete mode 100644 zfs-patches/0004-Make-enable-debug-fail-when-given-bogus-args.patch
delete mode 100644 zfs-patches/0005-Implement-enable-debuginfo-to-force-debuginfo.patch
delete mode 100644 zfs-patches/0006-Add-configure-option-to-enable-gcov-analysis.patch
delete mode 100644 zfs-patches/0007-Make-fno-inline-compile-option-more-accessible.patch
delete mode 100644 zfs-patches/0008-Add-support-for-enable-code-coverage-option.patch
delete mode 100644 zfs-patches/0009-Update-codecov.yml.patch
delete mode 100644 zfs-patches/0010-Fix-enable-code-coverage-debug-build.patch
delete mode 100644 zfs-patches/0011-Remove-vn_rename-and-vn_remove-dependency.patch
delete mode 100644 zfs-patches/0012-Fix-with-systemd-on-Debian-based-distributions-6963.patch
delete mode 100644 zfs-patches/0013-ZTS-Fix-create-o_ashift-test-case.patch
delete mode 100644 zfs-patches/0014-Emit-an-error-message-before-MMP-suspends-pool.patch
delete mode 100644 zfs-patches/0015-Fix-systemd_-RPM-macros-usage-on-Debian-based-distri.patch
delete mode 100644 zfs-patches/0016-Bug-fix-in-qat_compress.c-for-vmalloc-addr-check.patch
delete mode 100644 zfs-patches/0017-Fix-default-libdir-for-Debian-Ubuntu.patch
delete mode 100644 zfs-patches/0018-Remove-deprecated-zfs_arc_p_aggressive_disable.patch
delete mode 100644 zfs-patches/0019-OpenZFS-8966-Source-file-zfs_acl.c-function-zfs_acls.patch
delete mode 100644 zfs-patches/0020-Linux-4.16-compat-inode_set_iversion.patch
delete mode 100644 zfs-patches/0021-Linux-4.11-compat-avoid-refcount_t-name-conflict.patch
delete mode 100644 zfs-patches/0022-Fix-zdb-c-traverse-stop-on-damaged-objset-root.patch
delete mode 100644 zfs-patches/0023-Fix-zle_decompress-out-of-bound-access.patch
delete mode 100644 zfs-patches/0024-Fix-racy-assignment-of-zcb.zcb_haderrors.patch
delete mode 100644 zfs-patches/0025-Fix-zdb-R-decompression.patch
delete mode 100644 zfs-patches/0026-Fix-zdb-E-segfault.patch
delete mode 100644 zfs-patches/0027-Fix-zdb-ed-on-objset-for-exported-pool.patch
delete mode 100644 zfs-patches/0028-Handle-zap_add-failures-in-mixed-case-mode.patch
delete mode 100644 zfs-patches/0029-mmp-should-use-a-fixed-tag-for-spa_config-locks.patch
delete mode 100644 zfs-patches/0030-contrib-initramfs-add-missing-conf.d-zfs.patch
delete mode 100644 zfs-patches/0031-zfs-receive-fails-with-dataset-is-busy.patch
delete mode 100644 zfs-patches/0032-OpenZFS-8857-zio_remove_child-panic-due-to-already-d.patch
delete mode 100644 zfs-patches/0033-Clarify-zinject-8-explanation-of-e.patch
delete mode 100644 zfs-patches/0034-Fix-config-issues-frame-size-and-headers.patch
delete mode 100644 zfs-patches/0035-Correct-count_uberblocks-in-mmp.kshlib.patch
delete mode 100644 zfs-patches/0036-Add-SMART-attributes-for-SSD-and-NVMe.patch
delete mode 100644 zfs-patches/0037-Allow-modprobe-to-fail-when-called-within-systemd.patch
delete mode 100644 zfs-patches/0038-Linux-4.16-compat-use-correct-_dec_and_test.patch
delete mode 100644 zfs-patches/0039-Do-not-initiate-MMP-writes-while-pool-is-suspended.patch
delete mode 100644 zfs-patches/0040-Report-duration-and-error-in-mmp_history-entries.patch
delete mode 100644 zfs-patches/0041-Fix-free-memory-calculation-on-v3.14.patch
delete mode 100644 zfs-patches/0042-Add-scrub-after-resilver-zed-script.patch
delete mode 100644 zfs-patches/0043-Add-SMART-self-test-results-to-zpool-status-c.patch
delete mode 100644 zfs-patches/0044-Fix-zpool-8-list-example-to-match-actual-format.patch
delete mode 100644 zfs-patches/0045-Fix-some-typos.patch
delete mode 100644 zfs-patches/0046-Increment-zil_itx_needcopy_bytes-properly.patch
delete mode 100644 zfs-patches/0047-Change-checksum-IO-delay-ratelimit-values.patch
delete mode 100644 zfs-patches/0048-Linux-4.16-compat-get_disk_and_module.patch
delete mode 100644 zfs-patches/0049-Detect-long-config-lock-acquisition-in-mmp.patch
delete mode 100644 zfs-patches/0050-Take-user-namespaces-into-account-in-policy-checks.patch
delete mode 100644 zfs-patches/0051-zdb-and-inuse-tests-don-t-pass-with-real-disks.patch
delete mode 100644 zfs-patches/0052-Fix-zfs-kmod-builds-when-using-rpm-4.14.patch
delete mode 100644 zfs-patches/0053-Handle-zio_resume-and-mmp-off.patch
delete mode 100644 zfs-patches/0054-Fix-MMP-write-frequency-for-large-pools.patch
delete mode 100644 zfs-patches/0055-Tag-zfs-0.7.7.patch
delete mode 100644 zfs-patches/0056-Revert-Handle-zap_add-failures-in-mixed.patch
delete mode 100644 zfs-patches/0057-Tag-zfs-0.7.8.patch

diff --git a/zfs-patches/0001-remove-DKMS-modules-and-dracut-build.patch b/zfs-patches/0001-remove-DKMS-modules-and-dracut-build.patch
index 7920aea..91dd244 100644
--- a/zfs-patches/0001-remove-DKMS-modules-and-dracut-build.patch
+++ b/zfs-patches/0001-remove-DKMS-modules-and-dracut-build.patch
@@ -8,14 +8,26 @@ Content-Transfer-Encoding: 8bit

Signed-off-by: Fabian Grünbichler <***@proxmox.com>
---
- debian/control.in | 41 ++------------------
debian/control | 1 -
+ debian/control.in | 40 ++-----------------
debian/not-installed | 2 +
- debian/rules | 105 +--------------------------------------------------
+ debian/rules | 106 +--------------------------------------------------
4 files changed, 7 insertions(+), 142 deletions(-)

+diff --git a/debian/control b/debian/control
+index 9e4f8fa7..42fbec35 100644
+--- a/debian/control
++++ b/debian/control
+@@ -9,7 +9,6 @@ Build-Depends: autotools-dev,
+ debhelper (>= 10.2),
+ dh-autoreconf,
+ dh-python,
+- dkms (>> 2.1.1.2-5),
+ libattr1-dev,
+ libblkid-dev,
+ libselinux1-dev,
diff --git a/debian/control.in b/debian/control.in
-index aef8cac2e..3cc15a05b 100644
+index e193f017..2cb2f614 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -9,7 +9,6 @@ Build-Depends: autotools-dev,
@@ -26,7 +38,7 @@ index aef8cac2e..3cc15a05b 100644
libattr1-dev,
libblkid-dev,
libselinux1-dev,
-@@ -86,27 +85,10 @@ Description: OpenZFS pool library for Linux
+@@ -86,26 +85,10 @@ Description: OpenZFS pool library for Linux
.
This zpool library provides support for managing zpools.

@@ -35,8 +47,7 @@ index aef8cac2e..3cc15a05b 100644
-Pre-Depends: spl-dkms (<<${source:Upstream-Version}.),
- spl-dkms (>= ${source:Upstream-Version})
-Depends: dkms (>> 2.1.1.2-5), lsb-release, ${misc:Depends}
--Recommends: zfs-zed, zfsutils-linux (>= ${binary:Version}),
-- @LINUX_COMPAT@
+-Recommends: zfs-zed, zfsutils-linux (>= ${binary:Version}), @LINUX_COMPAT@
-Provides: zfs-modules
-Description: OpenZFS filesystem kernel modules for Linux
- The Z file system is a pooled filesystem designed for maximum data
@@ -54,7 +65,7 @@ index aef8cac2e..3cc15a05b 100644
zfsutils-linux (>= ${binary:Version}),
${misc:Depends}
Description: OpenZFS root filesystem capabilities for Linux - initramfs
-@@ -117,29 +99,14 @@ Description: OpenZFS root filesystem capabilities for Linux - initramfs
+@@ -116,29 +99,14 @@ Description: OpenZFS root filesystem capabilities for Linux - initramfs
This package adds OpenZFS to the system initramfs with a hook
for the initramfs-tools infrastructure.

@@ -83,10 +94,10 @@ index aef8cac2e..3cc15a05b 100644
samba-common-bin (>= 3.0.23),
- zfs-initramfs | zfs-dracut
+ zfs-initramfs
- Conflicts: zfs, zfs-fuse, zutils
+ Conflicts: zfs, zfs-fuse
Provides: zfsutils
Description: command-line tools to manage OpenZFS filesystems
-@@ -153,8 +120,7 @@ Description: command-line tools to manage OpenZFS filesystems
+@@ -152,8 +120,7 @@ Description: command-line tools to manage OpenZFS filesystems
Package: zfs-zed
Section: contrib/admin
Architecture: linux-any
@@ -96,7 +107,7 @@ index aef8cac2e..3cc15a05b 100644
${misc:Depends},
${shlibs:Depends}
Description: OpenZFS Event Daemon
-@@ -177,7 +143,6 @@ Depends: acl,
+@@ -176,7 +143,6 @@ Depends: acl,
python,
sudo,
sysstat,
@@ -104,30 +115,18 @@ index aef8cac2e..3cc15a05b 100644
zfsutils-linux (>=${binary:Version}),
${misc:Depends},
${shlibs:Depends}
-diff --git a/debian/control b/debian/control
-index 3cf6fb649..51cfe6a64 100644
---- a/debian/control
-+++ b/debian/control
-@@ -9,7 +9,6 @@ Build-Depends: autotools-dev,
- debhelper (>= 10.2),
- dh-autoreconf,
- dh-python,
-- dkms (>> 2.1.1.2-5),
- libattr1-dev,
- libblkid-dev,
- libselinux1-dev,
diff --git a/debian/not-installed b/debian/not-installed
-index f54fe7310..c3929d90e 100644
+index a008985c..c60b0016 100644
--- a/debian/not-installed
+++ b/debian/not-installed
-@@ -5,3 +5,5 @@ etc/zfs/vdev_id.conf.alias.example
+@@ -6,3 +6,5 @@ etc/zfs/vdev_id.conf.alias.example
etc/zfs/vdev_id.conf.multipath.example
etc/zfs/vdev_id.conf.sas_direct.example
etc/zfs/vdev_id.conf.sas_switch.example
+usr/lib/dracut
+usr/share/zfs/enum-extract.pl
diff --git a/debian/rules b/debian/rules
-index cc47a74a1..a5c37c81d 100755
+index e2c5a25f..86b5994d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,9 +5,6 @@ include /usr/share/dpkg/default.mk
@@ -163,8 +162,8 @@ index cc47a74a1..a5c37c81d 100755
+ dh $@ --with autoreconf,python3,systemd --parallel

override_dh_auto_configure:
- sed "s/@LINUX_COMPAT@/linux-libc-dev \(< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
-@@ -73,36 +65,6 @@ override_dh_auto_install:
+ sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
+@@ -74,37 +66,6 @@ override_dh_auto_install:
$(INSTALL) -d '$(CURDIR)/debian/tmp/usr/sbin/'
mv '$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed'

@@ -175,7 +174,8 @@ index cc47a74a1..a5c37c81d 100755
-
- @# Install the DKMS source.
- @# We only want the files needed to build the modules
-- mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'
+- mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts'
+- cp '$(CURDIR)/scripts/enum-extract.pl' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts'
- $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit 1;)
- @# Hellish awk line:
- @# * Deletes from configure.ac the parts not needed for building the kernel module
@@ -201,7 +201,7 @@ index cc47a74a1..a5c37c81d 100755
mkdir -p $(CURDIR)/debian/tmp/usr/lib
for i in `ls $(CURDIR)/debian/tmp/lib/*.so`; do \
ln -s /lib/`readlink $${i}` $(CURDIR)/debian/tmp/usr/lib/`basename $${i}`; \
-@@ -112,9 +74,6 @@ override_dh_auto_install:
+@@ -114,9 +75,6 @@ override_dh_auto_install:
chmod a-x $(CURDIR)/debian/tmp/etc/zfs/zfs-functions
chmod a-x $(CURDIR)/debian/tmp/etc/default/zfs

@@ -211,7 +211,7 @@ index cc47a74a1..a5c37c81d 100755
override_dh_makeshlibs:
dh_makeshlibs -a -V
ifeq ($(BUILD_UDEB), true)
-@@ -152,65 +111,5 @@ override_dh_install:
+@@ -154,65 +112,5 @@ override_dh_install:

# ------------

@@ -278,5 +278,5 @@ index cc47a74a1..a5c37c81d 100755
debian-copyright:
cme update dpkg-copyright -file debian/copyright.cme
--
-2.14.2
+2.11.0

diff --git a/zfs-patches/0002-import-with-d-dev-disk-by-id-in-scan-service.patch b/zfs-patches/0002-import-with-d-dev-disk-by-id-in-scan-service.patch
index 6a3f266..0086019 100644
--- a/zfs-patches/0002-import-with-d-dev-disk-by-id-in-scan-service.patch
+++ b/zfs-patches/0002-import-with-d-dev-disk-by-id-in-scan-service.patch
@@ -12,18 +12,18 @@ Signed-off-by: Fabian Grünbichler <***@proxmox.com>
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in
-index 227f5b74f..cc428b0d0 100644
+index abc8e8e6..8fe2c107 100644
--- a/etc/systemd/system/zfs-import-scan.service.in
+++ b/etc/systemd/system/zfs-import-scan.service.in
@@ -12,7 +12,7 @@ ConditionPathExists=!@sysconfdir@/zfs/zpool.cache
Type=oneshot
RemainAfterExit=yes
- ExecStartPre=/sbin/modprobe zfs
+ ExecStartPre=-/sbin/modprobe zfs
-ExecStart=@sbindir@/zpool import -aN -o cachefile=none
+ExecStart=@sbindir@/zpool import -aN -d /dev/disk/by-id -o cachefile=none

[Install]
WantedBy=zfs-import.target
--
-2.14.2
+2.11.0

diff --git a/zfs-patches/0003-always-load-ZFS-module-on-boot.patch b/zfs-patches/0003-always-load-ZFS-module-on-boot.patch
index 8ed5779..da89f06 100644
--- a/zfs-patches/0003-always-load-ZFS-module-on-boot.patch
+++ b/zfs-patches/0003-always-load-ZFS-module-on-boot.patch
@@ -17,7 +17,7 @@ Signed-off-by: Fabian Grünbichler <***@proxmox.com>
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/etc/modules-load.d/zfs.conf.in b/etc/modules-load.d/zfs.conf.in
-index 8b41baa30..59b058c9a 100644
+index 8b41baa3..59b058c9 100644
--- a/etc/modules-load.d/zfs.conf.in
+++ b/etc/modules-load.d/zfs.conf.in
@@ -1,3 +1,3 @@
@@ -26,5 +26,5 @@ index 8b41baa30..59b058c9a 100644
-#zfs
+zfs
--
-2.14.2
+2.11.0

diff --git a/zfs-patches/0004-Make-enable-debug-fail-when-given-bogus-args.patch b/zfs-patches/0004-Make-enable-debug-fail-when-given-bogus-args.patch
deleted file mode 100644
index d751a53..0000000
--- a/zfs-patches/0004-Make-enable-debug-fail-when-given-bogus-args.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Richard Yao <***@clusterhq.com>
-Date: Tue, 23 Sep 2014 13:31:33 -0400
-Subject: [PATCH] Make --enable-debug fail when given bogus args
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Currently, bogus options to --enable-debug become --disable-debug. That
-means that passing --enable-debug=true is analogous to --disable-debug,
-but the result is counterintuitive. We switch to AS_CASE to allow us to
-fail when given a bogus option.
-
-Also, we modify the text printed to clarify that --enable-debug enables
-assertions.
-
-Reviewed-by: Chunwei Chen <***@gmail.com>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Richard Yao <***@clusterhq.com>
-Closes #2734
-(cherry picked from commit 0f1ff38476ba255eb1f066f675c8721168ff2295)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- config/zfs-build.m4 | 43 +++++++++++++++++++++++++------------------
- 1 file changed, 25 insertions(+), 18 deletions(-)
-
-diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
-index 7651dc2c1..78a87aef7 100644
---- a/config/zfs-build.m4
-+++ b/config/zfs-build.m4
-@@ -6,30 +6,37 @@ AC_DEFUN([ZFS_AC_LICENSE], [
- AC_MSG_RESULT([$ZFS_META_LICENSE])
- ])
-
-+AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [
-+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
-+ HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
-+ DEBUG_CFLAGS="-DDEBUG -Werror"
-+ DEBUG_STACKFLAGS="-fstack-check"
-+ DEBUG_ZFS="_with_debug"
-+ AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
-+])
-+
-+AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [
-+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
-+ HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
-+ DEBUG_CFLAGS="-DNDEBUG"
-+ DEBUG_STACKFLAGS=""
-+ DEBUG_ZFS="_without_debug"
-+])
-+
- AC_DEFUN([ZFS_AC_DEBUG], [
-- AC_MSG_CHECKING([whether debugging is enabled])
-+ AC_MSG_CHECKING([whether assertion support will be enabled])
- AC_ARG_ENABLE([debug],
- [AS_HELP_STRING([--enable-debug],
-- [Enable generic debug support @<:@default=no@:>@])],
-+ [Enable assertion support @<:@default=no@:>@])],
- [],
- [enable_debug=no])
-
-- AS_IF([test "x$enable_debug" = xyes],
-- [
-- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
-- HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
-- DEBUG_CFLAGS="-DDEBUG -Werror"
-- DEBUG_STACKFLAGS="-fstack-check"
-- DEBUG_ZFS="_with_debug"
-- AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
-- ],
-- [
-- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
-- HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
-- DEBUG_CFLAGS="-DNDEBUG"
-- DEBUG_STACKFLAGS=""
-- DEBUG_ZFS="_without_debug"
-- ])
-+ AS_CASE(["x$enable_debug"],
-+ ["xyes"],
-+ [ZFS_AC_DEBUG_ENABLE],
-+ ["xno"],
-+ [ZFS_AC_DEBUG_DISABLE],
-+ [AC_MSG_ERROR([Unknown option $enable_debug])])
-
- AC_SUBST(DEBUG_CFLAGS)
- AC_SUBST(DEBUG_STACKFLAGS)
---
-2.14.2
-
diff --git a/zfs-patches/0005-Implement-enable-debuginfo-to-force-debuginfo.patch b/zfs-patches/0005-Implement-enable-debuginfo-to-force-debuginfo.patch
deleted file mode 100644
index 83ad9d8..0000000
--- a/zfs-patches/0005-Implement-enable-debuginfo-to-force-debuginfo.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Richard Yao <***@clusterhq.com>
-Date: Tue, 23 Sep 2014 14:29:30 -0400
-Subject: [PATCH] Implement --enable-debuginfo to force debuginfo
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Inspection of a Ubuntu 14.04 x64 system revealed that the config file
-used to build the kernel image differs from the config file used to
-build kernel modules by the presence of CONFIG_DEBUG_INFO=y:
-
-This in itself is insufficient to show that the kernel is built with
-debuginfo, but a cursory analysis of the debuginfo provided and the
-size of the kernel strongly suggests that it was built with
-CONFIG_DEBUG_INFO=y while the modules were not. Installing
-linux-image-$(uname -r)-dbgsym had no obvious effect on the debuginfo
-provided by either the modules or the kernel.
-
-The consequence is that issue reports from distributions such as Ubuntu
-and its derivatives build kernel modules without debuginfo contain
-nonsensical backtraces. It is therefore desireable to force generation
-of debuginfo, so we implement --enable-debuginfo. Since the build system
-can build both userspace components and kernel modules, the generic
---enable-debuginfo option will force debuginfo for both. However, it
-also supports --enable-debuginfo=kernel and --enable-debuginfo=user for
-finer grained control.
-
-Enabling debuginfo for the kernel modules works by injecting
-CONFIG_DEBUG_INFO=y into the make environment. This is enables
-generation of debuginfo by the kernel build systems on all Linux
-kernels, but the build environment is slightly different int hat
-CONFIG_DEBUG_INFO has not been in the CPP. Adding -DCONFIG_DEBUG_INFO
-would fix that, but it would also cause build failures on kernels where
-CONFIG_DEBUG_INFO=y is already set. That would complicate its use in
-DKMS environments that support a range of kernels and is therefore
-undesireable. We could write a compatibility shim to enable
-CONFIG_DEBUG_INFO only when it is explicitly disabled, but we forgo
-doing that because it is unnecessary. Nothing in ZoL or the kernel uses
-CONFIG_DEBUG_INFO in the CPP at this time and that is unlikely to
-change.
-
-Enabling debuginfo for the userspace components is done by injecting -g
-into CPPFLAGS. This is not necessary because the build system honors the
-environment's CPPFLAGS by appending them to the actual CPPFLAGS used,
-but it is supported for consistency.
-
-Reviewed-by: Chunwei Chen <***@gmail.com>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Richard Yao <***@clusterhq.com>
-Closes #2734
-(cherry picked from commit 834815e9f767c9c5e7220ff84f29b1f069822a4d)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- configure.ac | 1 +
- config/zfs-build.m4 | 33 ++++++++++++++++++++++++++++++++-
- 2 files changed, 33 insertions(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index 0c7977ef8..e145aa370 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -55,6 +55,7 @@ ZFS_AC_LICENSE
- ZFS_AC_PACKAGE
- ZFS_AC_CONFIG
- ZFS_AC_DEBUG
-+ZFS_AC_DEBUGINFO
-
- AC_CONFIG_FILES([
- Makefile
-diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
-index 78a87aef7..a8609b829 100644
---- a/config/zfs-build.m4
-+++ b/config/zfs-build.m4
-@@ -38,12 +38,43 @@ AC_DEFUN([ZFS_AC_DEBUG], [
- [ZFS_AC_DEBUG_DISABLE],
- [AC_MSG_ERROR([Unknown option $enable_debug])])
-
-- AC_SUBST(DEBUG_CFLAGS)
- AC_SUBST(DEBUG_STACKFLAGS)
- AC_SUBST(DEBUG_ZFS)
- AC_MSG_RESULT([$enable_debug])
- ])
-
-+AC_DEFUN([ZFS_AC_DEBUGINFO_KERNEL], [
-+ KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS CONFIG_DEBUG_INFO=y"
-+])
-+
-+AC_DEFUN([ZFS_AC_DEBUGINFO_USER], [
-+ DEBUG_CFLAGS="$DEBUG_CFLAGS -g"
-+])
-+
-+AC_DEFUN([ZFS_AC_DEBUGINFO], [
-+ AC_MSG_CHECKING([whether debuginfo support will be forced])
-+ AC_ARG_ENABLE([debuginfo],
-+ [AS_HELP_STRING([--enable-debuginfo],
-+ [Force generation of debuginfo @<:@default=no@:>@])],
-+ [],
-+ [enable_debuginfo=no])
-+
-+ AS_CASE(["x$enable_debuginfo"],
-+ ["xyes"],
-+ [ZFS_AC_DEBUGINFO_KERNEL
-+ ZFS_AC_DEBUGINFO_USER],
-+ ["xkernel"],
-+ [ZFS_AC_DEBUGINFO_KERNEL],
-+ ["xuser"],
-+ [ZFS_AC_DEBUGINFO_USER],
-+ ["xno"],
-+ [],
-+ [AC_MSG_ERROR([Unknown option $enable_debug])])
-+
-+ AC_SUBST(DEBUG_CFLAGS)
-+ AC_MSG_RESULT([$enable_debuginfo])
-+])
-+
- AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
- ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE
- ZFS_AC_CONFIG_ALWAYS_NO_BOOL_COMPARE
---
-2.14.2
-
diff --git a/zfs-patches/0006-Add-configure-option-to-enable-gcov-analysis.patch b/zfs-patches/0006-Add-configure-option-to-enable-gcov-analysis.patch
deleted file mode 100644
index d5030e0..0000000
--- a/zfs-patches/0006-Add-configure-option-to-enable-gcov-analysis.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Fri, 15 Sep 2017 10:24:13 -0700
-Subject: [PATCH] Add configure option to enable gcov analysis
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-* Add configure option to enable gcov analysis.
-* Includes a few minor ctime fixes.
-* Add codecov.yml configuration.
-
-Reviewed-by: Prakash Surya <***@delphix.com>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #6642
-(cherry picked from commit 184087f822ef178d6f5c155681ee7c3d90f23321)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- configure.ac | 1 +
- Makefile.am | 8 +++---
- .github/codecov.yml | 9 +++++++
- config/zfs-build.m4 | 31 ++++++++++++++++++++++
- .../tests/functional/ctime/ctime_001_pos.ksh | 0
- 5 files changed, 45 insertions(+), 4 deletions(-)
- create mode 100644 .github/codecov.yml
- mode change 100644 => 100755 tests/zfs-tests/tests/functional/ctime/ctime_001_pos.ksh
-
-diff --git a/configure.ac b/configure.ac
-index e145aa370..ee754fd38 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -56,6 +56,7 @@ ZFS_AC_PACKAGE
- ZFS_AC_CONFIG
- ZFS_AC_DEBUG
- ZFS_AC_DEBUGINFO
-+ZFS_AC_GCOV
-
- AC_CONFIG_FILES([
- Makefile
-diff --git a/Makefile.am b/Makefile.am
-index 508d3f40e..732a373bd 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -29,10 +29,10 @@ distclean-local::
- -o -name .pc -o -name .hg -o -name .git \) -prune -o \
- \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
- -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-- -o -name '.*.rej' -o -name '.script-config' -o -size 0 \
-- -o -name '*%' -o -name '.*.cmd' -o -name 'core' \
-- -o -name 'Makefile' -o -name 'Module.symvers' \
-- -o -name '*.order' -o -name '*.markers' \) \
-+ -o -name '.*.rej' -o -size 0 -o -name '*%' -o -name '.*.cmd' \
-+ -o -name 'core' -o -name 'Makefile' -o -name 'Module.symvers' \
-+ -o -name '*.order' -o -name '*.markers' -o -name '*.gcda' \
-+ -o -name '*.gcno' \) \
- -type f -print | xargs $(RM)
-
- dist-hook:
-diff --git a/.github/codecov.yml b/.github/codecov.yml
-new file mode 100644
-index 000000000..f36be39cb
---- /dev/null
-+++ b/.github/codecov.yml
-@@ -0,0 +1,9 @@
-+codecov:
-+ strict_yaml_branch: master # only use the latest copy on master branch
-+
-+comment: off
-+
-+coverage:
-+ status:
-+ project: off
-+ patch: off
-diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
-index a8609b829..b84658a64 100644
---- a/config/zfs-build.m4
-+++ b/config/zfs-build.m4
-@@ -75,6 +75,37 @@ AC_DEFUN([ZFS_AC_DEBUGINFO], [
- AC_MSG_RESULT([$enable_debuginfo])
- ])
-
-+AC_DEFUN([ZFS_AC_GCOV_KERNEL], [
-+])
-+
-+AC_DEFUN([ZFS_AC_GCOV_USER], [
-+ DEBUG_CFLAGS="$DEBUG_CFLAGS -fprofile-arcs -ftest-coverage"
-+])
-+
-+AC_DEFUN([ZFS_AC_GCOV], [
-+ AC_MSG_CHECKING([whether gcov profiling will be enabled])
-+ AC_ARG_ENABLE([gcov],
-+ [AS_HELP_STRING([--enable-gcov],
-+ [Enable gcov profiling @<:@default=no@:>@])],
-+ [],
-+ [enable_gcov=no])
-+
-+ AS_CASE(["x$enable_gcov"],
-+ ["xyes"],
-+ [ZFS_AC_GCOV_KERNEL
-+ ZFS_AC_GCOV_USER],
-+ ["xkernel"],
-+ [ZFS_AC_GCOV_KERNEL],
-+ ["xuser"],
-+ [ZFS_AC_GCOV_USER],
-+ ["xno"],
-+ [],
-+ [AC_MSG_ERROR([Unknown option $enable_gcov])])
-+
-+ AC_SUBST(DEBUG_CFLAGS)
-+ AC_MSG_RESULT([$enable_gcov])
-+])
-+
- AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
- ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE
- ZFS_AC_CONFIG_ALWAYS_NO_BOOL_COMPARE
-diff --git a/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.ksh b/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.ksh
-old mode 100644
-new mode 100755
---
-2.14.2
-
diff --git a/zfs-patches/0007-Make-fno-inline-compile-option-more-accessible.patch b/zfs-patches/0007-Make-fno-inline-compile-option-more-accessible.patch
deleted file mode 100644
index ef6324c..0000000
--- a/zfs-patches/0007-Make-fno-inline-compile-option-more-accessible.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Prakash Surya <***@delphix.com>
-Date: Fri, 15 Sep 2017 11:47:11 -0700
-Subject: [PATCH] Make "-fno-inline" compile option more accessible
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When functions are inlined, it can make the system much more difficult
-to instrument using tools such as ftrace, BPF, crash, etc. Thus, to aid
-development and increase the system's observability, when the
-"--enable-debuginfo" flag is specified, the "-fno-inline" compilation
-option will be used for both userspace and kernel modules.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Prakash Surya <***@delphix.com>
-Closes #6605
-(cherry picked from commit f1236ebf35d1531db75ac8a57b23e8fe48d6b780)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- config/zfs-build.m4 | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
-index b84658a64..c695a882e 100644
---- a/config/zfs-build.m4
-+++ b/config/zfs-build.m4
-@@ -45,10 +45,11 @@ AC_DEFUN([ZFS_AC_DEBUG], [
-
- AC_DEFUN([ZFS_AC_DEBUGINFO_KERNEL], [
- KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS CONFIG_DEBUG_INFO=y"
-+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -fno-inline"
- ])
-
- AC_DEFUN([ZFS_AC_DEBUGINFO_USER], [
-- DEBUG_CFLAGS="$DEBUG_CFLAGS -g"
-+ DEBUG_CFLAGS="${DEBUG_CFLAGS} -g -fno-inline"
- ])
-
- AC_DEFUN([ZFS_AC_DEBUGINFO], [
---
-2.14.2
-
diff --git a/zfs-patches/0008-Add-support-for-enable-code-coverage-option.patch b/zfs-patches/0008-Add-support-for-enable-code-coverage-option.patch
deleted file mode 100644
index ca322b0..0000000
--- a/zfs-patches/0008-Add-support-for-enable-code-coverage-option.patch
+++ /dev/null
@@ -1,399 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Prakash Surya <***@delphix.com>
-Date: Fri, 22 Sep 2017 18:49:57 -0700
-Subject: [PATCH] Add support for "--enable-code-coverage" option
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This change adds support for a new option that can be passed to the
-configure script: "--enable-code-coverage". Further, the "--enable-gcov"
-option has been removed, as this new option provides the same
-functionality (plus more).
-
-When using this new option the following make targets are available:
-
- * check-code-coverage
- * code-coverage-capture
- * code-coverage-clean
-
-Note: these make targets can only be run from the root of the project.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Prakash Surya <***@delphix.com>
-Closes #6670
-(cherry picked from commit 6b278f3223c0322527836da2e11e33978e54a234)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- configure.ac | 2 +-
- Makefile.am | 2 +
- config/Rules.am | 2 +
- config/ax_code_coverage.m4 | 264 +++++++++++++++++++++++++++++++++++++++++++++
- config/zfs-build.m4 | 31 ------
- 5 files changed, 269 insertions(+), 32 deletions(-)
- create mode 100644 config/ax_code_coverage.m4
-
-diff --git a/configure.ac b/configure.ac
-index ee754fd38..d71712e4c 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -50,13 +50,13 @@ AC_PROG_CC
- AC_PROG_LIBTOOL
- AM_PROG_AS
- AM_PROG_CC_C_O
-+AX_CODE_COVERAGE
-
- ZFS_AC_LICENSE
- ZFS_AC_PACKAGE
- ZFS_AC_CONFIG
- ZFS_AC_DEBUG
- ZFS_AC_DEBUGINFO
--ZFS_AC_GCOV
-
- AC_CONFIG_FILES([
- Makefile
-diff --git a/Makefile.am b/Makefile.am
-index 732a373bd..b539ff30f 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -23,6 +23,8 @@ EXTRA_DIST = autogen.sh copy-builtin
- EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
- EXTRA_DIST += META DISCLAIMER COPYRIGHT README.markdown OPENSOLARIS.LICENSE
-
-+@CODE_COVERAGE_RULES@
-+
- distclean-local::
- -$(RM) -R autom4te*.cache
- -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
-diff --git a/config/Rules.am b/config/Rules.am
-index 1d39e7779..215f09c34 100644
---- a/config/Rules.am
-+++ b/config/Rules.am
-@@ -6,6 +6,7 @@ AM_CFLAGS += ${NO_UNUSED_BUT_SET_VARIABLE}
- AM_CFLAGS += ${NO_BOOL_COMPARE}
- AM_CFLAGS += -fno-strict-aliasing
- AM_CFLAGS += -std=gnu99
-+AM_CFLAGS += $(CODE_COVERAGE_CFLAGS)
- AM_CPPFLAGS = -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT
- AM_CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64
- AM_CPPFLAGS += -D_LARGEFILE64_SOURCE -DHAVE_LARGE_STACKS=1
-@@ -14,3 +15,4 @@ AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
- AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
- AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
- AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
-+AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
-diff --git a/config/ax_code_coverage.m4 b/config/ax_code_coverage.m4
-new file mode 100644
-index 000000000..6484f0332
---- /dev/null
-+++ b/config/ax_code_coverage.m4
-@@ -0,0 +1,264 @@
-+# ===========================================================================
-+# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
-+# ===========================================================================
-+#
-+# SYNOPSIS
-+#
-+# AX_CODE_COVERAGE()
-+#
-+# DESCRIPTION
-+#
-+# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
-+# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included
-+# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every
-+# build target (program or library) which should be built with code
-+# coverage support. Also defines CODE_COVERAGE_RULES which should be
-+# substituted in your Makefile; and $enable_code_coverage which can be
-+# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
-+# and substituted, and corresponds to the value of the
-+# --enable-code-coverage option, which defaults to being disabled.
-+#
-+# Test also for gcov program and create GCOV variable that could be
-+# substituted.
-+#
-+# Note that all optimization flags in CFLAGS must be disabled when code
-+# coverage is enabled.
-+#
-+# Usage example:
-+#
-+# configure.ac:
-+#
-+# AX_CODE_COVERAGE
-+#
-+# Makefile.am:
-+#
-+# @CODE_COVERAGE_RULES@
-+# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ...
-+# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
-+# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
-+# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
-+#
-+# This results in a "check-code-coverage" rule being added to any
-+# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
-+# has been configured with --enable-code-coverage). Running `make
-+# check-code-coverage` in that directory will run the module's test suite
-+# (`make check`) and build a code coverage report detailing the code which
-+# was touched, then print the URI for the report.
-+#
-+# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined
-+# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of
-+# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
-+# deprecated. They have the same value.
-+#
-+# This code was derived from Makefile.decl in GLib, originally licenced
-+# under LGPLv2.1+.
-+#
-+# LICENSE
-+#
-+# Copyright (c) 2012, 2016 Philip Withnall
-+# Copyright (c) 2012 Xan Lopez
-+# Copyright (c) 2012 Christian Persch
-+# Copyright (c) 2012 Paolo Borelli
-+# Copyright (c) 2012 Dan Winship
-+# Copyright (c) 2015 Bastien ROUCARIES
-+#
-+# This library is free software; you can redistribute it and/or modify it
-+# under the terms of the GNU Lesser General Public License as published by
-+# the Free Software Foundation; either version 2.1 of the License, or (at
-+# your option) any later version.
-+#
-+# This library is distributed in the hope that it will be useful, but
-+# WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
-+# General Public License for more details.
-+#
-+# You should have received a copy of the GNU Lesser General Public License
-+# along with this program. If not, see <https://www.gnu.org/licenses/>.
-+
-+#serial 25
-+
-+AC_DEFUN([AX_CODE_COVERAGE],[
-+ dnl Check for --enable-code-coverage
-+ AC_REQUIRE([AC_PROG_SED])
-+
-+ # allow to override gcov location
-+ AC_ARG_WITH([gcov],
-+ [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
-+ [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
-+ [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
-+
-+ AC_MSG_CHECKING([whether to build with code coverage support])
-+ AC_ARG_ENABLE([code-coverage],
-+ AS_HELP_STRING([--enable-code-coverage],
-+ [Whether to enable code coverage support]),,
-+ enable_code_coverage=no)
-+
-+ AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
-+ AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
-+ AC_MSG_RESULT($enable_code_coverage)
-+
-+ AS_IF([ test "$enable_code_coverage" = "yes" ], [
-+ # check for gcov
-+ AC_CHECK_TOOL([GCOV],
-+ [$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
-+ [:])
-+ AS_IF([test "X$GCOV" = "X:"],
-+ [AC_MSG_ERROR([gcov is needed to do coverage])])
-+ AC_SUBST([GCOV])
-+
-+ dnl Check if gcc is being used
-+ AS_IF([ test "$GCC" = "no" ], [
-+ AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
-+ ])
-+
-+ AC_CHECK_PROG([LCOV], [lcov], [lcov])
-+ AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
-+
-+ AS_IF([ test -z "$LCOV" ], [
-+ AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed])
-+ ])
-+
-+ AS_IF([ test -z "$GENHTML" ], [
-+ AC_MSG_ERROR([Could not find genhtml from the lcov package])
-+ ])
-+
-+ dnl Build the code coverage flags
-+ dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
-+ CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
-+ CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
-+ CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
-+ CODE_COVERAGE_LIBS="-lgcov"
-+ CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
-+
-+ AC_SUBST([CODE_COVERAGE_CPPFLAGS])
-+ AC_SUBST([CODE_COVERAGE_CFLAGS])
-+ AC_SUBST([CODE_COVERAGE_CXXFLAGS])
-+ AC_SUBST([CODE_COVERAGE_LIBS])
-+ AC_SUBST([CODE_COVERAGE_LDFLAGS])
-+
-+ [CODE_COVERAGE_RULES_CHECK='
-+ -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
-+ $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
-+']
-+ [CODE_COVERAGE_RULES_CAPTURE='
-+ $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
-+ $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
-+ -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
-+ $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
-+ @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
-+']
-+ [CODE_COVERAGE_RULES_CLEAN='
-+clean: code-coverage-clean
-+distclean: code-coverage-clean
-+code-coverage-clean:
-+ -$(LCOV) --directory $(top_builddir) -z
-+ -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-+ -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
-+']
-+ ], [
-+ [CODE_COVERAGE_RULES_CHECK='
-+ @echo "Need to reconfigure with --enable-code-coverage"
-+']
-+ CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
-+ CODE_COVERAGE_RULES_CLEAN=''
-+ ])
-+
-+[CODE_COVERAGE_RULES='
-+# Code coverage
-+#
-+# Optional:
-+# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
-+# Multiple directories may be specified, separated by whitespace.
-+# (Default: $(top_builddir))
-+# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
-+# by lcov for code coverage. (Default:
-+# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
-+# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
-+# reports to be created. (Default:
-+# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
-+# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
-+# set to 0 to disable it and leave empty to stay with the default.
-+# (Default: empty)
-+# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
-+# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
-+# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
-+# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
-+# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
-+# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
-+# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
-+# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
-+# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
-+# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
-+# lcov instance. (Default: empty)
-+# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
-+# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
-+# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
-+# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
-+# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
-+# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
-+# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
-+#
-+# The generated report will be titled using the $(PACKAGE_NAME) and
-+# $(PACKAGE_VERSION). In order to add the current git hash to the title,
-+# use the git-version-gen script, available online.
-+
-+# Optional variables
-+CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
-+CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
-+CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
-+CODE_COVERAGE_BRANCH_COVERAGE ?=
-+CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
-+--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
-+CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
-+CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
-+CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
-+CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
-+CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
-+CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
-+CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
-+$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
-+--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
-+CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
-+CODE_COVERAGE_IGNORE_PATTERN ?=
-+
-+GITIGNOREFILES ?=
-+GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-+
-+code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
-+code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
-+code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\
-+ $(CODE_COVERAGE_OUTPUT_FILE);
-+code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
-+code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
-+code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\
-+ $(CODE_COVERAGE_IGNORE_PATTERN);
-+code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
-+code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
-+code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
-+code_coverage_quiet = $(code_coverage_quiet_$(V))
-+code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
-+code_coverage_quiet_0 = --quiet
-+
-+# sanitizes the test-name: replaces with underscores: dashes and dots
-+code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
-+
-+# Use recursive makes in order to ignore errors during check
-+check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
-+
-+# Capture code coverage data
-+code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
-+
-+# Hook rule executed before code-coverage-capture, overridable by the user
-+code-coverage-capture-hook:
-+
-+'"$CODE_COVERAGE_RULES_CLEAN"'
-+
-+A''M_DISTCHECK_CONFIGURE_FLAGS ?=
-+A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
-+
-+.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
-+']
-+
-+ AC_SUBST([CODE_COVERAGE_RULES])
-+ m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
-+])
-diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
-index c695a882e..17cc80462 100644
---- a/config/zfs-build.m4
-+++ b/config/zfs-build.m4
-@@ -76,37 +76,6 @@ AC_DEFUN([ZFS_AC_DEBUGINFO], [
- AC_MSG_RESULT([$enable_debuginfo])
- ])
-
--AC_DEFUN([ZFS_AC_GCOV_KERNEL], [
--])
--
--AC_DEFUN([ZFS_AC_GCOV_USER], [
-- DEBUG_CFLAGS="$DEBUG_CFLAGS -fprofile-arcs -ftest-coverage"
--])
--
--AC_DEFUN([ZFS_AC_GCOV], [
-- AC_MSG_CHECKING([whether gcov profiling will be enabled])
-- AC_ARG_ENABLE([gcov],
-- [AS_HELP_STRING([--enable-gcov],
-- [Enable gcov profiling @<:@default=no@:>@])],
-- [],
-- [enable_gcov=no])
--
-- AS_CASE(["x$enable_gcov"],
-- ["xyes"],
-- [ZFS_AC_GCOV_KERNEL
-- ZFS_AC_GCOV_USER],
-- ["xkernel"],
-- [ZFS_AC_GCOV_KERNEL],
-- ["xuser"],
-- [ZFS_AC_GCOV_USER],
-- ["xno"],
-- [],
-- [AC_MSG_ERROR([Unknown option $enable_gcov])])
--
-- AC_SUBST(DEBUG_CFLAGS)
-- AC_MSG_RESULT([$enable_gcov])
--])
--
- AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
- ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE
- ZFS_AC_CONFIG_ALWAYS_NO_BOOL_COMPARE
---
-2.14.2
-
diff --git a/zfs-patches/0009-Update-codecov.yml.patch b/zfs-patches/0009-Update-codecov.yml.patch
deleted file mode 100644
index c5c67d9..0000000
--- a/zfs-patches/0009-Update-codecov.yml.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Fri, 22 Sep 2017 18:54:34 -0700
-Subject: [PATCH] Update codecov.yml
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Update the codecov.yml to make the following functional changes.
-
-* Do not require the CI testing to pass before posting results.
-* Set red-yellow-green coverage percent from 50%-100%
-* Allow a 1% drop in coverage to still be considered a pass.
-* Reduce the size of the comment posted to the issue.
-
-Additionally, the top level README.markdown has been updated
-to include the codecov.io badge and the project summary reworded.
-
-Reviewed-by: Prakash Surya <***@delphix.com>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #6669
-(cherry picked from commit 3790bfa80f9b26fd750b4a554c5707b9d380aac4)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- README.markdown | 12 ++++++------
- .github/codecov.yml | 31 ++++++++++++++++++++++++++-----
- 2 files changed, 32 insertions(+), 11 deletions(-)
-
-diff --git a/README.markdown b/README.markdown
-index fd2ca8c86..1c305b35d 100644
---- a/README.markdown
-+++ b/README.markdown
-@@ -1,9 +1,9 @@
--<p align="center"><img src="Loading Image..."/></p>
--ZFS is an advanced file system and volume manager which was originally
--developed for Solaris and is now maintained by the Illumos community.
-+![img](http://zfsonlinux.org/images/zfs-linux.png)
-
--ZFS on Linux, which is also known as ZoL, is currently feature complete. It
--includes fully functional and stable SPA, DMU, ZVOL, and ZPL layers. And it's native!
-+ZFS on Linux is an advanced file system and volume manager which was originally
-+developed for Solaris and is now maintained by the OpenZFS community.
-+
-+[![codecov](https://codecov.io/gh/zfsonlinux/zfs/branch/master/graph/badge.svg)](https://codecov.io/gh/zfsonlinux/zfs)
-
- # Official Resources
- * [Site](http://zfsonlinux.org)
-@@ -16,4 +16,4 @@ Full documentation for installing ZoL on your favorite Linux distribution can
- be found at [our site](http://zfsonlinux.org/).
-
- # Contribute & Develop
--We have a separate document with [contribution guidelines](./.github/CONTRIBUTING.md).
-\ No newline at end of file
-+We have a separate document with [contribution guidelines](./.github/CONTRIBUTING.md).
-diff --git a/.github/codecov.yml b/.github/codecov.yml
-index f36be39cb..e74c59a0f 100644
---- a/.github/codecov.yml
-+++ b/.github/codecov.yml
-@@ -1,9 +1,30 @@
- codecov:
-- strict_yaml_branch: master # only use the latest copy on master branch
--
--comment: off
-+ notify:
-+ require_ci_to_pass: no
-
- coverage:
-+ precision: 2
-+ round: down
-+ range: "50...100"
-+
- status:
-- project: off
-- patch: off
-+ project:
-+ default:
-+ threshold: 1%
-+
-+ patch:
-+ default:
-+ threshold: 1%
-+
-+parsers:
-+ gcov:
-+ branch_detection:
-+ conditional: yes
-+ loop: yes
-+ method: no
-+ macro: no
-+
-+comment:
-+ layout: "header, sunburst, diff"
-+ behavior: default
-+ require_changes: no
---
-2.14.2
-
diff --git a/zfs-patches/0010-Fix-enable-code-coverage-debug-build.patch b/zfs-patches/0010-Fix-enable-code-coverage-debug-build.patch
deleted file mode 100644
index dd815d1..0000000
--- a/zfs-patches/0010-Fix-enable-code-coverage-debug-build.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Fri, 22 Sep 2017 22:16:18 -0700
-Subject: [PATCH] Fix "--enable-code-coverage" debug build
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When --enable-code-coverage is provided it should not result
-in NDEBUG being defined. This is controlled by --enable-debug.
-
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #6674
-(cherry picked from commit 6897ea475fd0c82a74edacf374d4e339f9a9b86b)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- config/ax_code_coverage.m4 | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/config/ax_code_coverage.m4 b/config/ax_code_coverage.m4
-index 6484f0332..4417d4444 100644
---- a/config/ax_code_coverage.m4
-+++ b/config/ax_code_coverage.m4
-@@ -124,7 +124,7 @@ AC_DEFUN([AX_CODE_COVERAGE],[
-
- dnl Build the code coverage flags
- dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
-- CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
-+ CODE_COVERAGE_CPPFLAGS=""
- CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
- CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
- CODE_COVERAGE_LIBS="-lgcov"
---
-2.14.2
-
diff --git a/zfs-patches/0011-Remove-vn_rename-and-vn_remove-dependency.patch b/zfs-patches/0011-Remove-vn_rename-and-vn_remove-dependency.patch
deleted file mode 100644
index 855cbb6..0000000
--- a/zfs-patches/0011-Remove-vn_rename-and-vn_remove-dependency.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Thu, 19 Oct 2017 10:06:55 -0700
-Subject: [PATCH] Remove vn_rename and vn_remove dependency
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The only place vn_rename and vn_remove are used is when writing
-out an updated pool configuration file. By truncating the file
-instead of renaming and removing it we can avoid having to implement
-these interfaces entirely. Functionally an empty cache file is
-treated the same as a missing cache file. This is particularly
-advantageous because the Linux kernel has never provided a way
-to reliably implement vn_rename and vn_remove.
-
-The cachefile_004_pos.ksh test case was updated to understand
-that an empty cache file is the same as a missing one.
-
-The zfs-import-* systemd service files were not updated to use
-ConditionFileNotEmpty in place of ConditionPathExists. This
-means that after exporting all pools and rebooting new pools
-will not the scanned for on the next boot. This small change
-should not impact normal usage since pools are not exported
-as part of a normal shutdown.
-
-Documentation was updated accordingly.
-
-Reviewed-by: George Melikov <***@gmelikov.ru>
-Reviewed-by: Arkadiusz Bubała <***@open-e.com>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes zfsonlinux/spl#648
-Closes #6753
-(cherry picked from commit 5d62588032aa1d13d7f789cf564a0d20c77a5762)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/spa_config.c | 34 ++++++++++++++++++----
- man/man8/zpool.8 | 2 +-
- .../functional/cachefile/cachefile_004_pos.ksh | 6 ++--
- 3 files changed, 32 insertions(+), 10 deletions(-)
-
-diff --git a/module/zfs/spa_config.c b/module/zfs/spa_config.c
-index 5b792b868..fea239014 100644
---- a/module/zfs/spa_config.c
-+++ b/module/zfs/spa_config.c
-@@ -147,6 +147,26 @@ out:
- kobj_close_file(file);
- }
-
-+static int
-+spa_config_remove(spa_config_dirent_t *dp)
-+{
-+#if defined(__linux__) && defined(_KERNEL)
-+ int error, flags = FWRITE | FTRUNC;
-+ uio_seg_t seg = UIO_SYSSPACE;
-+ vnode_t *vp;
-+
-+ error = vn_open(dp->scd_path, seg, flags, 0644, &vp, 0, 0);
-+ if (error == 0) {
-+ (void) VOP_FSYNC(vp, FSYNC, kcred, NULL);
-+ (void) VOP_CLOSE(vp, 0, 1, 0, kcred, NULL);
-+ }
-+
-+ return (error);
-+#else
-+ return (vn_remove(dp->scd_path, UIO_SYSSPACE, RMFILE));
-+#endif
-+}
-+
- static int
- spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl)
- {
-@@ -161,7 +181,10 @@ spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl)
- * If the nvlist is empty (NULL), then remove the old cachefile.
- */
- if (nvl == NULL) {
-- err = vn_remove(dp->scd_path, UIO_SYSSPACE, RMFILE);
-+ err = spa_config_remove(dp);
-+ if (err == ENOENT)
-+ err = 0;
-+
- return (err);
- }
-
-@@ -174,9 +197,9 @@ spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl)
- #if defined(__linux__) && defined(_KERNEL)
- /*
- * Write the configuration to disk. Due to the complexity involved
-- * in performing a rename from within the kernel the file is truncated
-- * and overwritten in place. In the event of an error the file is
-- * unlinked to make sure we always have a consistent view of the data.
-+ * in performing a rename and remove from within the kernel the file
-+ * is instead truncated and overwritten in place. This way we always
-+ * have a consistent view of the data or a zero length file.
- */
- err = vn_open(dp->scd_path, UIO_SYSSPACE, oflags, 0644, &vp, 0, 0);
- if (err == 0) {
-@@ -186,9 +209,8 @@ spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl)
- err = VOP_FSYNC(vp, FSYNC, kcred, NULL);
-
- (void) VOP_CLOSE(vp, oflags, 1, 0, kcred, NULL);
--
- if (err)
-- (void) vn_remove(dp->scd_path, UIO_SYSSPACE, RMFILE);
-+ (void) spa_config_remove(dp);
- }
- #else
- /*
-diff --git a/man/man8/zpool.8 b/man/man8/zpool.8
-index 328ba3dce..22579101a 100644
---- a/man/man8/zpool.8
-+++ b/man/man8/zpool.8
-@@ -655,7 +655,7 @@ Because the kernel destroys and recreates this file when pools are added and
- removed, care should be taken when attempting to access this file.
- When the last pool using a
- .Sy cachefile
--is exported or destroyed, the file is removed.
-+is exported or destroyed, the file will be empty.
- .It Sy comment Ns = Ns Ar text
- A text string consisting of printable ASCII characters that will be stored
- such that it is available even if the pool becomes faulted.
-diff --git a/tests/zfs-tests/tests/functional/cachefile/cachefile_004_pos.ksh b/tests/zfs-tests/tests/functional/cachefile/cachefile_004_pos.ksh
-index ae54a9365..e0b81e166 100755
---- a/tests/zfs-tests/tests/functional/cachefile/cachefile_004_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/cachefile/cachefile_004_pos.ksh
-@@ -98,13 +98,13 @@ log_must zpool set cachefile=$CPATH2 $TESTPOOL1
- log_must pool_in_cache $TESTPOOL1 $CPATH2
- log_must zpool set cachefile=$CPATH2 $TESTPOOL2
- log_must pool_in_cache $TESTPOOL2 $CPATH2
--if [[ -f $CPATH1 ]]; then
-+if [[ -s $CPATH1 ]]; then
- log_fail "Verify set when cachefile is set on pool."
- fi
-
- log_must zpool export $TESTPOOL1
- log_must zpool export $TESTPOOL2
--if [[ -f $CPATH2 ]]; then
-+if [[ -s $CPATH2 ]]; then
- log_fail "Verify export when cachefile is set on pool."
- fi
-
-@@ -117,7 +117,7 @@ log_must pool_in_cache $TESTPOOL2 $CPATH2
-
- log_must zpool destroy $TESTPOOL1
- log_must zpool destroy $TESTPOOL2
--if [[ -f $CPATH2 ]]; then
-+if [[ -s $CPATH2 ]]; then
- log_fail "Verify destroy when cachefile is set on pool."
- fi
-
---
-2.14.2
-
diff --git a/zfs-patches/0012-Fix-with-systemd-on-Debian-based-distributions-6963.patch b/zfs-patches/0012-Fix-with-systemd-on-Debian-based-distributions-6963.patch
deleted file mode 100644
index 77f4db1..0000000
--- a/zfs-patches/0012-Fix-with-systemd-on-Debian-based-distributions-6963.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: LOLi <***@users.noreply.github.com>
-Date: Sun, 17 Dec 2017 23:08:48 +0100
-Subject: [PATCH] Fix --with-systemd on Debian-based distributions (#6963)
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-These changes propagate the "--with-systemd" configure option to the
-RPM spec file, allowing Debian-based distributions to package
-systemd-related files.
-
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: loli10K <***@gmail.com>
-Closes #6591
-Closes #6963
-(cherry picked from commit 03658d5081c64e14898cc9be45da3305b27fac9e)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- rpm/generic/zfs.spec.in | 2 +-
- config/user-systemd.m4 | 20 ++++++++++++++++----
- config/zfs-build.m4 | 2 +-
- 3 files changed, 18 insertions(+), 6 deletions(-)
-
-diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
-index 8df57fa46..4a911b4c2 100644
---- a/rpm/generic/zfs.spec.in
-+++ b/rpm/generic/zfs.spec.in
-@@ -87,11 +87,11 @@ BuildRequires: libblkid-devel
- BuildRequires: libudev-devel
- BuildRequires: libattr-devel
- %endif
-+
- %if 0%{?_systemd}
- Requires(post): systemd
- Requires(preun): systemd
- Requires(postun): systemd
--BuildRequires: systemd
- %endif
-
- # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
-diff --git a/config/user-systemd.m4 b/config/user-systemd.m4
-index c2105abce..de2a44f10 100644
---- a/config/user-systemd.m4
-+++ b/config/user-systemd.m4
-@@ -2,7 +2,8 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
- AC_ARG_ENABLE(systemd,
- AC_HELP_STRING([--enable-systemd],
- [install systemd unit/preset files [[default: yes]]]),
-- [],enable_systemd=yes)
-+ [enable_systemd=$enableval],
-+ [enable_systemd=check])
-
- AC_ARG_WITH(systemdunitdir,
- AC_HELP_STRING([--with-systemdunitdir=DIR],
-@@ -19,16 +20,27 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
- [install systemd module load files into dir [[/usr/lib/modules-load.d]]]),
- systemdmoduleloaddir=$withval,systemdmodulesloaddir=/usr/lib/modules-load.d)
-
-+ AS_IF([test "x$enable_systemd" = xcheck], [
-+ AS_IF([systemctl --version >/dev/null 2>&1],
-+ [enable_systemd=yes],
-+ [enable_systemd=no])
-+ ])
-
-- AS_IF([test "x$enable_systemd" = xyes],
-- [
-+ AC_MSG_CHECKING(for systemd support)
-+ AC_MSG_RESULT([$enable_systemd])
-+
-+ AS_IF([test "x$enable_systemd" = xyes], [
- ZFS_INIT_SYSTEMD=systemd
- ZFS_MODULE_LOAD=modules-load.d
-+ DEFINE_SYSTEMD='--with systemd --define "_unitdir $(systemdunitdir)" --define "_presetdir $(systemdpresetdir)"'
- modulesloaddir=$systemdmodulesloaddir
-- ])
-+ ],[
-+ DEFINE_SYSTEMD='--without systemd'
-+ ])
-
- AC_SUBST(ZFS_INIT_SYSTEMD)
- AC_SUBST(ZFS_MODULE_LOAD)
-+ AC_SUBST(DEFINE_SYSTEMD)
- AC_SUBST(systemdunitdir)
- AC_SUBST(systemdpresetdir)
- AC_SUBST(modulesloaddir)
-diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
-index 17cc80462..5eaa49c87 100644
---- a/config/zfs-build.m4
-+++ b/config/zfs-build.m4
-@@ -160,7 +160,7 @@ AC_DEFUN([ZFS_AC_RPM], [
- ])
-
- RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"'
-- RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS)'
-+ RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS) $(DEFINE_SYSTEMD)'
- RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"'
- RPM_DEFINE_DKMS=
-
---
-2.14.2
-
diff --git a/zfs-patches/0013-ZTS-Fix-create-o_ashift-test-case.patch b/zfs-patches/0013-ZTS-Fix-create-o_ashift-test-case.patch
deleted file mode 100644
index df72029..0000000
--- a/zfs-patches/0013-ZTS-Fix-create-o_ashift-test-case.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: LOLi <***@users.noreply.github.com>
-Date: Tue, 19 Dec 2017 19:49:33 +0100
-Subject: [PATCH] ZTS: Fix create-o_ashift test case
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The function that fills the uberblock ring buffer on every device label
-has been reworked to avoid occasional failures caused by a race
-condition that prevents 'zpool sync' from writing some uberblock
-sequentially: this happens when the pool sync ioctl dispatch code calls
-txg_wait_synced() while we're already waiting for a TXG to sync.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: loli10K <***@gmail.com>
-Closes #6924
-Closes #6977
-(cherry picked from commit 6c891ade8bee9c54484d5cf9b939582b7a9b7eeb)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/zdb/zdb.c | 8 ++--
- .../cli_root/zpool_create/create-o_ashift.ksh | 47 ++++++++++------------
- 2 files changed, 26 insertions(+), 29 deletions(-)
-
-diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
-index 1097501e8..442685486 100644
---- a/cmd/zdb/zdb.c
-+++ b/cmd/zdb/zdb.c
-@@ -2716,10 +2716,6 @@ dump_label(const char *dev)
- exit(1);
- }
-
-- if (ioctl(fd, BLKFLSBUF) != 0)
-- (void) printf("failed to invalidate cache '%s' : %s\n", path,
-- strerror(errno));
--
- if (fstat64_blk(fd, &statbuf) != 0) {
- (void) printf("failed to stat '%s': %s\n", path,
- strerror(errno));
-@@ -2727,6 +2723,10 @@ dump_label(const char *dev)
- exit(1);
- }
-
-+ if (S_ISBLK(statbuf.st_mode) && ioctl(fd, BLKFLSBUF) != 0)
-+ (void) printf("failed to invalidate cache '%s' : %s\n", path,
-+ strerror(errno));
-+
- avl_create(&config_tree, cksum_record_compare,
- sizeof (cksum_record_t), offsetof(cksum_record_t, link));
- avl_create(&uberblock_tree, cksum_record_compare,
-diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh
-index 6449c8a91..6a9c3e28c 100755
---- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh
-+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh
-@@ -44,47 +44,45 @@ verify_runnable "global"
-
- function cleanup
- {
-- poolexists $TESTPOOL && destroy_pool $TESTPOOL
-+ destroy_pool $TESTPOOL
- log_must rm -f $disk
- }
-
- #
--# Commit the specified number of TXGs to the provided pool
--# We use 'zpool sync' here because we can't force it via sync(1) like on illumos
--# $1 pool name
--# $2 number of txg syncs
-+# Fill the uberblock ring in every <device> label: we do this by committing
-+# TXGs to the provided <pool> until every slot contains a valid uberblock.
-+# NOTE: We use 'zpool sync' here because we can't force it via sync(1) like on
-+# illumos
- #
--function txg_sync
-+function write_device_uberblocks # <device> <pool>
- {
-- typeset pool=$1
-- typeset -i count=$2
-- typeset -i i=0;
-+ typeset device=$1
-+ typeset pool=$2
-
-- while [ $i -lt $count ]
-+ while [ "$(zdb -quuul $device | grep -c 'invalid')" -ne 0 ]
- do
-- log_must sync_pool $pool true
-- ((i = i + 1))
-+ sync_pool $pool true
- done
- }
-
- #
--# Verify device $1 labels contains $2 valid uberblocks in every label
--# $1 device
--# $2 uberblocks count
-+# Verify every label on <device> contains <count> (valid) uberblocks
- #
--function verify_device_uberblocks
-+function verify_device_uberblocks # <device> <count>
- {
- typeset device=$1
- typeset ubcount=$2
-
- zdb -quuul $device | egrep '^(\s+)?Uberblock' |
-- egrep -v 'invalid$' | awk \
-- -v ubcount=$ubcount '{ uberblocks[$0]++; }
-- END { for (i in uberblocks) {
-- count++;
-- if (uberblocks[i] != 4) { exit 1; }
-- }
-- if (count != ubcount) { exit 1; } }'
-+ awk -v ubcount=$ubcount 'BEGIN { count=0 } { uberblocks[$0]++; }
-+ END {
-+ for (i in uberblocks) {
-+ if (i ~ /invalid/) { continue; }
-+ if (uberblocks[i] != 4) { exit 1; }
-+ count++;
-+ }
-+ if (count != ubcount) { exit 1; }
-+ }'
-
- return $?
- }
-@@ -110,8 +108,7 @@ do
- log_fail "Pool was created without setting ashift value to "\
- "$ashift (current = $pprop)"
- fi
-- # force 128 txg sync to fill the uberblock ring
-- txg_sync $TESTPOOL 128
-+ write_device_uberblocks $disk $TESTPOOL
- verify_device_uberblocks $disk ${ubcount[$i]}
- if [[ $? -ne 0 ]]
- then
---
-2.14.2
-
diff --git a/zfs-patches/0014-Emit-an-error-message-before-MMP-suspends-pool.patch b/zfs-patches/0014-Emit-an-error-message-before-MMP-suspends-pool.patch
deleted file mode 100644
index da521ef..0000000
--- a/zfs-patches/0014-Emit-an-error-message-before-MMP-suspends-pool.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "John L. Hammond" <35266395+jhammond-***@users.noreply.github.com>
-Date: Wed, 17 Jan 2018 14:24:42 -0600
-Subject: [PATCH] Emit an error message before MMP suspends pool
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-In mmp_thread(), emit an MMP specific error message before calling
-zio_suspend() so that the administrator will understand why the pool
-is being suspended.
-
-Reviewed-by: Olaf Faaland <***@llnl.gov>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: John L. Hammond <***@intel.com>
-Closes #7048
-(cherry picked from commit ecc972c7f009e1fa75900e276a4c1306c55b5722)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/mmp.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
-index 6f2aa3f59..e91ae628a 100644
---- a/module/zfs/mmp.c
-+++ b/module/zfs/mmp.c
-@@ -26,6 +26,7 @@
- #include <sys/mmp.h>
- #include <sys/spa.h>
- #include <sys/spa_impl.h>
-+#include <sys/time.h>
- #include <sys/vdev.h>
- #include <sys/vdev_impl.h>
- #include <sys/zfs_context.h>
-@@ -428,6 +429,10 @@ mmp_thread(spa_t *spa)
- */
- if (!suspended && mmp_fail_intervals && multihost &&
- (start - mmp->mmp_last_write) > max_fail_ns) {
-+ cmn_err(CE_WARN, "MMP writes to pool '%s' have not "
-+ "succeeded in over %llus; suspending pool",
-+ spa_name(spa),
-+ NSEC2SEC(start - mmp->mmp_last_write));
- zio_suspend(spa, NULL);
- }
-
---
-2.14.2
-
diff --git a/zfs-patches/0015-Fix-systemd_-RPM-macros-usage-on-Debian-based-distri.patch b/zfs-patches/0015-Fix-systemd_-RPM-macros-usage-on-Debian-based-distri.patch
deleted file mode 100644
index f41e862..0000000
--- a/zfs-patches/0015-Fix-systemd_-RPM-macros-usage-on-Debian-based-distri.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: LOLi <***@users.noreply.github.com>
-Date: Fri, 2 Feb 2018 22:50:42 +0100
-Subject: [PATCH] Fix systemd_ RPM macros usage on Debian-based distributions
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Debian-based distributions do not seem to provide RPM macros for
-dealing with systemd pre- and post- (un)install actions: this results
-in errors when installing or upgrading .deb packages because the
-resulting control scripts contain the following unresolved macros:
-
- * %systemd_post
- * %systemd_preun
- * %systemd_postun
-
-Fix this by providing default values for postinstall, preuninstall and
-postuninstall scripts when these macros are not defined.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Signed-off-by: loli10K <***@gmail.com>
-Closes #7074
-Closes #7100
-(cherry picked from commit 29b79dcfe90a67a919c2f42fbaa2e557ea484bd5)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- rpm/generic/zfs.spec.in | 21 ++++++++++++++++++++-
- 1 file changed, 20 insertions(+), 1 deletion(-)
-
-diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
-index 4a911b4c2..ce028794c 100644
---- a/rpm/generic/zfs.spec.in
-+++ b/rpm/generic/zfs.spec.in
-@@ -245,8 +245,15 @@ find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
-
- %post
- %if 0%{?_systemd}
-+%if 0%{?systemd_post:1}
- %systemd_post %{systemd_svcs}
- %else
-+if [ "$1" = "1" -o "$1" = "install" ] ; then
-+ # Initial installation
-+ systemctl preset %{systemd_svcs} >/dev/null || true
-+fi
-+%endif
-+%else
- if [ -x /sbin/chkconfig ]; then
- /sbin/chkconfig --add zfs-import
- /sbin/chkconfig --add zfs-mount
-@@ -258,9 +265,17 @@ exit 0
-
- %preun
- %if 0%{?_systemd}
-+%if 0%{?systemd_preun:1}
- %systemd_preun %{systemd_svcs}
- %else
--if [ "$1" = "0" ] && [ -x /sbin/chkconfig ]; then
-+if [ "$1" = "0" -o "$1" = "remove" ] ; then
-+ # Package removal, not upgrade
-+ systemctl --no-reload disable %{systemd_svcs} >/dev/null || true
-+ systemctl stop %{systemd_svcs} >/dev/null || true
-+fi
-+%endif
-+%else
-+if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then
- /sbin/chkconfig --del zfs-import
- /sbin/chkconfig --del zfs-mount
- /sbin/chkconfig --del zfs-share
-@@ -271,7 +286,11 @@ exit 0
-
- %postun
- %if 0%{?_systemd}
-+%if 0%{?systemd_postun:1}
- %systemd_postun %{systemd_svcs}
-+%else
-+systemctl --system daemon-reload >/dev/null || true
-+%endif
- %endif
-
- %files
---
-2.14.2
-
diff --git a/zfs-patches/0016-Bug-fix-in-qat_compress.c-for-vmalloc-addr-check.patch b/zfs-patches/0016-Bug-fix-in-qat_compress.c-for-vmalloc-addr-check.patch
deleted file mode 100644
index 34feeb1..0000000
--- a/zfs-patches/0016-Bug-fix-in-qat_compress.c-for-vmalloc-addr-check.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: wli5 <***@intel.com>
-Date: Tue, 6 Feb 2018 02:26:27 +0800
-Subject: [PATCH] Bug fix in qat_compress.c for vmalloc addr check
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Remove the unused vmalloc address check, and function mem_to_page
-will handle the non-vmalloc address when map it to a physical
-address.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Weigang Li <***@intel.com>
-Closes #7125
-(cherry picked from commit 5f38142e7b3a8994afef60faa2e65d72e7993807)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/qat_compress.c | 4 ----
- 1 file changed, 4 deletions(-)
-
-diff --git a/module/zfs/qat_compress.c b/module/zfs/qat_compress.c
-index 4d17d7ac9..62655f56d 100644
---- a/module/zfs/qat_compress.c
-+++ b/module/zfs/qat_compress.c
-@@ -364,10 +364,6 @@ qat_compress(qat_compress_dir_t dir, char *src, int src_len,
- Cpa32U dst_buffer_list_mem_size = sizeof (CpaBufferList) +
- (num_dst_buf * sizeof (CpaFlatBuffer));
-
-- if (!is_vmalloc_addr(src) || !is_vmalloc_addr(src + src_len - 1) ||
-- !is_vmalloc_addr(dst) || !is_vmalloc_addr(dst + dst_len - 1))
-- return (-1);
--
- if (PHYS_CONTIG_ALLOC(&in_pages,
- num_src_buf * sizeof (struct page *)) != CPA_STATUS_SUCCESS)
- goto fail;
---
-2.14.2
-
diff --git a/zfs-patches/0017-Fix-default-libdir-for-Debian-Ubuntu.patch b/zfs-patches/0017-Fix-default-libdir-for-Debian-Ubuntu.patch
deleted file mode 100644
index a6dbfd8..0000000
--- a/zfs-patches/0017-Fix-default-libdir-for-Debian-Ubuntu.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Mon, 5 Feb 2018 20:42:52 -0800
-Subject: [PATCH] Fix default libdir for Debian/Ubuntu
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The distribution provided architecture specific RPM macro files
-for x86_64 and other architectures on Debian/Ubuntu specify the
-wrong default libdir install location. When building deb packages
-override _lib with the correct location.
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: loli10K <***@gmail.com>
-Reviewed by: George Melikov <***@gmelikov.ru>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #7083
-Closes #7101
-(cherry picked from commit f1dde3fb20eb27c05b57ad82e0905a587ced8ee8)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- config/zfs-build.m4 | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
-diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
-index 5eaa49c87..7c19cecd6 100644
---- a/config/zfs-build.m4
-+++ b/config/zfs-build.m4
-@@ -164,6 +164,19 @@ AC_DEFUN([ZFS_AC_RPM], [
- RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"'
- RPM_DEFINE_DKMS=
-
-+ dnl # Override default lib directory on Debian/Ubuntu systems. The provided
-+ dnl # /usr/lib/rpm/platform/<arch>/macros files do not specify the correct
-+ dnl # path for multiarch systems as described by the packaging guidelines.
-+ dnl #
-+ dnl # https://wiki.ubuntu.com/MultiarchSpec
-+ dnl # https://wiki.debian.org/Multiarch/Implementation
-+ dnl #
-+ AS_IF([test "$DEFAULT_PACKAGE" = "deb"], [
-+ MULTIARCH_LIBDIR="lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
-+ RPM_DEFINE_UTIL+=' --define "_lib $(MULTIARCH_LIBDIR)"'
-+ AC_SUBST(MULTIARCH_LIBDIR)
-+ ])
-+
- SRPM_DEFINE_COMMON='--define "build_src_rpm 1"'
- SRPM_DEFINE_UTIL=
- SRPM_DEFINE_KMOD=
---
-2.14.2
-
diff --git a/zfs-patches/0018-Remove-deprecated-zfs_arc_p_aggressive_disable.patch b/zfs-patches/0018-Remove-deprecated-zfs_arc_p_aggressive_disable.patch
deleted file mode 100644
index d83d4ab..0000000
--- a/zfs-patches/0018-Remove-deprecated-zfs_arc_p_aggressive_disable.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Richard Elling <***@RichardElling.com>
-Date: Wed, 7 Feb 2018 11:54:20 -0800
-Subject: [PATCH] Remove deprecated zfs_arc_p_aggressive_disable
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-zfs_arc_p_aggressive_disable is no more. This PR removes docs
-and module parameters for zfs_arc_p_aggressive_disable.
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed by: George Melikov <***@gmelikov.ru>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Richard Elling <***@RichardElling.com>
-Closes #7135
-
-(cherry picked from commit a58e1284d8998b0d7e409a6ec009d9d372aad41b)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/arc.c | 4 ----
- man/man5/zfs-module-parameters.5 | 11 -----------
- 2 files changed, 15 deletions(-)
-
-diff --git a/module/zfs/arc.c b/module/zfs/arc.c
-index 264e67735..9d1d0db1d 100644
---- a/module/zfs/arc.c
-+++ b/module/zfs/arc.c
-@@ -391,7 +391,6 @@ unsigned long zfs_arc_dnode_limit_percent = 10;
- */
- unsigned long zfs_arc_sys_free = 0;
- int zfs_arc_min_prefetch_lifespan = 0;
--int zfs_arc_p_aggressive_disable = 1;
- int zfs_arc_p_dampener_disable = 1;
- int zfs_arc_meta_prune = 10000;
- int zfs_arc_meta_strategy = ARC_STRATEGY_META_BALANCED;
-@@ -7928,9 +7927,6 @@ MODULE_PARM_DESC(zfs_arc_meta_strategy, "Meta reclaim strategy");
- module_param(zfs_arc_grow_retry, int, 0644);
- MODULE_PARM_DESC(zfs_arc_grow_retry, "Seconds before growing arc size");
-
--module_param(zfs_arc_p_aggressive_disable, int, 0644);
--MODULE_PARM_DESC(zfs_arc_p_aggressive_disable, "disable aggressive arc_p grow");
--
- module_param(zfs_arc_p_dampener_disable, int, 0644);
- MODULE_PARM_DESC(zfs_arc_p_dampener_disable, "disable arc_p adapt dampener");
-
-diff --git a/man/man5/zfs-module-parameters.5 b/man/man5/zfs-module-parameters.5
-index 19e6becfd..d4daffde6 100644
---- a/man/man5/zfs-module-parameters.5
-+++ b/man/man5/zfs-module-parameters.5
-@@ -674,17 +674,6 @@ max arc_p
- Default value: \fB0\fR.
- .RE
-
--.sp
--.ne 2
--.na
--\fBzfs_arc_p_aggressive_disable\fR (int)
--.ad
--.RS 12n
--Disable aggressive arc_p growth
--.sp
--Use \fB1\fR for yes (default) and \fB0\fR to disable.
--.RE
--
- .sp
- .ne 2
- .na
---
-2.14.2
-
diff --git a/zfs-patches/0019-OpenZFS-8966-Source-file-zfs_acl.c-function-zfs_acls.patch b/zfs-patches/0019-OpenZFS-8966-Source-file-zfs_acl.c-function-zfs_acls.patch
deleted file mode 100644
index fc28cd8..0000000
--- a/zfs-patches/0019-OpenZFS-8966-Source-file-zfs_acl.c-function-zfs_acls.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: WHR <***@gmail.com>
-Date: Sun, 14 Jan 2018 23:57:54 +0300
-Subject: [PATCH] OpenZFS 8966 - Source file zfs_acl.c, function
- zfs_aclset_common contains a use after end of the lifetime of a local
- variable
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Authored by: WHR <***@gmail.com>
-Reviewed by: Matt Ahrens <***@delphix.com>
-Reviewed by: Andriy Gapon <***@FreeBSD.org>
-Reviewed by: George Melikov <***@gmelikov.ru>
-Reviewed by: Brian Behlendorf <***@llnl.gov>
-Approved by: Richard Lowe <***@richlowe.net>
-Ported-by: Giuseppe Di Natale <***@llnl.gov>
-
-OpenZFS-issue: https://www.illumos.org/issues/8966
-OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c95549fcdc
-Closes #7141
-
-(cherry picked from commit a196b3bc3dcc14bda32b2fbed40d5e436319aca6)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/zfs_acl.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/module/zfs/zfs_acl.c b/module/zfs/zfs_acl.c
-index 7ddedeaaf..1fcfca0c7 100644
---- a/module/zfs/zfs_acl.c
-+++ b/module/zfs/zfs_acl.c
-@@ -1323,6 +1323,7 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx)
- sa_bulk_attr_t bulk[5];
- uint64_t ctime[2];
- int count = 0;
-+ zfs_acl_phys_t acl_phys;
-
- mode = zp->z_mode;
-
-@@ -1369,7 +1370,6 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx)
- } else { /* Painful legacy way */
- zfs_acl_node_t *aclnode;
- uint64_t off = 0;
-- zfs_acl_phys_t acl_phys;
- uint64_t aoid;
-
- if ((error = sa_lookup(zp->z_sa_hdl, SA_ZPL_ZNODE_ACL(zfsvfs),
---
-2.14.2
-
diff --git a/zfs-patches/0020-Linux-4.16-compat-inode_set_iversion.patch b/zfs-patches/0020-Linux-4.16-compat-inode_set_iversion.patch
deleted file mode 100644
index b73965d..0000000
--- a/zfs-patches/0020-Linux-4.16-compat-inode_set_iversion.patch
+++ /dev/null
@@ -1,145 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Thu, 8 Feb 2018 14:27:59 -0800
-Subject: [PATCH] Linux 4.16 compat: inode_set_iversion()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-A new interface was added to manipulate the version field of an
-inode. Add a inode_set_iversion() wrapper for older kernels and
-use the new interface when available.
-
-The i_version field was dropped from the trace point due to the
-switch to an atomic64_t i_version type.
-
-Reviewed-by: Olaf Faaland <***@llnl.gov>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Chunwei Chen <***@nutanix.com>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #7148
-(cherry picked from commit 310e63dfd18f59ad583631dfa2f55d40cedf1415)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/linux/vfs_compat.h | 14 ++++++++++++++
- include/sys/trace_acl.h | 6 ++----
- module/zfs/zpl_super.c | 2 +-
- config/kernel-inode-set-iversion.m4 | 19 +++++++++++++++++++
- config/kernel.m4 | 1 +
- 5 files changed, 37 insertions(+), 5 deletions(-)
- create mode 100644 config/kernel-inode-set-iversion.m4
-
-diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h
-index 6111f0afc..f51ff887d 100644
---- a/include/linux/vfs_compat.h
-+++ b/include/linux/vfs_compat.h
-@@ -578,4 +578,18 @@ current_time(struct inode *ip)
- }
- #endif
-
-+/*
-+ * 4.16 API change
-+ * Added iversion interface for managing inode version field.
-+ */
-+#ifdef HAVE_INODE_SET_IVERSION
-+#include <linux/iversion.h>
-+#else
-+static inline void
-+inode_set_iversion(struct inode *ip, u64 val)
-+{
-+ ip->i_version = val;
-+}
-+#endif
-+
- #endif /* _ZFS_VFS_H */
-diff --git a/include/sys/trace_acl.h b/include/sys/trace_acl.h
-index 1057e560b..610bbe29c 100644
---- a/include/sys/trace_acl.h
-+++ b/include/sys/trace_acl.h
-@@ -68,7 +68,6 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
- __field(uint32_t, i_gid)
- __field(unsigned long, i_ino)
- __field(unsigned int, i_nlink)
-- __field(u64, i_version)
- __field(loff_t, i_size)
- __field(unsigned int, i_blkbits)
- __field(unsigned short, i_bytes)
-@@ -103,7 +102,6 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
- __entry->i_gid = KGID_TO_SGID(ZTOI(zn)->i_gid);
- __entry->i_ino = zn->z_inode.i_ino;
- __entry->i_nlink = zn->z_inode.i_nlink;
-- __entry->i_version = zn->z_inode.i_version;
- __entry->i_size = zn->z_inode.i_size;
- __entry->i_blkbits = zn->z_inode.i_blkbits;
- __entry->i_bytes = zn->z_inode.i_bytes;
-@@ -121,7 +119,7 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
- "mapcnt %llu size %llu pflags %llu "
- "sync_cnt %u mode 0x%x is_sa %d "
- "is_mapped %d is_ctldir %d is_stale %d inode { "
-- "uid %u gid %u ino %lu nlink %u version %llu size %lli "
-+ "uid %u gid %u ino %lu nlink %u size %lli "
- "blkbits %u bytes %u mode 0x%x generation %x } } "
- "ace { type %u flags %u access_mask %u } mask_matched %u",
- __entry->z_id, __entry->z_unlinked, __entry->z_atime_dirty,
-@@ -131,7 +129,7 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
- __entry->z_is_sa, __entry->z_is_mapped,
- __entry->z_is_ctldir, __entry->z_is_stale, __entry->i_uid,
- __entry->i_gid, __entry->i_ino, __entry->i_nlink,
-- __entry->i_version, __entry->i_size, __entry->i_blkbits,
-+ __entry->i_size, __entry->i_blkbits,
- __entry->i_bytes, __entry->i_mode, __entry->i_generation,
- __entry->z_type, __entry->z_flags, __entry->z_access_mask,
- __entry->mask_matched)
-diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c
-index b6ef60277..25e75a897 100644
---- a/module/zfs/zpl_super.c
-+++ b/module/zfs/zpl_super.c
-@@ -36,7 +36,7 @@ zpl_inode_alloc(struct super_block *sb)
- struct inode *ip;
-
- VERIFY3S(zfs_inode_alloc(sb, &ip), ==, 0);
-- ip->i_version = 1;
-+ inode_set_iversion(ip, 1);
-
- return (ip);
- }
-diff --git a/config/kernel-inode-set-iversion.m4 b/config/kernel-inode-set-iversion.m4
-new file mode 100644
-index 000000000..9a7d7890e
---- /dev/null
-+++ b/config/kernel-inode-set-iversion.m4
-@@ -0,0 +1,19 @@
-+dnl #
-+dnl # 4.16 API change
-+dnl # inode_set_iversion introduced to set i_version
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_IVERSION], [
-+ AC_MSG_CHECKING([whether inode_set_iversion() exists])
-+ ZFS_LINUX_TRY_COMPILE([
-+ #include <linux/iversion.h>
-+ ],[
-+ struct inode inode;
-+ inode_set_iversion(&inode, 1);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_INODE_SET_IVERSION, 1,
-+ [inode_set_iversion() exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index b759ccd39..b83f021e8 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -65,6 +65,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
- ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
- ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR
- ZFS_AC_KERNEL_INODE_SET_FLAGS
-+ ZFS_AC_KERNEL_INODE_SET_IVERSION
- ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
- ZFS_AC_KERNEL_SHOW_OPTIONS
- ZFS_AC_KERNEL_FILE_INODE
---
-2.14.2
-
diff --git a/zfs-patches/0021-Linux-4.11-compat-avoid-refcount_t-name-conflict.patch b/zfs-patches/0021-Linux-4.11-compat-avoid-refcount_t-name-conflict.patch
deleted file mode 100644
index a1ee0c1..0000000
--- a/zfs-patches/0021-Linux-4.11-compat-avoid-refcount_t-name-conflict.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Thu, 8 Feb 2018 14:31:08 -0800
-Subject: [PATCH] Linux 4.11 compat: avoid refcount_t name conflict
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Related to commit 4859fe796, when directly using the kernel's
-refcount functions in kernel compatibility code do not map
-refcount_t to zfs_refcount_t. This leads to a type mismatch.
-
-Longer term we should consider renaming refcount_t to
-zfs_refcount_t in the zfs code base.
-
-Reviewed-by: Olaf Faaland <***@llnl.gov>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Chunwei Chen <***@nutanix.com>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #7148
-(cherry picked from commit 3713b7333532f221733f7b74189d996359ed4311)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/linux/vfs_compat.h | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h
-index f51ff887d..7fcf3c055 100644
---- a/include/linux/vfs_compat.h
-+++ b/include/linux/vfs_compat.h
-@@ -272,6 +272,10 @@ lseek_execute(
- * This is several orders of magnitude larger than expected grace period.
- * At 60 seconds the kernel will also begin issuing RCU stall warnings.
- */
-+#ifdef refcount_t
-+#undef refcount_t
-+#endif
-+
- #include <linux/posix_acl.h>
-
- #if defined(HAVE_POSIX_ACL_RELEASE) && !defined(HAVE_POSIX_ACL_RELEASE_GPL_ONLY)
-@@ -397,6 +401,8 @@ typedef mode_t zpl_equivmode_t;
- #define zpl_posix_acl_valid(ip, acl) posix_acl_valid(acl)
- #endif
-
-+#define refcount_t zfs_refcount_t
-+
- #endif /* CONFIG_FS_POSIX_ACL */
-
- /*
---
-2.14.2
-
diff --git a/zfs-patches/0022-Fix-zdb-c-traverse-stop-on-damaged-objset-root.patch b/zfs-patches/0022-Fix-zdb-c-traverse-stop-on-damaged-objset-root.patch
deleted file mode 100644
index 7904043..0000000
--- a/zfs-patches/0022-Fix-zdb-c-traverse-stop-on-damaged-objset-root.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Chunwei Chen <***@nutanix.com>
-Date: Tue, 30 Jan 2018 13:39:11 -0800
-Subject: [PATCH] Fix zdb -c traverse stop on damaged objset root
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-If a corruption happens to be on a root block of an objset, zdb -c will
-not correctly report the error, and it will not traverse the datasets
-that come after. This is because traverse_visitbp, which does the
-callback and reset error for TRAVERSE_HARD, is skipped when traversing
-zil is failed in traverse_impl.
-
-Here's example of what 'zdb -eLcc' command looks like on a pool with
-damaged objset root:
-
-== before patch:
-
-Traversing all blocks to verify checksums ...
-
-Error counts:
-
- errno count
-block traversal size 379392 != alloc 33987072 (unreachable 33607680)
-
- bp count: 172
- ganged count: 0
- bp logical: 1678336 avg: 9757
- bp physical: 130560 avg: 759 compression: 12.85
- bp allocated: 379392 avg: 2205 compression: 4.42
- bp deduped: 0 ref>1: 0 deduplication: 1.00
- SPA allocated: 33987072 used: 0.80%
-
- additional, non-pointer bps of type 0: 71
- Dittoed blocks on same vdev: 101
-
-== after patch:
-
-Traversing all blocks to verify checksums ...
-
-zdb_blkptr_cb: Got error 52 reading <54, 0, -1, 0> -- skipping
-
-Error counts:
-
- errno count
- 52 1
-block traversal size 33963520 != alloc 33987072 (unreachable 23552)
-
- bp count: 447
- ganged count: 0
- bp logical: 36093440 avg: 80745
- bp physical: 33699840 avg: 75391 compression: 1.07
- bp allocated: 33963520 avg: 75981 compression: 1.06
- bp deduped: 0 ref>1: 0 deduplication: 1.00
- SPA allocated: 33987072 used: 0.80%
-
- additional, non-pointer bps of type 0: 76
- Dittoed blocks on same vdev: 115
-
-==
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: loli10K <***@gmail.com>
-Signed-off-by: Chunwei Chen <***@nutanix.com>
-Closes #7099
-(cherry picked from commit 23227313a2016449176cbfcbae2d4fc463a2bc09)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/dmu_traverse.c | 26 +++++++++++++++++---------
- 1 file changed, 17 insertions(+), 9 deletions(-)
-
-diff --git a/module/zfs/dmu_traverse.c b/module/zfs/dmu_traverse.c
-index c78228d74..b494bef35 100644
---- a/module/zfs/dmu_traverse.c
-+++ b/module/zfs/dmu_traverse.c
-@@ -599,19 +599,27 @@ traverse_impl(spa_t *spa, dsl_dataset_t *ds, uint64_t objset, blkptr_t *rootbp,
-
- /* See comment on ZIL traversal in dsl_scan_visitds. */
- if (ds != NULL && !ds->ds_is_snapshot && !BP_IS_HOLE(rootbp)) {
-+ enum zio_flag zio_flags = ZIO_FLAG_CANFAIL;
- uint32_t flags = ARC_FLAG_WAIT;
- objset_phys_t *osp;
- arc_buf_t *buf;
-
-- err = arc_read(NULL, td->td_spa, rootbp,
-- arc_getbuf_func, &buf,
-- ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, czb);
-- if (err != 0)
-- return (err);
--
-- osp = buf->b_data;
-- traverse_zil(td, &osp->os_zil_header);
-- arc_buf_destroy(buf, &buf);
-+ err = arc_read(NULL, td->td_spa, rootbp, arc_getbuf_func,
-+ &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, czb);
-+ if (err != 0) {
-+ /*
-+ * If both TRAVERSE_HARD and TRAVERSE_PRE are set,
-+ * continue to visitbp so that td_func can be called
-+ * in pre stage, and err will reset to zero.
-+ */
-+ if (!(td->td_flags & TRAVERSE_HARD) ||
-+ !(td->td_flags & TRAVERSE_PRE))
-+ return (err);
-+ } else {
-+ osp = buf->b_data;
-+ traverse_zil(td, &osp->os_zil_header);
-+ arc_buf_destroy(buf, &buf);
-+ }
- }
-
- if (!(flags & TRAVERSE_PREFETCH_DATA) ||
---
-2.14.2
-
diff --git a/zfs-patches/0023-Fix-zle_decompress-out-of-bound-access.patch b/zfs-patches/0023-Fix-zle_decompress-out-of-bound-access.patch
deleted file mode 100644
index 5345806..0000000
--- a/zfs-patches/0023-Fix-zle_decompress-out-of-bound-access.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Chunwei Chen <***@nutanix.com>
-Date: Thu, 1 Feb 2018 15:41:05 -0800
-Subject: [PATCH] Fix zle_decompress out of bound access
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: loli10K <***@gmail.com>
-Signed-off-by: Chunwei Chen <***@nutanix.com>
-Closes #7099
-(cherry picked from commit 5e566c57726226ceeca09b1eb19cb1c373622763)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/zle.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/module/zfs/zle.c b/module/zfs/zle.c
-index 13c5673fb..613607faa 100644
---- a/module/zfs/zle.c
-+++ b/module/zfs/zle.c
-@@ -74,10 +74,14 @@ zle_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
- while (src < s_end && dst < d_end) {
- int len = 1 + *src++;
- if (len <= n) {
-+ if (src + len > s_end || dst + len > d_end)
-+ return (-1);
- while (len-- != 0)
- *dst++ = *src++;
- } else {
- len -= n;
-+ if (dst + len > d_end)
-+ return (-1);
- while (len-- != 0)
- *dst++ = 0;
- }
---
-2.14.2
-
diff --git a/zfs-patches/0024-Fix-racy-assignment-of-zcb.zcb_haderrors.patch b/zfs-patches/0024-Fix-racy-assignment-of-zcb.zcb_haderrors.patch
deleted file mode 100644
index ff489a3..0000000
--- a/zfs-patches/0024-Fix-racy-assignment-of-zcb.zcb_haderrors.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Chunwei Chen <***@nutanix.com>
-Date: Thu, 1 Feb 2018 15:42:41 -0800
-Subject: [PATCH] Fix racy assignment of zcb.zcb_haderrors
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-zcb_haderrors will be modified in zdb_blkptr_done, which is
-asynchronous. So we must move this assignment after zio_wait.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: loli10K <***@gmail.com>
-Signed-off-by: Chunwei Chen <***@nutanix.com>
-Closes #7099
-(cherry picked from commit c797f0898ec11669427e2fc481118bc2e2d8ef3f)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/zdb/zdb.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
-index 442685486..0cc1656a8 100644
---- a/cmd/zdb/zdb.c
-+++ b/cmd/zdb/zdb.c
-@@ -3313,7 +3313,7 @@ dump_block_stats(spa_t *spa)
- uint64_t norm_alloc, norm_space, total_alloc, total_found;
- int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD;
- boolean_t leaks = B_FALSE;
-- int e, c;
-+ int e, c, err;
- bp_embedded_type_t i;
-
- (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n",
-@@ -3354,7 +3354,7 @@ dump_block_stats(spa_t *spa)
-
- zcb.zcb_totalasize = metaslab_class_get_alloc(spa_normal_class(spa));
- zcb.zcb_start = zcb.zcb_lastprint = gethrtime();
-- zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb);
-+ err = traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb);
-
- /*
- * If we've traversed the data blocks then we need to wait for those
-@@ -3370,6 +3370,12 @@ dump_block_stats(spa_t *spa)
- }
- }
-
-+ /*
-+ * Done after zio_wait() since zcb_haderrors is modified in
-+ * zdb_blkptr_done()
-+ */
-+ zcb.zcb_haderrors |= err;
-+
- if (zcb.zcb_haderrors) {
- (void) printf("\nError counts:\n\n");
- (void) printf("\t%5s %s\n", "errno", "count");
---
-2.14.2
-
diff --git a/zfs-patches/0025-Fix-zdb-R-decompression.patch b/zfs-patches/0025-Fix-zdb-R-decompression.patch
deleted file mode 100644
index 3b1f895..0000000
--- a/zfs-patches/0025-Fix-zdb-R-decompression.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Chunwei Chen <***@nutanix.com>
-Date: Thu, 1 Feb 2018 16:19:36 -0800
-Subject: [PATCH] Fix zdb -R decompression
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-There are some issues in the zdb -R decompression implementation.
-
-The first is that ZLE can easily decompress non-ZLE streams. So we add
-ZDB_NO_ZLE env to make zdb skip ZLE.
-
-The second is the random bytes appended to pabd, pbuf2 stuff. This serve
-no purpose at all, those bytes shouldn't be read during decompression
-anyway. Instead, we randomize lbuf2, so that we can make sure
-decompression fill exactly to lsize by bcmp lbuf and lbuf2.
-
-The last one is the condition to detect fail is wrong.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: loli10K <***@gmail.com>
-Signed-off-by: Chunwei Chen <***@nutanix.com>
-Closes #7099
-Closes #4984
-(cherry picked from commit 18c662b84566cd34e6f6fb982d6a01a415a4e3cd)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/zdb/zdb.c | 38 ++++++++++++++++++--------------------
- man/man8/zdb.8 | 4 +++-
- 2 files changed, 21 insertions(+), 21 deletions(-)
-
-diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
-index 0cc1656a8..2d80589ca 100644
---- a/cmd/zdb/zdb.c
-+++ b/cmd/zdb/zdb.c
-@@ -3895,13 +3895,6 @@ name:
- return (NULL);
- }
-
--/* ARGSUSED */
--static int
--random_get_pseudo_bytes_cb(void *buf, size_t len, void *unused)
--{
-- return (random_get_pseudo_bytes(buf, len));
--}
--
- /*
- * Read a block from a pool and print it out. The syntax of the
- * block descriptor is:
-@@ -4064,17 +4057,8 @@ zdb_read_block(char *thing, spa_t *spa)
- * every decompress function at every inflated blocksize.
- */
- enum zio_compress c;
-- void *pbuf2 = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
- void *lbuf2 = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
-
-- abd_copy_to_buf(pbuf2, pabd, psize);
--
-- VERIFY0(abd_iterate_func(pabd, psize, SPA_MAXBLOCKSIZE - psize,
-- random_get_pseudo_bytes_cb, NULL));
--
-- VERIFY0(random_get_pseudo_bytes((uint8_t *)pbuf2 + psize,
-- SPA_MAXBLOCKSIZE - psize));
--
- /*
- * XXX - On the one hand, with SPA_MAXBLOCKSIZE at 16MB,
- * this could take a while and we should let the user know
-@@ -4084,13 +4068,29 @@ zdb_read_block(char *thing, spa_t *spa)
- for (lsize = psize + SPA_MINBLOCKSIZE;
- lsize <= SPA_MAXBLOCKSIZE; lsize += SPA_MINBLOCKSIZE) {
- for (c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++) {
-+ /*
-+ * ZLE can easily decompress non zle stream.
-+ * So have an option to disable it.
-+ */
-+ if (c == ZIO_COMPRESS_ZLE &&
-+ getenv("ZDB_NO_ZLE"))
-+ continue;
-+
- (void) fprintf(stderr,
- "Trying %05llx -> %05llx (%s)\n",
- (u_longlong_t)psize, (u_longlong_t)lsize,
- zio_compress_table[c].ci_name);
-+
-+ /*
-+ * We randomize lbuf2, and decompress to both
-+ * lbuf and lbuf2. This way, we will know if
-+ * decompression fill exactly to lsize.
-+ */
-+ VERIFY0(random_get_pseudo_bytes(lbuf2, lsize));
-+
- if (zio_decompress_data(c, pabd,
- lbuf, psize, lsize) == 0 &&
-- zio_decompress_data_buf(c, pbuf2,
-+ zio_decompress_data(c, pabd,
- lbuf2, psize, lsize) == 0 &&
- bcmp(lbuf, lbuf2, lsize) == 0)
- break;
-@@ -4098,11 +4098,9 @@ zdb_read_block(char *thing, spa_t *spa)
- if (c != ZIO_COMPRESS_FUNCTIONS)
- break;
- }
--
-- umem_free(pbuf2, SPA_MAXBLOCKSIZE);
- umem_free(lbuf2, SPA_MAXBLOCKSIZE);
-
-- if (lsize <= psize) {
-+ if (lsize > SPA_MAXBLOCKSIZE) {
- (void) printf("Decompress of %s failed\n", thing);
- goto out;
- }
-diff --git a/man/man8/zdb.8 b/man/man8/zdb.8
-index 4e47de7be..d991aae4c 100644
---- a/man/man8/zdb.8
-+++ b/man/man8/zdb.8
-@@ -246,7 +246,9 @@ and, optionally,
- .It Sy b Ar offset
- Print block pointer
- .It Sy d
--Decompress the block
-+Decompress the block. Set environment variable
-+.Nm ZBD_NO_ZLE
-+to skip zle when guessing.
- .It Sy e
- Byte swap the block
- .It Sy g
---
-2.14.2
-
diff --git a/zfs-patches/0026-Fix-zdb-E-segfault.patch b/zfs-patches/0026-Fix-zdb-E-segfault.patch
deleted file mode 100644
index ef0d242..0000000
--- a/zfs-patches/0026-Fix-zdb-E-segfault.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Chunwei Chen <***@nutanix.com>
-Date: Thu, 1 Feb 2018 16:28:11 -0800
-Subject: [PATCH] Fix zdb -E segfault
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-SPA_MAXBLOCKSIZE is too large for stack.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: loli10K <***@gmail.com>
-Signed-off-by: Chunwei Chen <***@nutanix.com>
-Closes #7099
-(cherry picked from commit 31ff122aa2e20c7ed48617868085ddba7b4ad174)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/zdb/zdb.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
-index 2d80589ca..90847d8d9 100644
---- a/cmd/zdb/zdb.c
-+++ b/cmd/zdb/zdb.c
-@@ -4139,11 +4139,12 @@ zdb_embedded_block(char *thing)
- {
- blkptr_t bp;
- unsigned long long *words = (void *)&bp;
-- char buf[SPA_MAXBLOCKSIZE];
-+ char *buf;
- int err;
-
-- memset(&bp, 0, sizeof (blkptr_t));
-+ buf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
-
-+ bzero(&bp, sizeof (bp));
- err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:"
- "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx",
- words + 0, words + 1, words + 2, words + 3,
-@@ -4161,6 +4162,7 @@ zdb_embedded_block(char *thing)
- exit(1);
- }
- zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0);
-+ umem_free(buf, SPA_MAXBLOCKSIZE);
- }
-
- int
---
-2.14.2
-
diff --git a/zfs-patches/0027-Fix-zdb-ed-on-objset-for-exported-pool.patch b/zfs-patches/0027-Fix-zdb-ed-on-objset-for-exported-pool.patch
deleted file mode 100644
index e5edcd1..0000000
--- a/zfs-patches/0027-Fix-zdb-ed-on-objset-for-exported-pool.patch
+++ /dev/null
@@ -1,217 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Chunwei Chen <***@nutanix.com>
-Date: Thu, 1 Feb 2018 16:36:40 -0800
-Subject: [PATCH] Fix zdb -ed on objset for exported pool
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-zdb -ed on objset for exported pool would failed with:
- failed to own dataset 'qq/fs0': No such file or directory
-
-The reason is that zdb pass objset name to spa_import, it uses that
-name to create a spa. Later, when dmu_objset_own tries to lookup the spa
-using real pool name, it can't find one.
-
-We fix this by make sure we pass pool name rather than objset name to
-spa_import.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: loli10K <***@gmail.com>
-Signed-off-by: Chunwei Chen <***@nutanix.com>
-Closes #7099
-Closes #6464
-(cherry picked from commit 478754a8f5ff0f3b9f6dfe4ce272efc1681d243e)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- .../tests/functional/cli_root/zdb/Makefile.am | 3 +-
- cmd/zdb/zdb.c | 32 +++++++----
- tests/runfiles/linux.run | 2 +-
- .../tests/functional/clean_mirror/cleanup.ksh | 4 +-
- .../tests/functional/cli_root/zdb/zdb_006_pos.ksh | 64 ++++++++++++++++++++++
- 5 files changed, 90 insertions(+), 15 deletions(-)
- create mode 100755 tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh
-
-diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am
-index 51170fbc8..d37bcf607 100644
---- a/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am
-+++ b/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am
-@@ -4,4 +4,5 @@ dist_pkgdata_SCRIPTS = \
- zdb_002_pos.ksh \
- zdb_003_pos.ksh \
- zdb_004_pos.ksh \
-- zdb_005_pos.ksh
-+ zdb_005_pos.ksh \
-+ zdb_006_pos.ksh
-diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
-index 90847d8d9..17a0ae251 100644
---- a/cmd/zdb/zdb.c
-+++ b/cmd/zdb/zdb.c
-@@ -4177,7 +4177,7 @@ main(int argc, char **argv)
- int error = 0;
- char **searchdirs = NULL;
- int nsearch = 0;
-- char *target;
-+ char *target, *target_pool;
- nvlist_t *policy = NULL;
- uint64_t max_txg = UINT64_MAX;
- int flags = ZFS_IMPORT_MISSING_LOG;
-@@ -4380,6 +4380,20 @@ main(int argc, char **argv)
- error = 0;
- target = argv[0];
-
-+ if (strpbrk(target, "/@") != NULL) {
-+ size_t targetlen;
-+
-+ target_pool = strdup(target);
-+ *strpbrk(target_pool, "/@") = '\0';
-+
-+ target_is_spa = B_FALSE;
-+ targetlen = strlen(target);
-+ if (targetlen && target[targetlen - 1] == '/')
-+ target[targetlen - 1] = '\0';
-+ } else {
-+ target_pool = target;
-+ }
-+
- if (dump_opt['e']) {
- importargs_t args = { 0 };
- nvlist_t *cfg = NULL;
-@@ -4388,8 +4402,10 @@ main(int argc, char **argv)
- args.path = searchdirs;
- args.can_be_active = B_TRUE;
-
-- error = zpool_tryimport(g_zfs, target, &cfg, &args);
-+ error = zpool_tryimport(g_zfs, target_pool, &cfg, &args);
-+
- if (error == 0) {
-+
- if (nvlist_add_nvlist(cfg,
- ZPOOL_REWIND_POLICY, policy) != 0) {
- fatal("can't open '%s': %s",
-@@ -4404,19 +4420,13 @@ main(int argc, char **argv)
- (void) printf("\nConfiguration for import:\n");
- dump_nvlist(cfg, 8);
- }
-- error = spa_import(target, cfg, NULL,
-+ error = spa_import(target_pool, cfg, NULL,
- flags | ZFS_IMPORT_SKIP_MMP);
- }
- }
-
-- if (strpbrk(target, "/@") != NULL) {
-- size_t targetlen;
--
-- target_is_spa = B_FALSE;
-- targetlen = strlen(target);
-- if (targetlen && target[targetlen - 1] == '/')
-- target[targetlen - 1] = '\0';
-- }
-+ if (target_pool != target)
-+ free(target_pool);
-
- if (error == 0) {
- if (target_is_spa || dump_opt['R']) {
-diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
-index 303c27529..ea2dbb282 100644
---- a/tests/runfiles/linux.run
-+++ b/tests/runfiles/linux.run
-@@ -73,7 +73,7 @@ tags = ['functional', 'clean_mirror']
-
- [tests/functional/cli_root/zdb]
- tests = ['zdb_001_neg', 'zdb_002_pos', 'zdb_003_pos', 'zdb_004_pos',
-- 'zdb_005_pos']
-+ 'zdb_005_pos', 'zdb_006_pos']
- pre =
- post =
- tags = ['functional', 'cli_root', 'zdb']
-diff --git a/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh b/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh
-index ac3bfbca8..fb0db312e 100755
---- a/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh
-+++ b/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh
-@@ -38,10 +38,10 @@ df -F zfs -h | grep "$TESTFS " >/dev/null
- [[ $? == 0 ]] && log_must zfs umount -f $TESTDIR
- destroy_pool $TESTPOOL
-
--if is_mpath_device $MIRROR_PRIMARY; then
-+if ( is_mpath_device $MIRROR_PRIMARY || is_loop_device $MIRROR_SECONDARY); then
- parted $DEV_DSKDIR/$MIRROR_PRIMARY -s rm 1
- fi
--if is_mpath_device $MIRROR_SECONDARY; then
-+if ( is_mpath_device $MIRROR_SECONDARY || is_loop_device $MIRROR_SECONDARY); then
- parted $DEV_DSKDIR/$MIRROR_SECONDARY -s rm 1
- fi
- # recreate and destroy a zpool over the disks to restore the partitions to
-diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh
-new file mode 100755
-index 000000000..97b00e9e1
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh
-@@ -0,0 +1,64 @@
-+#!/bin/ksh
-+
-+#
-+# This file and its contents are supplied under the terms of the
-+# Common Development and Distribution License ("CDDL"), version 1.0.
-+# You may only use this file in accordance with the terms of version
-+# 1.0 of the CDDL.
-+#
-+# A full copy of the text of the CDDL should have accompanied this
-+# source. A copy of the CDDL is also available via the Internet at
-+# http://www.illumos.org/license/CDDL.
-+#
-+
-+#
-+# Copyright (c) 2018 by Nutanix. All rights reserved.
-+#
-+
-+. $STF_SUITE/include/libtest.shlib
-+
-+#
-+# Description:
-+# zdb -d will work on imported/exported pool with pool/dataset argument
-+#
-+# Strategy:
-+# 1. Create a pool
-+# 2. Run zdb -d with pool and dataset arguments.
-+# 3. Export the pool
-+# 4. Run zdb -ed with pool and dataset arguments.
-+#
-+
-+function cleanup
-+{
-+ datasetexists $TESTPOOL && destroy_pool $TESTPOOL
-+ for DISK in $DISKS; do
-+ zpool labelclear -f $DEV_RDSKDIR/$DISK
-+ done
-+}
-+
-+log_assert "Verify zdb -d works on imported/exported pool with pool/dataset argument"
-+log_onexit cleanup
-+
-+verify_runnable "global"
-+verify_disk_count "$DISKS" 2
-+
-+default_mirror_setup_noexit $DISKS
-+log_must zfs snap $TESTPOOL/$***@snap
-+
-+log_must zdb -d $TESTPOOL
-+log_must zdb -d $TESTPOOL/
-+log_must zdb -d $TESTPOOL/$TESTFS
-+log_must zdb -d $TESTPOOL/$***@snap
-+
-+log_must zpool export $TESTPOOL
-+
-+log_must zdb -ed $TESTPOOL
-+log_must zdb -ed $TESTPOOL/
-+log_must zdb -ed $TESTPOOL/$TESTFS
-+log_must zdb -ed $TESTPOOL/$***@snap
-+
-+log_must zpool import $TESTPOOL
-+
-+cleanup
-+
-+log_pass "zdb -d works on imported/exported pool with pool/dataset argument"
---
-2.14.2
-
diff --git a/zfs-patches/0028-Handle-zap_add-failures-in-mixed-case-mode.patch b/zfs-patches/0028-Handle-zap_add-failures-in-mixed-case-mode.patch
deleted file mode 100644
index 94d0ca1..0000000
--- a/zfs-patches/0028-Handle-zap_add-failures-in-mixed-case-mode.patch
+++ /dev/null
@@ -1,553 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: sanjeevbagewadi <***@gmail.com>
-Date: Fri, 9 Feb 2018 23:45:53 +0530
-Subject: [PATCH] Handle zap_add() failures in mixed case mode
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-With "casesensitivity=mixed", zap_add() could fail when the number of
-files/directories with the same name (varying in case) exceed the
-capacity of the leaf node of a Fatzap. This results in a ASSERT()
-failure as zfs_link_create() does not expect zap_add() to fail. The fix
-is to handle these failures and rollback the transactions.
-
-Reviewed by: Matt Ahrens <***@delphix.com>
-Reviewed-by: Chunwei Chen <***@nutanix.com>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Sanjeev Bagewadi <***@gmail.com>
-Closes #7011
-Closes #7054
-(cherry picked from commit b3da003ebfad673bb4ada35f87a18a1ef175e95d)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- .../tests/functional/casenorm/Makefile.am | 1 +
- include/sys/zap_leaf.h | 15 ++-
- module/zfs/zap.c | 25 +++-
- module/zfs/zap_leaf.c | 2 +-
- module/zfs/zap_micro.c | 38 +++++-
- module/zfs/zfs_dir.c | 29 ++++-
- module/zfs/zfs_vnops.c | 73 ++++++++---
- tests/runfiles/linux.run | 2 +-
- .../functional/casenorm/mixed_create_failure.ksh | 136 +++++++++++++++++++++
- 9 files changed, 289 insertions(+), 32 deletions(-)
- create mode 100755 tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
-
-diff --git a/tests/zfs-tests/tests/functional/casenorm/Makefile.am b/tests/zfs-tests/tests/functional/casenorm/Makefile.am
-index 00a19c7ff..00cb59074 100644
---- a/tests/zfs-tests/tests/functional/casenorm/Makefile.am
-+++ b/tests/zfs-tests/tests/functional/casenorm/Makefile.am
-@@ -9,6 +9,7 @@ dist_pkgdata_SCRIPTS = \
- insensitive_formd_lookup.ksh \
- insensitive_none_delete.ksh \
- insensitive_none_lookup.ksh \
-+ mixed_create_failure.ksh \
- mixed_formd_delete.ksh \
- mixed_formd_lookup_ci.ksh \
- mixed_formd_lookup.ksh \
-diff --git a/include/sys/zap_leaf.h b/include/sys/zap_leaf.h
-index e784c5963..a3da1036a 100644
---- a/include/sys/zap_leaf.h
-+++ b/include/sys/zap_leaf.h
-@@ -46,10 +46,15 @@ struct zap_stats;
- * block size (1<<l->l_bs) - hash entry size (2) * number of hash
- * entries - header space (2*chunksize)
- */
--#define ZAP_LEAF_NUMCHUNKS(l) \
-- (((1<<(l)->l_bs) - 2*ZAP_LEAF_HASH_NUMENTRIES(l)) / \
-+#define ZAP_LEAF_NUMCHUNKS_BS(bs) \
-+ (((1<<(bs)) - 2*ZAP_LEAF_HASH_NUMENTRIES_BS(bs)) / \
- ZAP_LEAF_CHUNKSIZE - 2)
-
-+#define ZAP_LEAF_NUMCHUNKS(l) (ZAP_LEAF_NUMCHUNKS_BS(((l)->l_bs)))
-+
-+#define ZAP_LEAF_NUMCHUNKS_DEF \
-+ (ZAP_LEAF_NUMCHUNKS_BS(fzap_default_block_shift))
-+
- /*
- * The amount of space within the chunk available for the array is:
- * chunk size - space for type (1) - space for next pointer (2)
-@@ -74,8 +79,10 @@ struct zap_stats;
- * which is less than block size / CHUNKSIZE (24) / minimum number of
- * chunks per entry (3).
- */
--#define ZAP_LEAF_HASH_SHIFT(l) ((l)->l_bs - 5)
--#define ZAP_LEAF_HASH_NUMENTRIES(l) (1 << ZAP_LEAF_HASH_SHIFT(l))
-+#define ZAP_LEAF_HASH_SHIFT_BS(bs) ((bs) - 5)
-+#define ZAP_LEAF_HASH_NUMENTRIES_BS(bs) (1 << ZAP_LEAF_HASH_SHIFT_BS(bs))
-+#define ZAP_LEAF_HASH_SHIFT(l) (ZAP_LEAF_HASH_SHIFT_BS(((l)->l_bs)))
-+#define ZAP_LEAF_HASH_NUMENTRIES(l) (ZAP_LEAF_HASH_NUMENTRIES_BS(((l)->l_bs)))
-
- /*
- * The chunks start immediately after the hash table. The end of the
-diff --git a/module/zfs/zap.c b/module/zfs/zap.c
-index ee9962bff..9843d8c50 100644
---- a/module/zfs/zap.c
-+++ b/module/zfs/zap.c
-@@ -819,15 +819,19 @@ fzap_lookup(zap_name_t *zn,
- return (err);
- }
-
-+#define MAX_EXPAND_RETRIES 2
-+
- int
- fzap_add_cd(zap_name_t *zn,
- uint64_t integer_size, uint64_t num_integers,
- const void *val, uint32_t cd, void *tag, dmu_tx_t *tx)
- {
- zap_leaf_t *l;
-+ zap_leaf_t *prev_l = NULL;
- int err;
- zap_entry_handle_t zeh;
- zap_t *zap = zn->zn_zap;
-+ int expand_retries = 0;
-
- ASSERT(RW_LOCK_HELD(&zap->zap_rwlock));
- ASSERT(!zap->zap_ismicro);
-@@ -851,10 +855,29 @@ retry:
- if (err == 0) {
- zap_increment_num_entries(zap, 1, tx);
- } else if (err == EAGAIN) {
-+ /*
-+ * If the last two expansions did not help, there is no point
-+ * trying to expand again
-+ */
-+ if (expand_retries > MAX_EXPAND_RETRIES && prev_l == l) {
-+ err = SET_ERROR(ENOSPC);
-+ goto out;
-+ }
-+
- err = zap_expand_leaf(zn, l, tag, tx, &l);
- zap = zn->zn_zap; /* zap_expand_leaf() may change zap */
-- if (err == 0)
-+ if (err == 0) {
-+ prev_l = l;
-+ expand_retries++;
- goto retry;
-+ } else if (err == ENOSPC) {
-+ /*
-+ * If we failed to expand the leaf, then bailout
-+ * as there is no point trying
-+ * zap_put_leaf_maybe_grow_ptrtbl().
-+ */
-+ return (err);
-+ }
- }
-
- out:
-diff --git a/module/zfs/zap_leaf.c b/module/zfs/zap_leaf.c
-index c342695c7..526e46606 100644
---- a/module/zfs/zap_leaf.c
-+++ b/module/zfs/zap_leaf.c
-@@ -53,7 +53,7 @@ static uint16_t *zap_leaf_rehash_entry(zap_leaf_t *l, uint16_t entry);
- ((h) >> \
- (64 - ZAP_LEAF_HASH_SHIFT(l) - zap_leaf_phys(l)->l_hdr.lh_prefix_len)))
-
--#define LEAF_HASH_ENTPTR(l, h) (&zap_leaf_phys(l)->l_hash[LEAF_HASH(l, h)])
-+#define LEAF_HASH_ENTPTR(l, h) (&zap_leaf_phys(l)->l_hash[LEAF_HASH(l, h)])
-
- extern inline zap_leaf_phys_t *zap_leaf_phys(zap_leaf_t *l);
-
-diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c
-index 3ebf995c6..34bef3e63 100644
---- a/module/zfs/zap_micro.c
-+++ b/module/zfs/zap_micro.c
-@@ -363,6 +363,41 @@ mze_find_unused_cd(zap_t *zap, uint64_t hash)
- return (cd);
- }
-
-+/*
-+ * Each mzap entry requires at max : 4 chunks
-+ * 3 chunks for names + 1 chunk for value.
-+ */
-+#define MZAP_ENT_CHUNKS (1 + ZAP_LEAF_ARRAY_NCHUNKS(MZAP_NAME_LEN) + \
-+ ZAP_LEAF_ARRAY_NCHUNKS(sizeof (uint64_t)))
-+
-+/*
-+ * Check if the current entry keeps the colliding entries under the fatzap leaf
-+ * size.
-+ */
-+static boolean_t
-+mze_canfit_fzap_leaf(zap_name_t *zn, uint64_t hash)
-+{
-+ zap_t *zap = zn->zn_zap;
-+ mzap_ent_t mze_tofind;
-+ mzap_ent_t *mze;
-+ avl_index_t idx;
-+ avl_tree_t *avl = &zap->zap_m.zap_avl;
-+ uint32_t mzap_ents = 0;
-+
-+ mze_tofind.mze_hash = hash;
-+ mze_tofind.mze_cd = 0;
-+
-+ for (mze = avl_find(avl, &mze_tofind, &idx);
-+ mze && mze->mze_hash == hash; mze = AVL_NEXT(avl, mze)) {
-+ mzap_ents++;
-+ }
-+
-+ /* Include the new entry being added */
-+ mzap_ents++;
-+
-+ return (ZAP_LEAF_NUMCHUNKS_DEF > (mzap_ents * MZAP_ENT_CHUNKS));
-+}
-+
- static void
- mze_remove(zap_t *zap, mzap_ent_t *mze)
- {
-@@ -1191,7 +1226,8 @@ zap_add_impl(zap_t *zap, const char *key,
- err = fzap_add(zn, integer_size, num_integers, val, tag, tx);
- zap = zn->zn_zap; /* fzap_add() may change zap */
- } else if (integer_size != 8 || num_integers != 1 ||
-- strlen(key) >= MZAP_NAME_LEN) {
-+ strlen(key) >= MZAP_NAME_LEN ||
-+ !mze_canfit_fzap_leaf(zn, zn->zn_hash)) {
- err = mzap_upgrade(&zn->zn_zap, tag, tx, 0);
- if (err == 0) {
- err = fzap_add(zn, integer_size, num_integers, val,
-diff --git a/module/zfs/zfs_dir.c b/module/zfs/zfs_dir.c
-index 9a8bbccd9..6398a1d15 100644
---- a/module/zfs/zfs_dir.c
-+++ b/module/zfs/zfs_dir.c
-@@ -742,7 +742,11 @@ zfs_dirent(znode_t *zp, uint64_t mode)
- }
-
- /*
-- * Link zp into dl. Can only fail if zp has been unlinked.
-+ * Link zp into dl. Can fail in the following cases :
-+ * - if zp has been unlinked.
-+ * - if the number of entries with the same hash (aka. colliding entries)
-+ * exceed the capacity of a leaf-block of fatzap and splitting of the
-+ * leaf-block does not help.
- */
- int
- zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
-@@ -776,6 +780,24 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
- NULL, &links, sizeof (links));
- }
- }
-+
-+ value = zfs_dirent(zp, zp->z_mode);
-+ error = zap_add(ZTOZSB(zp)->z_os, dzp->z_id, dl->dl_name, 8, 1,
-+ &value, tx);
-+
-+ /*
-+ * zap_add could fail to add the entry if it exceeds the capacity of the
-+ * leaf-block and zap_leaf_split() failed to help.
-+ * The caller of this routine is responsible for failing the transaction
-+ * which will rollback the SA updates done above.
-+ */
-+ if (error != 0) {
-+ if (!(flag & ZRENAMING) && !(flag & ZNEW))
-+ drop_nlink(ZTOI(zp));
-+ mutex_exit(&zp->z_lock);
-+ return (error);
-+ }
-+
- SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_PARENT(zfsvfs), NULL,
- &dzp->z_id, sizeof (dzp->z_id));
- SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_FLAGS(zfsvfs), NULL,
-@@ -813,11 +835,6 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
- ASSERT(error == 0);
- mutex_exit(&dzp->z_lock);
-
-- value = zfs_dirent(zp, zp->z_mode);
-- error = zap_add(ZTOZSB(zp)->z_os, dzp->z_id, dl->dl_name,
-- 8, 1, &value, tx);
-- ASSERT(error == 0);
--
- return (0);
- }
-
-diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
-index 6f6ce79db..8a7ad702c 100644
---- a/module/zfs/zfs_vnops.c
-+++ b/module/zfs/zfs_vnops.c
-@@ -1443,10 +1443,22 @@ top:
- }
- zfs_mknode(dzp, vap, tx, cr, 0, &zp, &acl_ids);
-
-+ error = zfs_link_create(dl, zp, tx, ZNEW);
-+ if (error != 0) {
-+ /*
-+ * Since, we failed to add the directory entry for it,
-+ * delete the newly created dnode.
-+ */
-+ zfs_znode_delete(zp, tx);
-+ remove_inode_hash(ZTOI(zp));
-+ zfs_acl_ids_free(&acl_ids);
-+ dmu_tx_commit(tx);
-+ goto out;
-+ }
-+
- if (fuid_dirtied)
- zfs_fuid_sync(zfsvfs, tx);
-
-- (void) zfs_link_create(dl, zp, tx, ZNEW);
- txtype = zfs_log_create_txtype(Z_FILE, vsecp, vap);
- if (flag & FIGNORECASE)
- txtype |= TX_CI;
-@@ -2037,13 +2049,18 @@ top:
- */
- zfs_mknode(dzp, vap, tx, cr, 0, &zp, &acl_ids);
-
-- if (fuid_dirtied)
-- zfs_fuid_sync(zfsvfs, tx);
--
- /*
- * Now put new name in parent dir.
- */
-- (void) zfs_link_create(dl, zp, tx, ZNEW);
-+ error = zfs_link_create(dl, zp, tx, ZNEW);
-+ if (error != 0) {
-+ zfs_znode_delete(zp, tx);
-+ remove_inode_hash(ZTOI(zp));
-+ goto out;
-+ }
-+
-+ if (fuid_dirtied)
-+ zfs_fuid_sync(zfsvfs, tx);
-
- *ipp = ZTOI(zp);
-
-@@ -2053,6 +2070,7 @@ top:
- zfs_log_create(zilog, tx, txtype, dzp, zp, dirname, vsecp,
- acl_ids.z_fuidp, vap);
-
-+out:
- zfs_acl_ids_free(&acl_ids);
-
- dmu_tx_commit(tx);
-@@ -2062,10 +2080,14 @@ top:
- if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
- zil_commit(zilog, 0);
-
-- zfs_inode_update(dzp);
-- zfs_inode_update(zp);
-+ if (error != 0) {
-+ iput(ZTOI(zp));
-+ } else {
-+ zfs_inode_update(dzp);
-+ zfs_inode_update(zp);
-+ }
- ZFS_EXIT(zfsvfs);
-- return (0);
-+ return (error);
- }
-
- /*
-@@ -3683,6 +3705,13 @@ top:
- VERIFY3U(zfs_link_destroy(tdl, szp, tx,
- ZRENAMING, NULL), ==, 0);
- }
-+ } else {
-+ /*
-+ * If we had removed the existing target, subsequent
-+ * call to zfs_link_create() to add back the same entry
-+ * but, the new dnode (szp) should not fail.
-+ */
-+ ASSERT(tzp == NULL);
- }
- }
-
-@@ -3853,14 +3882,18 @@ top:
- /*
- * Insert the new object into the directory.
- */
-- (void) zfs_link_create(dl, zp, tx, ZNEW);
--
-- if (flags & FIGNORECASE)
-- txtype |= TX_CI;
-- zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link);
-+ error = zfs_link_create(dl, zp, tx, ZNEW);
-+ if (error != 0) {
-+ zfs_znode_delete(zp, tx);
-+ remove_inode_hash(ZTOI(zp));
-+ } else {
-+ if (flags & FIGNORECASE)
-+ txtype |= TX_CI;
-+ zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link);
-
-- zfs_inode_update(dzp);
-- zfs_inode_update(zp);
-+ zfs_inode_update(dzp);
-+ zfs_inode_update(zp);
-+ }
-
- zfs_acl_ids_free(&acl_ids);
-
-@@ -3868,10 +3901,14 @@ top:
-
- zfs_dirent_unlock(dl);
-
-- *ipp = ZTOI(zp);
-+ if (error == 0) {
-+ *ipp = ZTOI(zp);
-
-- if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
-- zil_commit(zilog, 0);
-+ if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
-+ zil_commit(zilog, 0);
-+ } else {
-+ iput(ZTOI(zp));
-+ }
-
- ZFS_EXIT(zfsvfs);
- return (error);
-diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
-index ea2dbb282..8be3e1c62 100644
---- a/tests/runfiles/linux.run
-+++ b/tests/runfiles/linux.run
-@@ -55,7 +55,7 @@ tags = ['functional', 'cachefile']
- # 'mixed_none_lookup', 'mixed_none_lookup_ci', 'mixed_none_delete',
- # 'mixed_formd_lookup', 'mixed_formd_lookup_ci', 'mixed_formd_delete']
- [tests/functional/casenorm]
--tests = ['case_all_values', 'norm_all_values']
-+tests = ['case_all_values', 'norm_all_values', 'mixed_create_failure']
- tags = ['functional', 'casenorm']
-
- [tests/functional/chattr]
-diff --git a/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh b/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
-new file mode 100755
-index 000000000..51b5bb3f6
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
-@@ -0,0 +1,136 @@
-+#!/bin/ksh -p
-+#
-+#
-+# This file and its contents are supplied under the terms of the
-+# Common Development and Distribution License ("CDDL"), version 1.0.
-+# You may only use this file in accordance with the terms of version
-+# 1.0 of the CDDL.
-+#
-+# A full copy of the text of the CDDL should have accompanied this
-+# source. A copy of the CDDL is also available via the Internet at
-+# http://www.illumos.org/license/CDDL.
-+#
-+#
-+# Copyright 2018 Nutanix Inc. All rights reserved.
-+#
-+
-+. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
-+
-+# DESCRIPTION:
-+# For the filesystem with casesensitivity=mixed, normalization=none,
-+# when multiple files with the same name (differing only in case) are created,
-+# the number of files is limited to what can fit in a fatzap leaf-block.
-+# And beyond that, it fails with ENOSPC.
-+#
-+# Ensure that the create/rename operations fail gracefully and not trigger an
-+# ASSERT.
-+#
-+# STRATEGY:
-+# Repeat the below steps for objects: files, directories, symlinks and hardlinks
-+# 1. Create objects with same name but varying in case.
-+# E.g. 'abcdefghijklmnop', 'Abcdefghijklmnop', 'ABcdefghijklmnop' etc.
-+# The create should fail with ENOSPC.
-+# 2. Create an object with name 'tmp_obj' and try to rename it to name that we
-+# failed to add in step 1 above.
-+# This should fail as well.
-+
-+verify_runnable "global"
-+
-+function cleanup
-+{
-+ destroy_testfs
-+}
-+
-+log_onexit cleanup
-+log_assert "With mixed mode: ensure create fails with ENOSPC beyond a certain limit"
-+
-+create_testfs "-o casesensitivity=mixed -o normalization=none"
-+
-+# Different object types
-+obj_type=('file' 'dir' 'symlink' 'hardlink')
-+
-+# Commands to create different object types
-+typeset -A ops
-+ops['file']='touch'
-+ops['dir']='mkdir'
-+ops['symlink']='ln -s'
-+ops['hardlink']='ln'
-+
-+# This function tests the following for a give object type :
-+# - Create multiple objects with the same name (varying only in case).
-+# Ensure that it eventually fails once the leaf-block limit is exceeded.
-+# - Create another object with a different name. And attempt rename it to the
-+# name (for which the create had failed in the previous step).
-+# This should fail as well.
-+# Args :
-+# $1 - object type (file/dir/symlink/hardlink)
-+# $2 - test directory
-+#
-+function test_ops
-+{
-+ typeset obj_type=$1
-+ typeset testdir=$2
-+
-+ target_obj='target-file'
-+
-+ op="${ops[$obj_type]}"
-+
-+ log_note "The op : $op"
-+ log_note "testdir=$testdir obj_type=$obj_type"
-+
-+ test_path="$testdir/$obj_type"
-+ mkdir $test_path
-+ log_note "Created test dir $test_path"
-+
-+ if [[ $obj_type = "symlink" || $obj_type = "hardlink" ]]; then
-+ touch $test_path/$target_obj
-+ log_note "Created target: $test_path/$target_obj"
-+ op="$op $test_path/$target_obj"
-+ fi
-+
-+ log_note "op : $op"
-+ names='{a,A}{b,B}{c,C}{d,D}{e,E}{f,F}{g,G}{h,H}{i,I}{j,J}{k,K}{l,L}'
-+ for name in $names; do
-+ cmd="$op $test_path/$name"
-+ out=$($cmd 2>&1)
-+ ret=$?
-+ log_note "cmd: $cmd ret: $ret out=$out"
-+ if (($ret != 0)); then
-+ if [[ $out = *@(No space left on device)* ]]; then
-+ save_name="$test_path/$name"
-+ break;
-+ else
-+ log_err "$cmd failed with unexpected error : $out"
-+ fi
-+ fi
-+ done
-+
-+ log_note 'Test rename \"sample_name\" rename'
-+ TMP_OBJ="$test_path/tmp_obj"
-+ cmd="$op $TMP_OBJ"
-+ out=$($cmd 2>&1)
-+ ret=$?
-+ if (($ret != 0)); then
-+ log_err "cmd:$cmd failed out:$out"
-+ fi
-+
-+ # Now, try to rename the tmp_obj to the name which we failed to add earlier.
-+ # This should fail as well.
-+ out=$(mv $TMP_OBJ $save_name 2>&1)
-+ ret=$?
-+ if (($ret != 0)); then
-+ if [[ $out = *@(No space left on device)* ]]; then
-+ log_note "$cmd failed as expected : $out"
-+ else
-+ log_err "$cmd failed with : $out"
-+ fi
-+ fi
-+}
-+
-+for obj_type in ${obj_type[*]};
-+do
-+ log_note "Testing create of $obj_type"
-+ test_ops $obj_type $TESTDIR
-+done
-+
-+log_pass "Mixed mode FS: Ops on large number of colliding names fail gracefully"
---
-2.14.2
-
diff --git a/zfs-patches/0029-mmp-should-use-a-fixed-tag-for-spa_config-locks.patch b/zfs-patches/0029-mmp-should-use-a-fixed-tag-for-spa_config-locks.patch
deleted file mode 100644
index 87c2f04..0000000
--- a/zfs-patches/0029-mmp-should-use-a-fixed-tag-for-spa_config-locks.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: sanjeevbagewadi <***@gmail.com>
-Date: Tue, 13 Feb 2018 01:00:38 +0530
-Subject: [PATCH] mmp should use a fixed tag for spa_config locks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-mmp_write_uberblock() and mmp_write_done() should the same tag
-for spa_config_locks.
-
-Reviewed-by: Olaf Faaland <***@llnl.gov>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Sanjeev Bagewadi <***@gmail.com>
-Closes #6530
-Closes #7155
-(cherry picked from commit d85011ed696b41f4de963f7932dfb53ea871278b)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/mmp.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
-index e91ae628a..1dfb7c05b 100644
---- a/module/zfs/mmp.c
-+++ b/module/zfs/mmp.c
-@@ -125,6 +125,7 @@ uint_t zfs_multihost_import_intervals = MMP_DEFAULT_IMPORT_INTERVALS;
- uint_t zfs_multihost_fail_intervals = MMP_DEFAULT_FAIL_INTERVALS;
-
- static void mmp_thread(spa_t *spa);
-+char *mmp_tag = "mmp_write_uberblock";
-
- void
- mmp_init(spa_t *spa)
-@@ -278,7 +279,7 @@ mmp_write_done(zio_t *zio)
-
- unlock:
- mutex_exit(&mts->mmp_io_lock);
-- spa_config_exit(spa, SCL_STATE, FTAG);
-+ spa_config_exit(spa, SCL_STATE, mmp_tag);
-
- abd_free(zio->io_abd);
- }
-@@ -314,7 +315,7 @@ mmp_write_uberblock(spa_t *spa)
- int label;
- uint64_t offset;
-
-- spa_config_enter(spa, SCL_STATE, FTAG, RW_READER);
-+ spa_config_enter(spa, SCL_STATE, mmp_tag, RW_READER);
- vd = mmp_random_leaf(spa->spa_root_vdev);
- if (vd == NULL) {
- spa_config_exit(spa, SCL_STATE, FTAG);
---
-2.14.2
-
diff --git a/zfs-patches/0030-contrib-initramfs-add-missing-conf.d-zfs.patch b/zfs-patches/0030-contrib-initramfs-add-missing-conf.d-zfs.patch
deleted file mode 100644
index ec7ce71..0000000
--- a/zfs-patches/0030-contrib-initramfs-add-missing-conf.d-zfs.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: LOLi <***@users.noreply.github.com>
-Date: Mon, 12 Feb 2018 20:40:00 +0100
-Subject: [PATCH] contrib/initramfs: add missing conf.d/zfs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When upgrading from the distribution-provided zfs-initramfs package on
-root-on-zfs Ubuntu and Debian the system may fail to boot: this change
-adds the missing initramfs configuration file.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: Richard Laager <***@wiktel.com>
-Signed-off-by: loli10K <***@gmail.com>
-Closes #7158
-(cherry picked from commit a9ff89e05cd2f420e44b0e50c92d97c166772d2b)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- contrib/initramfs/Makefile.am | 6 ++++--
- contrib/initramfs/conf.d/zfs | 8 ++++++++
- 2 files changed, 12 insertions(+), 2 deletions(-)
- create mode 100644 contrib/initramfs/conf.d/zfs
-
-diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am
-index 998e588ab..b22940821 100644
---- a/contrib/initramfs/Makefile.am
-+++ b/contrib/initramfs/Makefile.am
-@@ -1,8 +1,10 @@
- initrddir = $(datarootdir)/initramfs-tools
-
--initrd_SCRIPTS = conf-hooks.d/zfs hooks/zfs scripts/zfs scripts/local-top/zfs
-+initrd_SCRIPTS = \
-+ conf.d/zfs conf-hooks.d/zfs hooks/zfs scripts/zfs scripts/local-top/zfs
-
- EXTRA_DIST = \
-+ $(top_srcdir)/contrib/initramfs/conf.d/zfs \
- $(top_srcdir)/contrib/initramfs/conf-hooks.d/zfs \
- $(top_srcdir)/contrib/initramfs/hooks/zfs \
- $(top_srcdir)/contrib/initramfs/scripts/zfs \
-@@ -10,7 +12,7 @@ EXTRA_DIST = \
- $(top_srcdir)/contrib/initramfs/README.initramfs.markdown
-
- install-initrdSCRIPTS: $(EXTRA_DIST)
-- for d in conf-hooks.d hooks scripts scripts/local-top; do \
-+ for d in conf.d conf-hooks.d hooks scripts scripts/local-top; do \
- $(MKDIR_P) $(DESTDIR)$(initrddir)/$$d; \
- cp $(top_srcdir)/contrib/initramfs/$$d/zfs \
- $(DESTDIR)$(initrddir)/$$d/; \
-diff --git a/contrib/initramfs/conf.d/zfs b/contrib/initramfs/conf.d/zfs
-new file mode 100644
-index 000000000..c67d75ba8
---- /dev/null
-+++ b/contrib/initramfs/conf.d/zfs
-@@ -0,0 +1,8 @@
-+for x in $(cat /proc/cmdline)
-+do
-+ case $x in
-+ root=ZFS=*|root=zfs:*)
-+ BOOT=zfs
-+ ;;
-+ esac
-+done
---
-2.14.2
-
diff --git a/zfs-patches/0031-zfs-receive-fails-with-dataset-is-busy.patch b/zfs-patches/0031-zfs-receive-fails-with-dataset-is-busy.patch
deleted file mode 100644
index bae187b..0000000
--- a/zfs-patches/0031-zfs-receive-fails-with-dataset-is-busy.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: LOLi <***@users.noreply.github.com>
-Date: Mon, 12 Feb 2018 21:28:59 +0100
-Subject: [PATCH] 'zfs receive' fails with "dataset is busy"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Receiving an incremental stream after an interrupted "zfs receive -s"
-fails with the message "dataset is busy": this is because we still have
-the hidden clone ../%recv from the resumable receive.
-
-Improve the error message suggesting the existence of a partially
-complete resumable stream from "zfs receive -s" which can be either
-aborted ("zfs receive -A") or resumed ("zfs send -t").
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: George Melikov <***@gmelikov.ru>
-Signed-off-by: loli10K <***@gmail.com>
-Closes #7129
-Closes #7154
-(cherry picked from commit 1d805a534b5e1768413a0242b8e92b97cb1a796c)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/zfs/zfs_main.c | 2 +-
- lib/libzfs/libzfs_sendrecv.c | 18 +++++++++++++++++-
- 2 files changed, 18 insertions(+), 2 deletions(-)
-
-diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
-index e8fe6a9fa..f57df8581 100644
---- a/cmd/zfs/zfs_main.c
-+++ b/cmd/zfs/zfs_main.c
-@@ -6072,7 +6072,7 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
-
- (void) fprintf(stderr, gettext("cannot %s '%s': "
- "Contains partially-completed state from "
-- "\"zfs receive -r\", which can be resumed with "
-+ "\"zfs receive -s\", which can be resumed with "
- "\"zfs send -t\"\n"),
- cmdname, zfs_get_name(zhp));
- return (1);
-diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
-index ec190022f..66d89067b 100644
---- a/lib/libzfs/libzfs_sendrecv.c
-+++ b/lib/libzfs/libzfs_sendrecv.c
-@@ -3254,6 +3254,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
- zfs_type_t type;
- boolean_t toplevel = B_FALSE;
- boolean_t zoned = B_FALSE;
-+ boolean_t hastoken = B_FALSE;
-
- begin_time = time(NULL);
- bzero(origin, MAXNAMELEN);
-@@ -3535,6 +3536,11 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
- /* we want to know if we're zoned when validating -o|-x props */
- zoned = zfs_prop_get_int(zhp, ZFS_PROP_ZONED);
-
-+ /* may need this info later, get it now we have zhp around */
-+ if (zfs_prop_get(zhp, ZFS_PROP_RECEIVE_RESUME_TOKEN, NULL, 0,
-+ NULL, NULL, 0, B_TRUE) == 0)
-+ hastoken = B_TRUE;
-+
- /* gather existing properties on destination */
- origprops = fnvlist_alloc();
- fnvlist_merge(origprops, zhp->zfs_props);
-@@ -3741,9 +3747,19 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
- break;
- case EDQUOT:
- zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-- "destination %s space quota exceeded"), name);
-+ "destination %s space quota exceeded."), name);
- (void) zfs_error(hdl, EZFS_NOSPC, errbuf);
- break;
-+ case EBUSY:
-+ if (hastoken) {
-+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-+ "destination %s contains "
-+ "partially-complete state from "
-+ "\"zfs receive -s\"."), name);
-+ (void) zfs_error(hdl, EZFS_BUSY, errbuf);
-+ break;
-+ }
-+ /* fallthru */
- default:
- (void) zfs_standard_error(hdl, ioctl_errno, errbuf);
- }
---
-2.14.2
-
diff --git a/zfs-patches/0032-OpenZFS-8857-zio_remove_child-panic-due-to-already-d.patch b/zfs-patches/0032-OpenZFS-8857-zio_remove_child-panic-due-to-already-d.patch
deleted file mode 100644
index 8fc2b50..0000000
--- a/zfs-patches/0032-OpenZFS-8857-zio_remove_child-panic-due-to-already-d.patch
+++ /dev/null
@@ -1,247 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: George Wilson <***@delphix.com>
-Date: Thu, 8 Feb 2018 15:04:14 -0500
-Subject: [PATCH] OpenZFS 8857 - zio_remove_child() panic due to already
- destroyed parent zio
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-PROBLEM
-=======
-It's possible for a parent zio to complete even though it has children
-which have not completed. This can result in the following panic:
- > $C
- ffffff01809128c0 vpanic()
- ffffff01809128e0 mutex_panic+0x58(fffffffffb94c904, ffffff597dde7f80)
- ffffff0180912950 mutex_vector_enter+0x347(ffffff597dde7f80)
- ffffff01809129b0 zio_remove_child+0x50(ffffff597dde7c58, ffffff32bd901ac0,
- ffffff3373370908)
- ffffff0180912a40 zio_done+0x390(ffffff32bd901ac0)
- ffffff0180912a70 zio_execute+0x78(ffffff32bd901ac0)
- ffffff0180912b30 taskq_thread+0x2d0(ffffff33bae44140)
- ffffff0180912b40 thread_start+8()
- > ::status
- debugging crash dump vmcore.2 (64-bit) from batfs0390
- operating system: 5.11 joyent_20170911T171900Z (i86pc)
- image uuid: (not set)
- panic message: mutex_enter: bad mutex, lp=ffffff597dde7f80
- owner=ffffff3c59b39480 thread=ffffff0180912c40
- dump content: kernel pages only
-The problem is that dbuf_prefetch along with l2arc can create a zio tree
-which confuses the parent zio and allows it to complete with while children
-still exist. Here's the scenario:
- zio tree:
- pio
- |--- lio
-The parent zio, pio, has entered the zio_done stage and begins to check its
-children to see there are still some that have not completed. In zio_done(),
-the children are checked in the following order:
- zio_wait_for_children(zio, ZIO_CHILD_VDEV, ZIO_WAIT_DONE)
- zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_DONE)
- zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_DONE)
- zio_wait_for_children(zio, ZIO_CHILD_LOGICAL, ZIO_WAIT_DONE)
-If pio, finds any child which has not completed then it stops executing and
-goes to sleep. Each call to zio_wait_for_children() will grab the io_lock
-while checking the particular child.
-In this scenario, the pio has completed the first call to
-zio_wait_for_children() to check for any ZIO_CHILD_VDEV children. Since
-the only zio in the zio tree right now is the logical zio, lio, then it
-completes that call and prepares to check the next child type.
-In the meantime, the lio completes and in its callback creates a child vdev
-zio, cio. The zio tree looks like this:
- zio tree:
- pio
- |--- lio
- |--- cio
-The lio then grabs the parent's io_lock and removes itself.
- zio tree:
- pio
- |--- cio
-The pio continues to run but has already completed its check for ZIO_CHILD_VDEV
-and will erroneously complete. When the child zio, cio, completes it will panic
-the system trying to reference the parent zio which has been destroyed.
-SOLUTION
-========
-The fix is to rework the zio_wait_for_children() logic to accept a bitfield
-for all the children types that it's interested in checking. The
-io_lock will is held the entire time we check all the children types. Since
-the function now accepts a bitfield, a simple ZIO_CHILD_BIT() macro is provided
-to allow for the conversion between a ZIO_CHILD type and the bitfield used by
-the zio_wiat_for_children logic.
-
-Authored by: George Wilson <***@delphix.com>
-Reviewed by: Matthew Ahrens <***@delphix.com>
-Reviewed by: Andriy Gapon <***@FreeBSD.org>
-Reviewed by: Youzhong Yang <***@gmail.com>
-Reviewed by: Brian Behlendorf <***@llnl.gov>
-Approved by: Dan McDonald <***@omniti.com>
-Ported-by: Giuseppe Di Natale <***@llnl.gov>
-
-OpenZFS-issue: https://www.illumos.org/issues/8857
-OpenZFS-commit: https://github.com/openzfs/openzfs/commit/862ff6d99c
-Issue #5918
-Closes #7168
-
-(cherry picked from commit 07ce5d739024cf9c638716c09f9934b4e629678c)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/sys/zio.h | 11 +++++++++++
- module/zfs/zio.c | 49 +++++++++++++++++++++++++++++--------------------
- 2 files changed, 40 insertions(+), 20 deletions(-)
-
-diff --git a/include/sys/zio.h b/include/sys/zio.h
-index 4eaabc38c..0d741f8e2 100644
---- a/include/sys/zio.h
-+++ b/include/sys/zio.h
-@@ -215,6 +215,9 @@ enum zio_flag {
- (((zio)->io_flags & ZIO_FLAG_VDEV_INHERIT) | \
- ZIO_FLAG_CANFAIL)
-
-+#define ZIO_CHILD_BIT(x) (1 << (x))
-+#define ZIO_CHILD_BIT_IS_SET(val, x) ((val) & (1 << (x)))
-+
- enum zio_child {
- ZIO_CHILD_VDEV = 0,
- ZIO_CHILD_GANG,
-@@ -223,6 +226,14 @@ enum zio_child {
- ZIO_CHILD_TYPES
- };
-
-+#define ZIO_CHILD_VDEV_BIT ZIO_CHILD_BIT(ZIO_CHILD_VDEV)
-+#define ZIO_CHILD_GANG_BIT ZIO_CHILD_BIT(ZIO_CHILD_GANG)
-+#define ZIO_CHILD_DDT_BIT ZIO_CHILD_BIT(ZIO_CHILD_DDT)
-+#define ZIO_CHILD_LOGICAL_BIT ZIO_CHILD_BIT(ZIO_CHILD_LOGICAL)
-+#define ZIO_CHILD_ALL_BITS \
-+ (ZIO_CHILD_VDEV_BIT | ZIO_CHILD_GANG_BIT | \
-+ ZIO_CHILD_DDT_BIT | ZIO_CHILD_LOGICAL_BIT)
-+
- enum zio_wait_type {
- ZIO_WAIT_READY = 0,
- ZIO_WAIT_DONE,
-diff --git a/module/zfs/zio.c b/module/zfs/zio.c
-index 1d69d8d8d..cd0a473e0 100644
---- a/module/zfs/zio.c
-+++ b/module/zfs/zio.c
-@@ -491,21 +491,26 @@ zio_remove_child(zio_t *pio, zio_t *cio, zio_link_t *zl)
- }
-
- static boolean_t
--zio_wait_for_children(zio_t *zio, enum zio_child child, enum zio_wait_type wait)
-+zio_wait_for_children(zio_t *zio, uint8_t childbits, enum zio_wait_type wait)
- {
-- uint64_t *countp = &zio->io_children[child][wait];
- boolean_t waiting = B_FALSE;
-
- mutex_enter(&zio->io_lock);
- ASSERT(zio->io_stall == NULL);
-- if (*countp != 0) {
-- zio->io_stage >>= 1;
-- ASSERT3U(zio->io_stage, !=, ZIO_STAGE_OPEN);
-- zio->io_stall = countp;
-- waiting = B_TRUE;
-+ for (int c = 0; c < ZIO_CHILD_TYPES; c++) {
-+ if (!(ZIO_CHILD_BIT_IS_SET(childbits, c)))
-+ continue;
-+
-+ uint64_t *countp = &zio->io_children[c][wait];
-+ if (*countp != 0) {
-+ zio->io_stage >>= 1;
-+ ASSERT3U(zio->io_stage, !=, ZIO_STAGE_OPEN);
-+ zio->io_stall = countp;
-+ waiting = B_TRUE;
-+ break;
-+ }
- }
- mutex_exit(&zio->io_lock);
--
- return (waiting);
- }
-
-@@ -1296,9 +1301,10 @@ zio_write_compress(zio_t *zio)
- * If our children haven't all reached the ready stage,
- * wait for them and then repeat this pipeline stage.
- */
-- if (zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_READY) ||
-- zio_wait_for_children(zio, ZIO_CHILD_LOGICAL, ZIO_WAIT_READY))
-+ if (zio_wait_for_children(zio, ZIO_CHILD_LOGICAL_BIT |
-+ ZIO_CHILD_GANG_BIT, ZIO_WAIT_READY)) {
- return (ZIO_PIPELINE_STOP);
-+ }
-
- if (!IO_IS_ALLOCATING(zio))
- return (ZIO_PIPELINE_CONTINUE);
-@@ -2229,8 +2235,9 @@ zio_gang_issue(zio_t *zio)
- {
- blkptr_t *bp = zio->io_bp;
-
-- if (zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_DONE))
-+ if (zio_wait_for_children(zio, ZIO_CHILD_GANG_BIT, ZIO_WAIT_DONE)) {
- return (ZIO_PIPELINE_STOP);
-+ }
-
- ASSERT(BP_IS_GANG(bp) && zio->io_gang_leader == zio);
- ASSERT(zio->io_child_type > ZIO_CHILD_GANG);
-@@ -2561,8 +2568,9 @@ zio_ddt_read_done(zio_t *zio)
- {
- blkptr_t *bp = zio->io_bp;
-
-- if (zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_DONE))
-+ if (zio_wait_for_children(zio, ZIO_CHILD_DDT_BIT, ZIO_WAIT_DONE)) {
- return (ZIO_PIPELINE_STOP);
-+ }
-
- ASSERT(BP_GET_DEDUP(bp));
- ASSERT(BP_GET_PSIZE(bp) == zio->io_size);
-@@ -3292,8 +3300,9 @@ zio_vdev_io_done(zio_t *zio)
- vdev_ops_t *ops = vd ? vd->vdev_ops : &vdev_mirror_ops;
- boolean_t unexpected_error = B_FALSE;
-
-- if (zio_wait_for_children(zio, ZIO_CHILD_VDEV, ZIO_WAIT_DONE))
-+ if (zio_wait_for_children(zio, ZIO_CHILD_VDEV_BIT, ZIO_WAIT_DONE)) {
- return (ZIO_PIPELINE_STOP);
-+ }
-
- ASSERT(zio->io_type == ZIO_TYPE_READ || zio->io_type == ZIO_TYPE_WRITE);
-
-@@ -3362,8 +3371,9 @@ zio_vdev_io_assess(zio_t *zio)
- {
- vdev_t *vd = zio->io_vd;
-
-- if (zio_wait_for_children(zio, ZIO_CHILD_VDEV, ZIO_WAIT_DONE))
-+ if (zio_wait_for_children(zio, ZIO_CHILD_VDEV_BIT, ZIO_WAIT_DONE)) {
- return (ZIO_PIPELINE_STOP);
-+ }
-
- if (vd == NULL && !(zio->io_flags & ZIO_FLAG_CONFIG_WRITER))
- spa_config_exit(zio->io_spa, SCL_ZIO, zio);
-@@ -3578,9 +3588,10 @@ zio_ready(zio_t *zio)
- zio_t *pio, *pio_next;
- zio_link_t *zl = NULL;
-
-- if (zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_READY) ||
-- zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_READY))
-+ if (zio_wait_for_children(zio, ZIO_CHILD_GANG_BIT | ZIO_CHILD_DDT_BIT,
-+ ZIO_WAIT_READY)) {
- return (ZIO_PIPELINE_STOP);
-+ }
-
- if (zio->io_ready) {
- ASSERT(IO_IS_ALLOCATING(zio));
-@@ -3721,11 +3732,9 @@ zio_done(zio_t *zio)
- * If our children haven't all completed,
- * wait for them and then repeat this pipeline stage.
- */
-- if (zio_wait_for_children(zio, ZIO_CHILD_VDEV, ZIO_WAIT_DONE) ||
-- zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_DONE) ||
-- zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_DONE) ||
-- zio_wait_for_children(zio, ZIO_CHILD_LOGICAL, ZIO_WAIT_DONE))
-+ if (zio_wait_for_children(zio, ZIO_CHILD_ALL_BITS, ZIO_WAIT_DONE)) {
- return (ZIO_PIPELINE_STOP);
-+ }
-
- /*
- * If the allocation throttle is enabled, then update the accounting.
---
-2.14.2
-
diff --git a/zfs-patches/0033-Clarify-zinject-8-explanation-of-e.patch b/zfs-patches/0033-Clarify-zinject-8-explanation-of-e.patch
deleted file mode 100644
index 561a646..0000000
--- a/zfs-patches/0033-Clarify-zinject-8-explanation-of-e.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Olaf Faaland <***@llnl.gov>
-Date: Thu, 15 Feb 2018 09:50:06 -0800
-Subject: [PATCH] Clarify zinject(8) explanation of -e
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Error injection of EIO or ENXIO simply sets the zio's io_error value,
-rather than preventing the read or write from occurring. This is
-important information as it affects how the probes must be used.
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: George Melikov <***@gmelikov.ru>
-Signed-off-by: Olaf Faaland <***@llnl.gov>
-Closes #7172
-(cherry picked from commit 26941ce90b8f056949a3bc29da606513af799781)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- man/man8/zinject.8 | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/man/man8/zinject.8 b/man/man8/zinject.8
-index 50fecfb64..7f363974b 100644
---- a/man/man8/zinject.8
-+++ b/man/man8/zinject.8
-@@ -111,6 +111,9 @@ Specify
- .BR "dtl" " for an ECHILD error,"
- .BR "io" " for an EIO error where reopening the device will succeed, or"
- .BR "nxio" " for an ENXIO error where reopening the device will fail."
-+For EIO and ENXIO, the "failed" reads or writes still occur. The probe simply
-+sets the error value reported by the I/O pipeline so it appears the read or
-+write failed.
- .TP
- .BI "\-f" " frequency"
- Only inject errors a fraction of the time. Expressed as a real number
---
-2.14.2
-
diff --git a/zfs-patches/0034-Fix-config-issues-frame-size-and-headers.patch b/zfs-patches/0034-Fix-config-issues-frame-size-and-headers.patch
deleted file mode 100644
index 656e845..0000000
--- a/zfs-patches/0034-Fix-config-issues-frame-size-and-headers.patch
+++ /dev/null
@@ -1,199 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: chrisrd <***@onthe.net.au>
-Date: Fri, 16 Feb 2018 07:58:23 +1100
-Subject: [PATCH] Fix config issues: frame size and headers
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-1. With various (debug and/or tracing?) kernel options enabled it's
-possible for 'struct inode' and 'struct super_block' to exceed the
-default frame size, leaving errors like this in config.log:
-
-build/conftest.c:116:1: error: the frame size of 1048 bytes is larger
-than 1024 bytes [-Werror=frame-larger-than=]
-
-Fix this by removing the frame size warning for config checks
-
-2. Without the correct headers included, it's possible for declarations
-to be missed, leaving errors like this in the config.log:
-
-build/conftest.c:131:14: error: ‘struct nameidata’ declared inside
-parameter list [-Werror]
-
-Fix this by adding appropriate headers.
-
-Note: Both these issues can result in silent config failures because
-the compile failure is taken to mean "this option is not supported by
-this kernel" rather than "there's something wrong with the config
-test". This can lead to something merely annoying (compile failures) to
-something potentially serious (miscompiled or misused kernel primitives
-or functions). E.g. the fixes included here resulted in these
-additional defines in zfs_config.h with linux v4.14.19:
-
-Also, drive-by whitespace fixes in config/* files which don't mention
-"GNU" (those ones look to be imported from elsewhere so leave them
-alone).
-
-Reviewed by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Chris Dunlop <***@onthe.net.au>
-Closes #7169
-(cherry picked from commit 5a84c60fb95ee7ca1393efe93d9d17c80497c6b6)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- config/deb.am | 8 ++++----
- config/kernel-acl.m4 | 1 +
- config/kernel-create-nameidata.m4 | 1 +
- config/kernel-dentry-operations.m4 | 1 +
- config/kernel-get-link.m4 | 2 +-
- config/kernel-lookup-nameidata.m4 | 1 +
- config/kernel-vm_node_stat.m4 | 2 +-
- config/kernel.m4 | 2 +-
- config/tgz.am | 4 ++--
- config/user-libblkid.m4 | 2 +-
- 10 files changed, 14 insertions(+), 10 deletions(-)
-
-diff --git a/config/deb.am b/config/deb.am
-index 1b51f9316..58ab96e18 100644
---- a/config/deb.am
-+++ b/config/deb.am
-@@ -2,16 +2,16 @@ deb-local:
- @(if test "${HAVE_DPKGBUILD}" = "no"; then \
- echo -e "\n" \
- "*** Required util ${DPKGBUILD} missing. Please install the\n" \
-- "*** package for your distribution which provides ${DPKGBUILD},\n" \
-+ "*** package for your distribution which provides ${DPKGBUILD},\n" \
- "*** re-run configure, and try again.\n"; \
-- exit 1; \
-+ exit 1; \
- fi; \
- if test "${HAVE_ALIEN}" = "no"; then \
- echo -e "\n" \
- "*** Required util ${ALIEN} missing. Please install the\n" \
-- "*** package for your distribution which provides ${ALIEN},\n" \
-+ "*** package for your distribution which provides ${ALIEN},\n" \
- "*** re-run configure, and try again.\n"; \
-- exit 1; \
-+ exit 1; \
- fi)
-
- deb-kmod: deb-local rpm-kmod
-diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4
-index 311484349..02cc020e5 100644
---- a/config/kernel-acl.m4
-+++ b/config/kernel-acl.m4
-@@ -184,6 +184,7 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
- AC_MSG_CHECKING([whether iops->permission() wants nameidata])
- ZFS_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-+ #include <linux/sched.h>
-
- int permission_fn(struct inode *inode, int mask,
- struct nameidata *nd) { return 0; }
-diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4
-index a71490a00..d4c155c57 100644
---- a/config/kernel-create-nameidata.m4
-+++ b/config/kernel-create-nameidata.m4
-@@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
- AC_MSG_CHECKING([whether iops->create() passes nameidata])
- ZFS_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-+ #include <linux/sched.h>
-
- #ifdef HAVE_MKDIR_UMODE_T
- int inode_create(struct inode *inode ,struct dentry *dentry,
-diff --git a/config/kernel-dentry-operations.m4 b/config/kernel-dentry-operations.m4
-index 3182490c9..61f5a27af 100644
---- a/config/kernel-dentry-operations.m4
-+++ b/config/kernel-dentry-operations.m4
-@@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
- AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata])
- ZFS_LINUX_TRY_COMPILE([
- #include <linux/dcache.h>
-+ #include <linux/sched.h>
-
- int revalidate (struct dentry *dentry,
- struct nameidata *nidata) { return 0; }
-diff --git a/config/kernel-get-link.m4 b/config/kernel-get-link.m4
-index 022c49c54..3cda08c1b 100644
---- a/config/kernel-get-link.m4
-+++ b/config/kernel-get-link.m4
-@@ -41,7 +41,7 @@ AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_LINK], [
- AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
- [iops->follow_link() nameidata])
- ],[
-- AC_MSG_ERROR(no; please file a bug report)
-+ AC_MSG_ERROR(no; please file a bug report)
- ])
- ])
- ])
-diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4
-index 43f5fb4cb..5453be5e8 100644
---- a/config/kernel-lookup-nameidata.m4
-+++ b/config/kernel-lookup-nameidata.m4
-@@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
- AC_MSG_CHECKING([whether iops->lookup() passes nameidata])
- ZFS_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-+ #include <linux/sched.h>
-
- struct dentry *inode_lookup(struct inode *inode,
- struct dentry *dentry, struct nameidata *nidata)
-diff --git a/config/kernel-vm_node_stat.m4 b/config/kernel-vm_node_stat.m4
-index e1c42f884..5dcd9d827 100644
---- a/config/kernel-vm_node_stat.m4
-+++ b/config/kernel-vm_node_stat.m4
-@@ -7,7 +7,7 @@ AC_DEFUN([ZFS_AC_KERNEL_VM_NODE_STAT], [
- ZFS_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- #include <linux/vmstat.h>
-- ],[
-+ ],[
- int a __attribute__ ((unused)) = NR_VM_NODE_STAT_ITEMS;
- long x __attribute__ ((unused)) =
- atomic_long_read(&vm_node_stat[0]);
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index b83f021e8..d4a84b2b2 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -722,7 +722,7 @@ AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [
- modpost_flag=''
- test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
- AS_IF(
-- [AC_TRY_COMMAND(cp conftest.c conftest.h build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
-+ [AC_TRY_COMMAND(cp conftest.c conftest.h build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $FRAME_LARGER_THAN $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
- [$4],
- [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
- )
-diff --git a/config/tgz.am b/config/tgz.am
-index 2997b1de2..0657d045d 100644
---- a/config/tgz.am
-+++ b/config/tgz.am
-@@ -2,9 +2,9 @@ tgz-local:
- @(if test "${HAVE_ALIEN}" = "no"; then \
- echo -e "\n" \
- "*** Required util ${ALIEN} missing. Please install the\n" \
-- "*** package for your distribution which provides ${ALIEN},\n" \
-+ "*** package for your distribution which provides ${ALIEN},\n" \
- "*** re-run configure, and try again.\n"; \
-- exit 1; \
-+ exit 1; \
- fi)
-
- tgz-kmod: tgz-local rpm-kmod
-diff --git a/config/user-libblkid.m4 b/config/user-libblkid.m4
-index 5bc7f466a..88e6f990b 100644
---- a/config/user-libblkid.m4
-+++ b/config/user-libblkid.m4
-@@ -6,7 +6,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_LIBBLKID], [
- LIBBLKID=
-
- AC_CHECK_HEADER([blkid/blkid.h], [], [AC_MSG_FAILURE([
-- *** blkid.h missing, libblkid-devel package required])])
-+ *** blkid.h missing, libblkid-devel package required])])
-
- AC_SUBST([LIBBLKID], ["-lblkid"])
- AC_DEFINE([HAVE_LIBBLKID], 1, [Define if you have libblkid])
---
-2.14.2
-
diff --git a/zfs-patches/0035-Correct-count_uberblocks-in-mmp.kshlib.patch b/zfs-patches/0035-Correct-count_uberblocks-in-mmp.kshlib.patch
deleted file mode 100644
index db1e329..0000000
--- a/zfs-patches/0035-Correct-count_uberblocks-in-mmp.kshlib.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Giuseppe Di Natale <***@users.noreply.github.com>
-Date: Tue, 20 Feb 2018 16:28:52 -0800
-Subject: [PATCH] Correct count_uberblocks in mmp.kshlib
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-A log_must call was causing count_uberblocks to return more
-than just the uberblock count. Remove the log_must since it
-was only logging a sleep.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: Olaf Faaland <***@llnl.gov>
-Reviewed-by: loli10K <***@gmail.com>
-Signed-off-by: Giuseppe Di Natale <***@llnl.gov>
-Closes #7191
-(cherry picked from commit d5b10b3ef3b5e82b9e5a9bee122f1a0be007dae2)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- tests/zfs-tests/tests/functional/mmp/mmp.kshlib | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/zfs-tests/tests/functional/mmp/mmp.kshlib b/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
-index 4c46ae7a2..1f8d66fd9 100644
---- a/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
-+++ b/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
-@@ -198,6 +198,6 @@ function count_uberblocks # pool duration
- typeset -i duration=$2
- typeset hist_path="/proc/spl/kstat/zfs/$pool/multihost"
-
-- log_must sleep $duration
-+ sleep $duration
- echo $(cat "$hist_path" | sed '1,2d' | wc -l)
- }
---
-2.14.2
-
diff --git a/zfs-patches/0036-Add-SMART-attributes-for-SSD-and-NVMe.patch b/zfs-patches/0036-Add-SMART-attributes-for-SSD-and-NVMe.patch
deleted file mode 100644
index a18d02d..0000000
--- a/zfs-patches/0036-Add-SMART-attributes-for-SSD-and-NVMe.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: bunder2015 <***@gmail.com>
-Date: Wed, 21 Feb 2018 16:52:47 -0500
-Subject: [PATCH] Add SMART attributes for SSD and NVMe
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This adds the SMART attributes required to probe Samsung SSD and NVMe
-(and possibly others) disks when using the "zpool status -c" command.
-
-Reviewed-by: loli10K <***@gmail.com>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Tony Hutter <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: bunder2015 <***@gmail.com>
-Closes #7183
-Closes #7193
-(cherry picked from commit c705d8386b21b08aefdc62b6b1a556aab6717316)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/zpool/Makefile.am | 2 ++
- cmd/zpool/zpool.d/nvme_err | 1 +
- cmd/zpool/zpool.d/smart | 23 +++++++++++++++++++++--
- 3 files changed, 24 insertions(+), 2 deletions(-)
- create mode 120000 cmd/zpool/zpool.d/nvme_err
-
-diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am
-index 6eff1d143..c7b8b76e3 100644
---- a/cmd/zpool/Makefile.am
-+++ b/cmd/zpool/Makefile.am
-@@ -60,6 +60,7 @@ dist_zpoolexec_SCRIPTS = \
- zpool.d/pend_sec \
- zpool.d/off_ucor \
- zpool.d/ata_err \
-+ zpool.d/nvme_err \
- zpool.d/pwr_cyc \
- zpool.d/upath \
- zpool.d/vendor
-@@ -98,6 +99,7 @@ zpoolconfdefaults = \
- pend_sec \
- off_ucor \
- ata_err \
-+ nvme_err \
- pwr_cyc \
- upath \
- vendor
-diff --git a/cmd/zpool/zpool.d/nvme_err b/cmd/zpool/zpool.d/nvme_err
-new file mode 120000
-index 000000000..94f22861f
---- /dev/null
-+++ b/cmd/zpool/zpool.d/nvme_err
-@@ -0,0 +1 @@
-+smart
-\ No newline at end of file
-diff --git a/cmd/zpool/zpool.d/smart b/cmd/zpool/zpool.d/smart
-index 3721f30ed..4bc3af39d 100755
---- a/cmd/zpool/zpool.d/smart
-+++ b/cmd/zpool/zpool.d/smart
-@@ -23,6 +23,7 @@ off_ucor: Show SMART offline uncorrectable errors (ATA).
- ata_err: Show SMART ATA errors (ATA).
- pwr_cyc: Show SMART power cycle count (ATA).
- serial: Show disk serial number.
-+nvme_err: Show SMART NVMe errors (NVMe).
- "
-
- script=$(basename "$0")
-@@ -37,7 +38,7 @@ smartctl_path=$(which smartctl)
- if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ]; then
- raw_out=$(eval "sudo $smartctl_path -a $VDEV_UPATH")
-
-- # Are we a SAS or ATA drive? Look for the right line in smartctl:
-+ # What kind of drive are we? Look for the right line in smartctl:
- #
- # SAS:
- # Transport protocol: SAS
-@@ -45,7 +46,10 @@ if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ]; then
- # SATA:
- # ATA Version is: 8
- #
-- type=$(echo "$raw_out" | grep -m 1 -Eo '^ATA|SAS$')
-+ # NVMe:
-+ # SMART/Health Information (NVMe Log 0xnn, NSID 0xnn)
-+ #
-+ type=$(echo "$raw_out" | grep -m 1 -Eo '^ATA|NVMe|SAS$')
- out=$(echo "$raw_out" | awk '
- # SAS specific
- /read:/{print "rrd="$4"\nr_cor="$5"\nr_proc="$7"\nr_ucor="$8}
-@@ -71,10 +75,21 @@ if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ]; then
-
- # SATA common
- /Temperature_Celsius/{print "temp="$10}
-+/Airflow_Temperature_Cel/{print "temp="$10}
- /SMART overall-health self-assessment test result:/{print "health="$6}
- /Power_On_Hours/{print "hours_on="$10}
- /Serial Number:/{print "serial="$3}
-
-+# NVMe common
-+/Temperature:/{print "temp="$2}
-+/SMART overall-health self-assessment test result:/{print "health="$6}
-+/Power On Hours:/{gsub("[^0-9]","",$4); print "hours_on="$4}
-+/Serial Number:/{print "serial="$3}
-+/Power Cycles:/{print "pwr_cyc="$3}
-+
-+# NVMe specific
-+/Media and Data Integrity Errors:/{print "nvme_err="$6}
-+
- END {ORS="\n"; print ""}
- ');
- fi
-@@ -94,6 +109,8 @@ smart)
- scripts="temp|health|r_ucor|w_ucor"
- elif [ "$type" = "ATA" ] ; then
- scripts="temp|health|ata_err|realloc|rep_ucor|cmd_to|pend_sec|off_ucor"
-+ elif [ "$type" = "NVMe" ] ; then
-+ scripts="temp|health|nvme_err"
- fi
- ;;
- smartx)
-@@ -102,6 +119,8 @@ smartx)
- scripts="hours_on|defect|nonmed|r_proc|w_proc"
- elif [ "$type" = "ATA" ] ; then
- scripts="hours_on|pwr_cyc"
-+ elif [ "$type" = "NVMe" ] ; then
-+ scripts="hours_on|pwr_cyc"
- fi
- ;;
- *)
---
-2.14.2
-
diff --git a/zfs-patches/0037-Allow-modprobe-to-fail-when-called-within-systemd.patch b/zfs-patches/0037-Allow-modprobe-to-fail-when-called-within-systemd.patch
deleted file mode 100644
index a918450..0000000
--- a/zfs-patches/0037-Allow-modprobe-to-fail-when-called-within-systemd.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Matthew Thode <***@mthode.org>
-Date: Wed, 21 Feb 2018 22:45:35 +0000
-Subject: [PATCH] Allow modprobe to fail when called within systemd
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This allows for systems with zfs built into the kernel manually to run
-these services. Otherwise the service will fail to start.
-
-Reviewed-by: loli10K <***@gmail.com>
-Reviewed-by: Kash Pande <***@tripleback.net>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Matthew Thode <***@mthode.org>
-Closes #7174
-(cherry picked from commit 30ac8de48a2bb680e15dfe8879faaa7b461b771c)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- etc/systemd/system/zfs-import-cache.service.in | 2 +-
- etc/systemd/system/zfs-import-scan.service.in | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in
-index 9d677f8dd..726c468ca 100644
---- a/etc/systemd/system/zfs-import-cache.service.in
-+++ b/etc/systemd/system/zfs-import-cache.service.in
-@@ -12,7 +12,7 @@ ConditionPathExists=@sysconfdir@/zfs/zpool.cache
- [Service]
- Type=oneshot
- RemainAfterExit=yes
--ExecStartPre=/sbin/modprobe zfs
-+ExecStartPre=-/sbin/modprobe zfs
- ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN
-
- [Install]
-diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in
-index cc428b0d0..8fe2c1072 100644
---- a/etc/systemd/system/zfs-import-scan.service.in
-+++ b/etc/systemd/system/zfs-import-scan.service.in
-@@ -11,7 +11,7 @@ ConditionPathExists=!@sysconfdir@/zfs/zpool.cache
- [Service]
- Type=oneshot
- RemainAfterExit=yes
--ExecStartPre=/sbin/modprobe zfs
-+ExecStartPre=-/sbin/modprobe zfs
- ExecStart=@sbindir@/zpool import -aN -d /dev/disk/by-id -o cachefile=none
-
- [Install]
---
-2.14.2
-
diff --git a/zfs-patches/0038-Linux-4.16-compat-use-correct-_dec_and_test.patch b/zfs-patches/0038-Linux-4.16-compat-use-correct-_dec_and_test.patch
deleted file mode 100644
index 00d4b4f..0000000
--- a/zfs-patches/0038-Linux-4.16-compat-use-correct-_dec_and_test.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Thu, 22 Feb 2018 09:02:06 -0800
-Subject: [PATCH] Linux 4.16 compat: use correct *_dec_and_test()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Use refcount_dec_and_test() on 4.16+ kernels, atomic_dec_and_test()
-on older kernels. https://lwn.net/Articles/714974/
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Tony Hutter <***@llnl.gov>
-Closes: #7179
-Closes: #7211
-(cherry picked from commit e5ba614d05bde1e98ba46d5b75cf6b8a0701c2ca)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/linux/vfs_compat.h | 6 +++++-
- config/kernel-acl-refcount.m4 | 20 ++++++++++++++++++++
- config/kernel.m4 | 1 +
- 3 files changed, 26 insertions(+), 1 deletion(-)
- create mode 100644 config/kernel-acl-refcount.m4
-
-diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h
-index 7fcf3c055..6347268af 100644
---- a/include/linux/vfs_compat.h
-+++ b/include/linux/vfs_compat.h
-@@ -288,9 +288,13 @@ zpl_posix_acl_release(struct posix_acl *acl)
- {
- if ((acl == NULL) || (acl == ACL_NOT_CACHED))
- return;
--
-+#ifdef HAVE_ACL_REFCOUNT
-+ if (refcount_dec_and_test(&acl->a_refcount))
-+ zpl_posix_acl_release_impl(acl);
-+#else
- if (atomic_dec_and_test(&acl->a_refcount))
- zpl_posix_acl_release_impl(acl);
-+#endif
- }
- #endif /* HAVE_POSIX_ACL_RELEASE */
-
-diff --git a/config/kernel-acl-refcount.m4 b/config/kernel-acl-refcount.m4
-new file mode 100644
-index 000000000..43e3c442d
---- /dev/null
-+++ b/config/kernel-acl-refcount.m4
-@@ -0,0 +1,20 @@
-+dnl #
-+dnl # 4.16 kernel: check if struct posix_acl acl.a_refcount is a refcount_t.
-+dnl # It's an atomic_t on older kernels.
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_ACL_HAS_REFCOUNT], [
-+ AC_MSG_CHECKING([whether posix_acl has refcount_t])
-+ ZFS_LINUX_TRY_COMPILE([
-+ #include <linux/backing-dev.h>
-+ #include <linux/refcount.h>
-+ #include <linux/posix_acl.h>
-+ ],[
-+ struct posix_acl acl;
-+ refcount_t *r __attribute__ ((unused)) = &acl.a_refcount;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_ACL_REFCOUNT, 1, [posix_acl has refcount_t])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index d4a84b2b2..7bb86a96e 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -124,6 +124,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
- ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
- ZFS_AC_KERNEL_CURRENT_TIME
- ZFS_AC_KERNEL_VM_NODE_STAT
-+ ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
-
- AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
- KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
---
-2.14.2
-
diff --git a/zfs-patches/0039-Do-not-initiate-MMP-writes-while-pool-is-suspended.patch b/zfs-patches/0039-Do-not-initiate-MMP-writes-while-pool-is-suspended.patch
deleted file mode 100644
index ad004d2..0000000
--- a/zfs-patches/0039-Do-not-initiate-MMP-writes-while-pool-is-suspended.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Olaf Faaland <***@llnl.gov>
-Date: Thu, 22 Feb 2018 09:14:46 -0800
-Subject: [PATCH] Do not initiate MMP writes while pool is suspended
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-While the pool is suspended on host A, it may be imported on host B.
-If host A continued to write MMP blocks, it would be blindly
-overwriting MMP blocks written by host B, and the blocks written by
-host A would have outdated txg information.
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Olaf Faaland <***@llnl.gov>
-Closes #7182
-(cherry picked from commit b1f61f05b4b2edc77ec5f3d28d041d7b3c873f01)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/mmp.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
-index 1dfb7c05b..d003d79de 100644
---- a/module/zfs/mmp.c
-+++ b/module/zfs/mmp.c
-@@ -437,7 +437,7 @@ mmp_thread(spa_t *spa)
- zio_suspend(spa, NULL);
- }
-
-- if (multihost)
-+ if (multihost && !suspended)
- mmp_write_uberblock(spa);
-
- CALLB_CPR_SAFE_BEGIN(&cpr);
---
-2.14.2
-
diff --git a/zfs-patches/0040-Report-duration-and-error-in-mmp_history-entries.patch b/zfs-patches/0040-Report-duration-and-error-in-mmp_history-entries.patch
deleted file mode 100644
index f05ac98..0000000
--- a/zfs-patches/0040-Report-duration-and-error-in-mmp_history-entries.patch
+++ /dev/null
@@ -1,237 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Olaf Faaland <***@llnl.gov>
-Date: Thu, 22 Feb 2018 15:34:34 -0800
-Subject: [PATCH] Report duration and error in mmp_history entries
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-After an MMP write completes, update the relevant mmp_history entry
-with the time between submission and completion, and the error
-status of the write.
-
-[***@toss3a zfs]$ cat /proc/spl/kstat/zfs/pool/multihost
-39 0 0x01 100 8800 69147946270893 72723903122926
-id txg timestamp error duration mmp_delay vdev_guid
-10607 1166 1518985089 0 138301 637785455 4882...
-10608 1166 1518985089 0 136154 635407747 1151...
-10609 1166 1518985089 0 803618560 633048078 9740...
-10610 1166 1518985090 0 144826 633048078 4882...
-10611 1166 1518985090 0 164527 666187671 1151...
-
-Where duration = gethrtime_in_done_fn - gethrtime_at_submission, and
-error = zio->io_error.
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Olaf Faaland <***@llnl.gov>
-Closes #7190
-(cherry picked from commit 2644784f49a6b6be063d54ca0e1662ee6bef7ebd)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/sys/mmp.h | 1 +
- include/sys/spa.h | 4 +++-
- include/sys/vdev_impl.h | 1 +
- module/zfs/mmp.c | 13 ++++++++++--
- module/zfs/spa_stats.c | 54 ++++++++++++++++++++++++++++++++++++++++---------
- 5 files changed, 60 insertions(+), 13 deletions(-)
-
-diff --git a/include/sys/mmp.h b/include/sys/mmp.h
-index 5b2fea1a6..1ce685f9c 100644
---- a/include/sys/mmp.h
-+++ b/include/sys/mmp.h
-@@ -42,6 +42,7 @@ typedef struct mmp_thread {
- uint64_t mmp_delay; /* decaying avg ns between MMP writes */
- uberblock_t mmp_ub; /* last ub written by sync */
- zio_t *mmp_zio_root; /* root of mmp write zios */
-+ uint64_t mmp_kstat_id; /* unique id for next MMP write kstat */
- } mmp_thread_t;
-
-
-diff --git a/include/sys/spa.h b/include/sys/spa.h
-index 67235871f..53fa5514a 100644
---- a/include/sys/spa.h
-+++ b/include/sys/spa.h
-@@ -759,8 +759,10 @@ extern txg_stat_t *spa_txg_history_init_io(spa_t *, uint64_t,
- struct dsl_pool *);
- extern void spa_txg_history_fini_io(spa_t *, txg_stat_t *);
- extern void spa_tx_assign_add_nsecs(spa_t *spa, uint64_t nsecs);
-+extern int spa_mmp_history_set(spa_t *spa, uint64_t mmp_kstat_id, int io_error,
-+ hrtime_t duration);
- extern void spa_mmp_history_add(uint64_t txg, uint64_t timestamp,
-- uint64_t mmp_delay, vdev_t *vd, int label);
-+ uint64_t mmp_delay, vdev_t *vd, int label, uint64_t mmp_kstat_id);
-
- /* Pool configuration locks */
- extern int spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw);
-diff --git a/include/sys/vdev_impl.h b/include/sys/vdev_impl.h
-index 4c2e3cd2e..13c495822 100644
---- a/include/sys/vdev_impl.h
-+++ b/include/sys/vdev_impl.h
-@@ -238,6 +238,7 @@ struct vdev {
- vdev_aux_t vdev_label_aux; /* on-disk aux state */
- uint64_t vdev_leaf_zap;
- hrtime_t vdev_mmp_pending; /* 0 if write finished */
-+ uint64_t vdev_mmp_kstat_id; /* to find kstat entry */
-
- /*
- * For DTrace to work in userland (libzpool) context, these fields must
-diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
-index d003d79de..ee8e9201b 100644
---- a/module/zfs/mmp.c
-+++ b/module/zfs/mmp.c
-@@ -135,6 +135,7 @@ mmp_init(spa_t *spa)
- mutex_init(&mmp->mmp_thread_lock, NULL, MUTEX_DEFAULT, NULL);
- cv_init(&mmp->mmp_thread_cv, NULL, CV_DEFAULT, NULL);
- mutex_init(&mmp->mmp_io_lock, NULL, MUTEX_DEFAULT, NULL);
-+ mmp->mmp_kstat_id = 1;
- }
-
- void
-@@ -244,7 +245,8 @@ mmp_write_done(zio_t *zio)
- mmp_thread_t *mts = zio->io_private;
-
- mutex_enter(&mts->mmp_io_lock);
-- vd->vdev_mmp_pending = 0;
-+ uint64_t mmp_kstat_id = vd->vdev_mmp_kstat_id;
-+ hrtime_t mmp_write_duration = gethrtime() - vd->vdev_mmp_pending;
-
- if (zio->io_error)
- goto unlock;
-@@ -278,9 +280,15 @@ mmp_write_done(zio_t *zio)
- mts->mmp_last_write = gethrtime();
-
- unlock:
-+ vd->vdev_mmp_pending = 0;
-+ vd->vdev_mmp_kstat_id = 0;
-+
- mutex_exit(&mts->mmp_io_lock);
- spa_config_exit(spa, SCL_STATE, mmp_tag);
-
-+ spa_mmp_history_set(spa, mmp_kstat_id, zio->io_error,
-+ mmp_write_duration);
-+
- abd_free(zio->io_abd);
- }
-
-@@ -333,6 +341,7 @@ mmp_write_uberblock(spa_t *spa)
- ub->ub_mmp_magic = MMP_MAGIC;
- ub->ub_mmp_delay = mmp->mmp_delay;
- vd->vdev_mmp_pending = gethrtime();
-+ vd->vdev_mmp_kstat_id = mmp->mmp_kstat_id++;
-
- zio_t *zio = zio_null(mmp->mmp_zio_root, spa, NULL, NULL, NULL, flags);
- abd_t *ub_abd = abd_alloc_for_io(VDEV_UBERBLOCK_SIZE(vd), B_TRUE);
-@@ -350,7 +359,7 @@ mmp_write_uberblock(spa_t *spa)
- flags | ZIO_FLAG_DONT_PROPAGATE);
-
- spa_mmp_history_add(ub->ub_txg, ub->ub_timestamp, ub->ub_mmp_delay, vd,
-- label);
-+ label, vd->vdev_mmp_kstat_id);
-
- zio_nowait(zio);
- }
-diff --git a/module/zfs/spa_stats.c b/module/zfs/spa_stats.c
-index 7ca359806..58967e9fc 100644
---- a/module/zfs/spa_stats.c
-+++ b/module/zfs/spa_stats.c
-@@ -718,21 +718,24 @@ spa_io_history_destroy(spa_t *spa)
- */
-
- typedef struct spa_mmp_history {
-+ uint64_t mmp_kstat_id; /* unique # for updates */
- uint64_t txg; /* txg of last sync */
- uint64_t timestamp; /* UTC time of of last sync */
- uint64_t mmp_delay; /* nanosec since last MMP write */
- uint64_t vdev_guid; /* unique ID of leaf vdev */
- char *vdev_path;
- uint64_t vdev_label; /* vdev label */
-+ int io_error; /* error status of MMP write */
-+ hrtime_t duration; /* time from submission to completion */
- list_node_t smh_link;
- } spa_mmp_history_t;
-
- static int
- spa_mmp_history_headers(char *buf, size_t size)
- {
-- (void) snprintf(buf, size, "%-10s %-10s %-12s %-24s %-10s %s\n",
-- "txg", "timestamp", "mmp_delay", "vdev_guid", "vdev_label",
-- "vdev_path");
-+ (void) snprintf(buf, size, "%-10s %-10s %-10s %-6s %-10s %-12s %-24s "
-+ "%-10s %s\n", "id", "txg", "timestamp", "error", "duration",
-+ "mmp_delay", "vdev_guid", "vdev_label", "vdev_path");
- return (0);
- }
-
-@@ -741,11 +744,12 @@ spa_mmp_history_data(char *buf, size_t size, void *data)
- {
- spa_mmp_history_t *smh = (spa_mmp_history_t *)data;
-
-- (void) snprintf(buf, size, "%-10llu %-10llu %-12llu %-24llu %-10llu "
-- "%s\n",
-- (u_longlong_t)smh->txg, (u_longlong_t)smh->timestamp,
-- (u_longlong_t)smh->mmp_delay, (u_longlong_t)smh->vdev_guid,
-- (u_longlong_t)smh->vdev_label,
-+ (void) snprintf(buf, size, "%-10llu %-10llu %-10llu %-6lld %-10lld "
-+ "%-12llu %-24llu %-10llu %s\n",
-+ (u_longlong_t)smh->mmp_kstat_id, (u_longlong_t)smh->txg,
-+ (u_longlong_t)smh->timestamp, (longlong_t)smh->io_error,
-+ (longlong_t)smh->duration, (u_longlong_t)smh->mmp_delay,
-+ (u_longlong_t)smh->vdev_guid, (u_longlong_t)smh->vdev_label,
- (smh->vdev_path ? smh->vdev_path : "-"));
-
- return (0);
-@@ -861,11 +865,40 @@ spa_mmp_history_destroy(spa_t *spa)
- }
-
- /*
-- * Add a new MMP update to historical record.
-+ * Set MMP write duration and error status in existing record.
-+ */
-+int
-+spa_mmp_history_set(spa_t *spa, uint64_t mmp_kstat_id, int io_error,
-+ hrtime_t duration)
-+{
-+ spa_stats_history_t *ssh = &spa->spa_stats.mmp_history;
-+ spa_mmp_history_t *smh;
-+ int error = ENOENT;
-+
-+ if (zfs_multihost_history == 0 && ssh->size == 0)
-+ return (0);
-+
-+ mutex_enter(&ssh->lock);
-+ for (smh = list_head(&ssh->list); smh != NULL;
-+ smh = list_next(&ssh->list, smh)) {
-+ if (smh->mmp_kstat_id == mmp_kstat_id) {
-+ smh->io_error = io_error;
-+ smh->duration = duration;
-+ error = 0;
-+ break;
-+ }
-+ }
-+ mutex_exit(&ssh->lock);
-+
-+ return (error);
-+}
-+
-+/*
-+ * Add a new MMP write to historical record.
- */
- void
- spa_mmp_history_add(uint64_t txg, uint64_t timestamp, uint64_t mmp_delay,
-- vdev_t *vd, int label)
-+ vdev_t *vd, int label, uint64_t mmp_kstat_id)
- {
- spa_t *spa = vd->vdev_spa;
- spa_stats_history_t *ssh = &spa->spa_stats.mmp_history;
-@@ -882,6 +915,7 @@ spa_mmp_history_add(uint64_t txg, uint64_t timestamp, uint64_t mmp_delay,
- if (vd->vdev_path)
- smh->vdev_path = strdup(vd->vdev_path);
- smh->vdev_label = label;
-+ smh->mmp_kstat_id = mmp_kstat_id;
-
- mutex_enter(&ssh->lock);
-
---
-2.14.2
-
diff --git a/zfs-patches/0041-Fix-free-memory-calculation-on-v3.14.patch b/zfs-patches/0041-Fix-free-memory-calculation-on-v3.14.patch
deleted file mode 100644
index 5c55057..0000000
--- a/zfs-patches/0041-Fix-free-memory-calculation-on-v3.14.patch
+++ /dev/null
@@ -1,451 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: chrisrd <***@onthe.net.au>
-Date: Sat, 24 Feb 2018 03:50:06 +1100
-Subject: [PATCH] Fix free memory calculation on v3.14+
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Provide infrastructure to auto-configure to enum and API changes in the
-global page stats used for our free memory calculations.
-
-arc_free_memory has been broken since an API change in Linux v3.14:
-
-2016-07-28 v4.8 599d0c95 mm, vmscan: move LRU lists to node
-2016-07-28 v4.8 75ef7184 mm, vmstat: add infrastructure for per-node
- vmstats
-
-These commits moved some of global_page_state() into
-global_node_page_state(). The API change was particularly egregious as,
-instead of breaking the old code, it silently did the wrong thing and we
-continued using global_page_state() where we should have been using
-global_node_page_state(), thus indexing into the wrong array via
-NR_SLAB_RECLAIMABLE et al.
-
-There have been further API changes along the way:
-
-2017-07-06 v4.13 385386cf mm: vmstat: move slab statistics from zone to
- node counters
-2017-09-06 v4.14 c41f012a mm: rename global_page_state to
- global_zone_page_state
-
-...and various (incomplete, as it turns out) attempts to accomodate
-these changes in ZoL:
-
-2017-08-24 2209e409 Linux 4.8+ compatibility fix for vm stats
-2017-09-16 787acae0 Linux 3.14 compat: IO acct, global_page_state, etc
-2017-09-19 661907e6 Linux 4.14 compat: IO acct, global_page_state, etc
-
-The config infrastructure provided here resolves these issues going back
-to the original API change in v3.14 and is robust against further Linux
-changes in this area.
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: George Melikov <***@gmelikov.ru>
-Signed-off-by: Chris Dunlop <***@onthe.net.au>
-Closes #7170
-(cherry picked from commit 338523dd6ec641cc4d552c3f67e1becfb9e22b0a)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/linux/Makefile.am | 3 +-
- scripts/Makefile.am | 2 +
- include/linux/page_compat.h | 78 ++++++++++++++++++++++++++
- module/zfs/arc.c | 23 ++------
- config/kernel-global_page_state.m4 | 109 +++++++++++++++++++++++++++++++++++++
- config/kernel-vm_node_stat.m4 | 22 --------
- config/kernel.m4 | 2 +-
- scripts/enum-extract.pl | 58 ++++++++++++++++++++
- 8 files changed, 256 insertions(+), 41 deletions(-)
- create mode 100644 include/linux/page_compat.h
- create mode 100644 config/kernel-global_page_state.m4
- delete mode 100644 config/kernel-vm_node_stat.m4
- create mode 100755 scripts/enum-extract.pl
-
-diff --git a/include/linux/Makefile.am b/include/linux/Makefile.am
-index 9bb0b3493..89c2689f6 100644
---- a/include/linux/Makefile.am
-+++ b/include/linux/Makefile.am
-@@ -9,7 +9,8 @@ KERNEL_H = \
- $(top_srcdir)/include/linux/kmap_compat.h \
- $(top_srcdir)/include/linux/simd_x86.h \
- $(top_srcdir)/include/linux/simd_aarch64.h \
-- $(top_srcdir)/include/linux/mod_compat.h
-+ $(top_srcdir)/include/linux/mod_compat.h \
-+ $(top_srcdir)/include/linux/page_compat.h
-
- USER_H =
-
-diff --git a/scripts/Makefile.am b/scripts/Makefile.am
-index 74b8b31a5..5a8abd135 100644
---- a/scripts/Makefile.am
-+++ b/scripts/Makefile.am
-@@ -5,6 +5,7 @@ EXTRA_DIST = dkms.mkconf dkms.postbuild kmodtool zfs2zol-patch.sed cstyle.pl
- pkgdatadir = $(datadir)/@PACKAGE@
- dist_pkgdata_SCRIPTS = \
- $(top_builddir)/scripts/common.sh \
-+ $(top_srcdir)/scripts/enum-extract.pl \
- $(top_srcdir)/scripts/zimport.sh \
- $(top_srcdir)/scripts/zfs.sh \
- $(top_srcdir)/scripts/zfs-tests.sh \
-@@ -15,3 +16,4 @@ dist_pkgdata_SCRIPTS = \
- $(top_srcdir)/scripts/zpios-survey.sh \
- $(top_srcdir)/scripts/smb.sh \
- $(top_srcdir)/scripts/zfs-helpers.sh
-+
-diff --git a/include/linux/page_compat.h b/include/linux/page_compat.h
-new file mode 100644
-index 000000000..95acb7d53
---- /dev/null
-+++ b/include/linux/page_compat.h
-@@ -0,0 +1,78 @@
-+#ifndef _ZFS_PAGE_COMPAT_H
-+#define _ZFS_PAGE_COMPAT_H
-+
-+/*
-+ * We have various enum members moving between two separate enum types,
-+ * and accessed by different functions at various times. Centralise the
-+ * insanity.
-+ *
-+ * < v4.8: all enums in zone_stat_item, via global_page_state()
-+ * v4.8: some enums moved to node_stat_item, global_node_page_state() introduced
-+ * v4.13: some enums moved from zone_stat_item to node_state_item
-+ * v4.14: global_page_state() rename to global_zone_page_state()
-+ *
-+ * The defines used here are created by config/kernel-global_page_state.m4
-+ */
-+
-+/*
-+ * Create our own accessor functions to follow the Linux API changes
-+ */
-+#if defined(ZFS_GLOBAL_ZONE_PAGE_STATE)
-+
-+/* global_zone_page_state() introduced */
-+#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES)
-+#define nr_file_pages() global_node_page_state(NR_FILE_PAGES)
-+#else
-+#define nr_file_pages() global_zone_page_state(NR_FILE_PAGES)
-+#endif
-+#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON)
-+#define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON)
-+#else
-+#define nr_inactive_anon_pages() global_zone_page_state(NR_INACTIVE_ANON)
-+#endif
-+#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE)
-+#define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE)
-+#else
-+#define nr_inactive_file_pages() global_zone_page_state(NR_INACTIVE_FILE)
-+#endif
-+#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE)
-+#define nr_slab_reclaimable_pages() global_node_page_state(NR_SLAB_RECLAIMABLE)
-+#else
-+#define nr_slab_reclaimable_pages() global_zone_page_state(NR_SLAB_RECLAIMABLE)
-+#endif
-+
-+#elif defined(ZFS_GLOBAL_NODE_PAGE_STATE)
-+
-+/* global_node_page_state() introduced */
-+#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES)
-+#define nr_file_pages() global_node_page_state(NR_FILE_PAGES)
-+#else
-+#define nr_file_pages() global_page_state(NR_FILE_PAGES)
-+#endif
-+#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON)
-+#define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON)
-+#else
-+#define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON)
-+#endif
-+#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE)
-+#define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE)
-+#else
-+#define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE)
-+#endif
-+#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE)
-+#define nr_slab_reclaimable_pages() global_node_page_state(NR_SLAB_RECLAIMABLE)
-+#else
-+#define nr_slab_reclaimable_pages() global_page_state(NR_SLAB_RECLAIMABLE)
-+#endif
-+
-+#else
-+
-+/* global_page_state() only */
-+#define nr_file_pages() global_page_state(NR_FILE_PAGES)
-+#define nr_inactive_anon_pages() global_page_state(NR_INACTIVE_ANON)
-+#define nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE)
-+#define nr_slab_reclaimable_pages() global_page_state(NR_SLAB_RECLAIMABLE)
-+
-+#endif /* ZFS_GLOBAL_ZONE_PAGE_STATE */
-+
-+#endif /* _ZFS_PAGE_COMPAT_H */
-diff --git a/module/zfs/arc.c b/module/zfs/arc.c
-index 9d1d0db1d..236794672 100644
---- a/module/zfs/arc.c
-+++ b/module/zfs/arc.c
-@@ -280,6 +280,7 @@
- #include <sys/fs/swapnode.h>
- #include <sys/zpl.h>
- #include <linux/mm_compat.h>
-+#include <linux/page_compat.h>
- #endif
- #include <sys/callb.h>
- #include <sys/kstat.h>
-@@ -4016,17 +4017,11 @@ arc_free_memory(void)
- si_meminfo(&si);
- return (ptob(si.freeram - si.freehigh));
- #else
--#ifdef ZFS_GLOBAL_NODE_PAGE_STATE
- return (ptob(nr_free_pages() +
-- global_node_page_state(NR_INACTIVE_FILE) +
-- global_node_page_state(NR_INACTIVE_ANON) +
-- global_node_page_state(NR_SLAB_RECLAIMABLE)));
--#else
-- return (ptob(nr_free_pages() +
-- global_page_state(NR_INACTIVE_FILE) +
-- global_page_state(NR_INACTIVE_ANON) +
-- global_page_state(NR_SLAB_RECLAIMABLE)));
--#endif /* ZFS_GLOBAL_NODE_PAGE_STATE */
-+ nr_inactive_file_pages() +
-+ nr_inactive_anon_pages() +
-+ nr_slab_reclaimable_pages()));
-+
- #endif /* CONFIG_HIGHMEM */
- #else
- return (spa_get_random(arc_all_memory() * 20 / 100));
-@@ -4437,13 +4432,7 @@ arc_evictable_memory(void)
- * Scale reported evictable memory in proportion to page cache, cap
- * at specified min/max.
- */
--#ifdef ZFS_GLOBAL_NODE_PAGE_STATE
-- uint64_t min = (ptob(global_node_page_state(NR_FILE_PAGES)) / 100) *
-- zfs_arc_pc_percent;
--#else
-- uint64_t min = (ptob(global_page_state(NR_FILE_PAGES)) / 100) *
-- zfs_arc_pc_percent;
--#endif
-+ uint64_t min = (ptob(nr_file_pages()) / 100) * zfs_arc_pc_percent;
- min = MAX(arc_c_min, MIN(arc_c_max, min));
-
- if (arc_dirty >= min)
-diff --git a/config/kernel-global_page_state.m4 b/config/kernel-global_page_state.m4
-new file mode 100644
-index 000000000..f4a40011f
---- /dev/null
-+++ b/config/kernel-global_page_state.m4
-@@ -0,0 +1,109 @@
-+dnl #
-+dnl # 4.8 API change
-+dnl #
-+dnl # 75ef71840539 mm, vmstat: add infrastructure for per-node vmstats
-+dnl # 599d0c954f91 mm, vmscan: move LRU lists to node
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE], [
-+ AC_MSG_CHECKING([whether global_node_page_state() exists])
-+ ZFS_LINUX_TRY_COMPILE([
-+ #include <linux/mm.h>
-+ #include <linux/vmstat.h>
-+ ],[
-+ (void) global_node_page_state(0);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(ZFS_GLOBAL_NODE_PAGE_STATE, 1, [global_node_page_state() exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # 4.14 API change
-+dnl #
-+dnl # c41f012ade0b mm: rename global_page_state to global_zone_page_state
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE], [
-+ AC_MSG_CHECKING([whether global_zone_page_state() exists])
-+ ZFS_LINUX_TRY_COMPILE([
-+ #include <linux/mm.h>
-+ #include <linux/vmstat.h>
-+ ],[
-+ (void) global_zone_page_state(0);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(ZFS_GLOBAL_ZONE_PAGE_STATE, 1, [global_zone_page_state() exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # Create a define and autoconf variable for an enum member
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_ENUM_MEMBER], [
-+ AC_MSG_CHECKING([whether enum $2 contains $1])
-+ AS_IF([AC_TRY_COMMAND("${srcdir}/scripts/enum-extract.pl" "$2" "$3" | egrep -qx $1)],[
-+ AC_MSG_RESULT([yes])
-+ AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1, [enum $2 contains $1])
-+ m4_join([_], [ZFS_ENUM], m4_toupper($2), $1)=1
-+ ],[
-+ AC_MSG_RESULT([no])
-+ ])
-+])
-+
-+dnl #
-+dnl # Sanity check helpers
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR],[
-+ AC_MSG_RESULT(no)
-+ AC_MSG_RESULT([$1 in either node_stat_item or zone_stat_item: $2])
-+ AC_MSG_RESULT([configure needs updating, see: config/kernel-global_page_state.m4])
-+ AC_MSG_FAILURE([SHUT 'ER DOWN CLANCY, SHE'S PUMPIN' MUD!])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK], [
-+ enum_check_a="m4_join([_], [$ZFS_ENUM_NODE_STAT_ITEM], $1)"
-+ enum_check_b="m4_join([_], [$ZFS_ENUM_ZONE_STAT_ITEM], $1)"
-+ AS_IF([test -n "$enum_check_a" -a -n "$enum_check_b"],[
-+ ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR([$1], [DUPLICATE])
-+ ])
-+ AS_IF([test -z "$enum_check_a" -a -z "$enum_check_b"],[
-+ ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR([$1], [NOT FOUND])
-+ ])
-+])
-+
-+dnl #
-+dnl # Ensure the config tests are finding one and only one of each enum of interest
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY], [
-+ AC_MSG_CHECKING([global_page_state enums are sane])
-+
-+ ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_FILE_PAGES])
-+ ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_ANON])
-+ ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_FILE])
-+ ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_SLAB_RECLAIMABLE])
-+
-+ AC_MSG_RESULT(yes)
-+])
-+
-+dnl #
-+dnl # enum members in which we're interested
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE], [
-+ ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE
-+ ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE
-+
-+ ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES], [node_stat_item], [$LINUX/include/linux/mmzone.h])
-+ ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON], [node_stat_item], [$LINUX/include/linux/mmzone.h])
-+ ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE], [node_stat_item], [$LINUX/include/linux/mmzone.h])
-+ ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE], [node_stat_item], [$LINUX/include/linux/mmzone.h])
-+
-+ ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
-+ ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
-+ ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
-+ ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
-+
-+ ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY
-+])
-diff --git a/config/kernel-vm_node_stat.m4 b/config/kernel-vm_node_stat.m4
-deleted file mode 100644
-index 5dcd9d827..000000000
---- a/config/kernel-vm_node_stat.m4
-+++ /dev/null
-@@ -1,22 +0,0 @@
--dnl #
--dnl # 4.8 API change
--dnl # kernel vm counters change
--dnl #
--AC_DEFUN([ZFS_AC_KERNEL_VM_NODE_STAT], [
-- AC_MSG_CHECKING([whether to use vm_node_stat based fn's])
-- ZFS_LINUX_TRY_COMPILE([
-- #include <linux/mm.h>
-- #include <linux/vmstat.h>
-- ],[
-- int a __attribute__ ((unused)) = NR_VM_NODE_STAT_ITEMS;
-- long x __attribute__ ((unused)) =
-- atomic_long_read(&vm_node_stat[0]);
-- (void) global_node_page_state(0);
-- ],[
-- AC_MSG_RESULT(yes)
-- AC_DEFINE(ZFS_GLOBAL_NODE_PAGE_STATE, 1,
-- [using global_node_page_state()])
-- ],[
-- AC_MSG_RESULT(no)
-- ])
--])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index 7bb86a96e..3e499e447 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -123,7 +123,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
- ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
- ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
- ZFS_AC_KERNEL_CURRENT_TIME
-- ZFS_AC_KERNEL_VM_NODE_STAT
-+ ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
- ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
-
- AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
-diff --git a/scripts/enum-extract.pl b/scripts/enum-extract.pl
-new file mode 100755
-index 000000000..5112cc807
---- /dev/null
-+++ b/scripts/enum-extract.pl
-@@ -0,0 +1,58 @@
-+#!/usr/bin/perl -w
-+
-+my $usage = <<EOT;
-+usage: config-enum enum [file ...]
-+
-+Returns the elements from an enum declaration.
-+
-+"Best effort": we're not building an entire C interpreter here!
-+EOT
-+
-+use warnings;
-+use strict;
-+use Getopt::Std;
-+
-+my %opts;
-+
-+if (!getopts("", \%opts) || @ARGV < 1) {
-+ print $usage;
-+ exit 2;
-+}
-+
-+my $enum = shift;
-+
-+my $in_enum = 0;
-+
-+while (<>) {
-+ # comments
-+ s/\/\*.*\*\///;
-+ if (m/\/\*/) {
-+ while ($_ .= <>) {
-+ last if s/\/\*.*\*\///s;
-+ }
-+ }
-+
-+ # preprocessor stuff
-+ next if /^#/;
-+
-+ # find our enum
-+ $in_enum = 1 if s/^\s*enum\s+${enum}(?:\s|$)//;
-+ next unless $in_enum;
-+
-+ # remove explicit values
-+ s/\s*=[^,]+,/,/g;
-+
-+ # extract each identifier
-+ while (m/\b([a-z_][a-z0-9_]*)\b/ig) {
-+ print $1, "\n";
-+ }
-+
-+ #
-+ # don't exit: there may be multiple versions of the same enum, e.g.
-+ # inside different #ifdef blocks. Let's explicitly return all of
-+ # them and let external tooling deal with it.
-+ #
-+ $in_enum = 0 if m/}\s*;/;
-+}
-+
-+exit 0;
---
-2.14.2
-
diff --git a/zfs-patches/0042-Add-scrub-after-resilver-zed-script.patch b/zfs-patches/0042-Add-scrub-after-resilver-zed-script.patch
deleted file mode 100644
index ee8b608..0000000
--- a/zfs-patches/0042-Add-scrub-after-resilver-zed-script.patch
+++ /dev/null
@@ -1,516 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Fri, 23 Feb 2018 11:38:05 -0800
-Subject: [PATCH] Add scrub after resilver zed script
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-* Add a zed script to kick off a scrub after a resilver. The script is
-disabled by default.
-
-* Add a optional $PATH (-P) option to zed to allow it to use a custom
-$PATH for its zedlets. This is needed when you're running zed under
-the ZTS in a local workspace.
-
-* Update test scripts to not copy in all-debug.sh and all-syslog.sh by
-default. They can be optionally copied in as part of zed_setup().
-These scripts slow down zed considerably under heavy events loads and
-can cause events to be dropped or their delivery delayed. This was
-causing some sporadic failures in the 'fault' tests.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: Richard Laager <***@wiktel.com>
-Signed-off-by: Tony Hutter <***@llnl.gov>
-Closes #4662
-Closes #7086
-(cherry picked from commit 99920d823e8e1510a0ad133c985bd2aa11a02834)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/zed/Makefile.am | 6 +-
- tests/zfs-tests/tests/functional/fault/Makefile.am | 3 +-
- cmd/zed/zed_conf.h | 1 +
- man/man8/zed.8.in | 10 +++-
- cmd/zed/zed_conf.c | 7 ++-
- cmd/zed/zed_event.c | 34 +++++++++--
- cmd/zed/zed.d/resilver_finish-start-scrub.sh | 17 ++++++
- cmd/zed/zed.d/zed.rc | 3 +
- tests/runfiles/linux.run | 2 +-
- tests/zfs-tests/include/commands.cfg | 1 +
- tests/zfs-tests/include/libtest.shlib | 50 ++++++++++++++---
- .../zfs-tests/tests/functional/events/cleanup.ksh | 2 +-
- tests/zfs-tests/tests/functional/events/setup.ksh | 2 +-
- tests/zfs-tests/tests/functional/fault/cleanup.ksh | 2 +-
- .../functional/fault/scrub_after_resilver.ksh | 65 ++++++++++++++++++++++
- tests/zfs-tests/tests/functional/fault/setup.ksh | 2 +-
- 16 files changed, 186 insertions(+), 21 deletions(-)
- create mode 100755 cmd/zed/zed.d/resilver_finish-start-scrub.sh
- create mode 100755 tests/zfs-tests/tests/functional/fault/scrub_after_resilver.ksh
-
-diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am
-index 97733a512..ee44898cd 100644
---- a/cmd/zed/Makefile.am
-+++ b/cmd/zed/Makefile.am
-@@ -69,7 +69,8 @@ dist_zedexec_SCRIPTS = \
- zed.d/statechange-notify.sh \
- zed.d/vdev_clear-led.sh \
- zed.d/vdev_attach-led.sh \
-- zed.d/pool_import-led.sh
-+ zed.d/pool_import-led.sh \
-+ zed.d/resilver_finish-start-scrub.sh
-
- zedconfdefaults = \
- all-syslog.sh \
-@@ -80,7 +81,8 @@ zedconfdefaults = \
- statechange-notify.sh \
- vdev_clear-led.sh \
- vdev_attach-led.sh \
-- pool_import-led.sh
-+ pool_import-led.sh \
-+ resilver_finish-start-scrub.sh
-
- install-data-hook:
- $(MKDIR_P) "$(DESTDIR)$(zedconfdir)"
-diff --git a/tests/zfs-tests/tests/functional/fault/Makefile.am b/tests/zfs-tests/tests/functional/fault/Makefile.am
-index eeff31261..abe28501d 100644
---- a/tests/zfs-tests/tests/functional/fault/Makefile.am
-+++ b/tests/zfs-tests/tests/functional/fault/Makefile.am
-@@ -4,4 +4,5 @@ dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- auto_online_001_pos.ksh \
-- auto_replace_001_pos.ksh
-+ auto_replace_001_pos.ksh \
-+ scrub_after_resilver.ksh
-diff --git a/cmd/zed/zed_conf.h b/cmd/zed/zed_conf.h
-index 2bc634134..7d6b63b1d 100644
---- a/cmd/zed/zed_conf.h
-+++ b/cmd/zed/zed_conf.h
-@@ -37,6 +37,7 @@ struct zed_conf {
- int state_fd; /* fd to state file */
- libzfs_handle_t *zfs_hdl; /* handle to libzfs */
- int zevent_fd; /* fd for access to zevents */
-+ char *path; /* custom $PATH for zedlets to use */
- };
-
- struct zed_conf *zed_conf_create(void);
-diff --git a/man/man8/zed.8.in b/man/man8/zed.8.in
-index 2ab088d98..645e91795 100644
---- a/man/man8/zed.8.in
-+++ b/man/man8/zed.8.in
-@@ -27,6 +27,7 @@ ZED \- ZFS Event Daemon
- [\fB\-L\fR]
- [\fB\-M\fR]
- [\fB\-p\fR \fIpidfile\fR]
-+[\fB\-P\fR \fIpath\fR]
- [\fB\-s\fR \fIstatefile\fR]
- [\fB\-v\fR]
- [\fB\-V\fR]
-@@ -78,9 +79,16 @@ Read the enabled ZEDLETs from the specified directory.
- .BI \-p\ pidfile
- Write the daemon's process ID to the specified file.
- .TP
-+.BI \-P\ path
-+Custom $PATH for zedlets to use. Normally zedlets run in a locked-down
-+environment, with hardcoded paths to the ZFS commands ($ZFS, $ZPOOL, $ZED, ...),
-+and a hardcoded $PATH. This is done for security reasons. However, the
-+ZFS test suite uses a custom PATH for its ZFS commands, and passes it to zed
-+with -P. In short, -P is only to be used by the ZFS test suite; never use
-+it in production!
-+.TP
- .BI \-s\ statefile
- Write the daemon's state to the specified file.
--
- .SH ZEVENTS
- .PP
- A zevent is comprised of a list of nvpairs (name/value pairs). Each zevent
-diff --git a/cmd/zed/zed_conf.c b/cmd/zed/zed_conf.c
-index 5b27f1e4f..86671369c 100644
---- a/cmd/zed/zed_conf.c
-+++ b/cmd/zed/zed_conf.c
-@@ -155,6 +155,8 @@ _zed_conf_display_help(const char *prog, int got_err)
- "Run daemon in the foreground.");
- fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-M",
- "Lock all pages in memory.");
-+ fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-P",
-+ "$PATH for ZED to use (only used by ZTS).");
- fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-Z",
- "Zero state file.");
- fprintf(fp, "\n");
-@@ -247,7 +249,7 @@ _zed_conf_parse_path(char **resultp, const char *path)
- void
- zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
- {
-- const char * const opts = ":hLVc:d:p:s:vfFMZ";
-+ const char * const opts = ":hLVc:d:p:P:s:vfFMZ";
- int opt;
-
- if (!zcp || !argv || !argv[0])
-@@ -275,6 +277,9 @@ zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
- case 'p':
- _zed_conf_parse_path(&zcp->pid_file, optarg);
- break;
-+ case 'P':
-+ _zed_conf_parse_path(&zcp->path, optarg);
-+ break;
- case 's':
- _zed_conf_parse_path(&zcp->state_file, optarg);
- break;
-diff --git a/cmd/zed/zed_event.c b/cmd/zed/zed_event.c
-index 390235019..2a7ff16fd 100644
---- a/cmd/zed/zed_event.c
-+++ b/cmd/zed/zed_event.c
-@@ -733,12 +733,14 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
-
- /*
- * Restrict various environment variables to safe and sane values
-- * when constructing the environment for the child process.
-+ * when constructing the environment for the child process, unless
-+ * we're running with a custom $PATH (like under the ZFS test suite).
- *
- * Reference: Secure Programming Cookbook by Viega & Messier, Section 1.1.
- */
- static void
--_zed_event_add_env_restrict(uint64_t eid, zed_strings_t *zsp)
-+_zed_event_add_env_restrict(uint64_t eid, zed_strings_t *zsp,
-+ const char *path)
- {
- const char *env_restrict[][2] = {
- { "IFS", " \t\n" },
-@@ -753,11 +755,35 @@ _zed_event_add_env_restrict(uint64_t eid, zed_strings_t *zsp)
- { "ZFS_RELEASE", ZFS_META_RELEASE },
- { NULL, NULL }
- };
-+
-+ /*
-+ * If we have a custom $PATH, use the default ZFS binary locations
-+ * instead of the hard-coded ones.
-+ */
-+ const char *env_path[][2] = {
-+ { "IFS", " \t\n" },
-+ { "PATH", NULL }, /* $PATH copied in later on */
-+ { "ZDB", "zdb" },
-+ { "ZED", "zed" },
-+ { "ZFS", "zfs" },
-+ { "ZINJECT", "zinject" },
-+ { "ZPOOL", "zpool" },
-+ { "ZFS_ALIAS", ZFS_META_ALIAS },
-+ { "ZFS_VERSION", ZFS_META_VERSION },
-+ { "ZFS_RELEASE", ZFS_META_RELEASE },
-+ { NULL, NULL }
-+ };
- const char *(*pa)[2];
-
- assert(zsp != NULL);
-
-- for (pa = env_restrict; *(*pa); pa++) {
-+ pa = path != NULL ? env_path : env_restrict;
-+
-+ for (; *(*pa); pa++) {
-+ /* Use our custom $PATH if we have one */
-+ if (path != NULL && strcmp((*pa)[0], "PATH") == 0)
-+ (*pa)[1] = path;
-+
- _zed_event_add_var(eid, zsp, NULL, (*pa)[0], "%s", (*pa)[1]);
- }
- }
-@@ -902,7 +928,7 @@ zed_event_service(struct zed_conf *zcp)
- while ((nvp = nvlist_next_nvpair(nvl, nvp)))
- _zed_event_add_nvpair(eid, zsp, nvp);
-
-- _zed_event_add_env_restrict(eid, zsp);
-+ _zed_event_add_env_restrict(eid, zsp, zcp->path);
- _zed_event_add_env_preserve(eid, zsp);
-
- _zed_event_add_var(eid, zsp, ZED_VAR_PREFIX, "PID",
-diff --git a/cmd/zed/zed.d/resilver_finish-start-scrub.sh b/cmd/zed/zed.d/resilver_finish-start-scrub.sh
-new file mode 100755
-index 000000000..6f9c0b309
---- /dev/null
-+++ b/cmd/zed/zed.d/resilver_finish-start-scrub.sh
-@@ -0,0 +1,17 @@
-+#!/bin/sh
-+# resilver_finish-start-scrub.sh
-+# Run a scrub after a resilver
-+#
-+# Exit codes:
-+# 1: Internal error
-+# 2: Script wasn't enabled in zed.rc
-+[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
-+. "${ZED_ZEDLET_DIR}/zed-functions.sh"
-+
-+[ "${ZED_SCRUB_AFTER_RESILVER}" = "1" ] || exit 2
-+[ -n "${ZEVENT_POOL}" ] || exit 1
-+[ -n "${ZEVENT_SUBCLASS}" ] || exit 1
-+zed_check_cmd "${ZPOOL}" || exit 1
-+
-+zed_log_msg "Starting scrub after resilver on ${ZEVENT_POOL}"
-+"${ZPOOL}" scrub "${ZEVENT_POOL}"
-diff --git a/cmd/zed/zed.d/zed.rc b/cmd/zed/zed.d/zed.rc
-index a1dd33704..8b0e476d5 100644
---- a/cmd/zed/zed.d/zed.rc
-+++ b/cmd/zed/zed.d/zed.rc
-@@ -86,6 +86,9 @@
- #
- ZED_USE_ENCLOSURE_LEDS=1
-
-+##
-+# Run a scrub after every resilver
-+#ZED_SCRUB_AFTER_RESILVER=1
-
- ##
- # The syslog priority (e.g., specified as a "facility.level" pair).
-diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
-index 8be3e1c62..89c923db1 100644
---- a/tests/runfiles/linux.run
-+++ b/tests/runfiles/linux.run
-@@ -421,7 +421,7 @@ tests = ['exec_001_pos', 'exec_002_neg']
- tags = ['functional', 'exec']
-
- [tests/functional/fault]
--tests = ['auto_online_001_pos', 'auto_replace_001_pos']
-+tests = ['auto_online_001_pos', 'auto_replace_001_pos', 'scrub_after_resilver']
- tags = ['functional', 'fault']
-
- [tests/functional/features/async_destroy]
-diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg
-index f6fd239de..936e54c1a 100644
---- a/tests/zfs-tests/include/commands.cfg
-+++ b/tests/zfs-tests/include/commands.cfg
-@@ -83,6 +83,7 @@ export SYSTEM_FILES='arp
- pgrep
- ping
- pkill
-+ printenv
- printf
- ps
- pwd
-diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
-index 86f172a6d..48fb5e7c5 100644
---- a/tests/zfs-tests/include/libtest.shlib
-+++ b/tests/zfs-tests/include/libtest.shlib
-@@ -3339,9 +3339,32 @@ function wait_replacing #pool
- done
- }
-
-+#
-+# Wait for a pool to be scrubbed
-+#
-+# $1 pool name
-+# $2 number of seconds to wait (optional)
-+#
-+# Returns true when pool has been scrubbed, or false if there's a timeout or if
-+# no scrub was done.
-+#
-+function wait_scrubbed
-+{
-+ typeset pool=${1:-$TESTPOOL}
-+ typeset iter=${2:-10}
-+ for i in {1..$iter} ; do
-+ if is_pool_scrubbed $pool ; then
-+ return 0
-+ fi
-+ sleep 1
-+ done
-+ return 1
-+}
-+
- #
- # Setup custom environment for the ZED.
- #
-+# $@ Optional list of zedlets to run under zed.
- function zed_setup
- {
- if ! is_linux; then
-@@ -3359,6 +3382,7 @@ function zed_setup
- if [[ -e $VDEVID_CONF_ETC ]]; then
- log_fail "Must not have $VDEVID_CONF_ETC file present on system"
- fi
-+ EXTRA_ZEDLETS=$@
-
- # Create a symlink for /etc/zfs/vdev_id.conf file.
- log_must ln -s $VDEVID_CONF $VDEVID_CONF_ETC
-@@ -3368,32 +3392,44 @@ function zed_setup
- log_must cp ${ZEDLET_ETC_DIR}/zed.rc $ZEDLET_DIR
- log_must cp ${ZEDLET_ETC_DIR}/zed-functions.sh $ZEDLET_DIR
-
-+ # Scripts must only be user writable.
-+ if [[ -n "$EXTRA_ZEDLETS" ]] ; then
-+ saved_umask=$(umask)
-+ log_must umask 0022
-+ for i in $EXTRA_ZEDLETS ; do
-+ log_must cp ${ZEDLET_LIBEXEC_DIR}/$i $ZEDLET_DIR
-+ done
-+ log_must umask $saved_umask
-+ fi
-+
- # Customize the zed.rc file to enable the full debug log.
- log_must sed -i '/\#ZED_DEBUG_LOG=.*/d' $ZEDLET_DIR/zed.rc
- echo "ZED_DEBUG_LOG=$ZED_DEBUG_LOG" >>$ZEDLET_DIR/zed.rc
-
-- # Scripts must only be user writable.
-- saved_umask=$(umask)
-- log_must umask 0022
-- log_must cp ${ZEDLET_LIBEXEC_DIR}/all-syslog.sh $ZEDLET_DIR
-- log_must cp ${ZEDLET_LIBEXEC_DIR}/all-debug.sh $ZEDLET_DIR
-- log_must umask $saved_umask
- }
-
- #
- # Cleanup custom ZED environment.
- #
-+# $@ Optional list of zedlets to remove from our test zed.d directory.
- function zed_cleanup
- {
- if ! is_linux; then
- return
- fi
-+ EXTRA_ZEDLETS=$@
-
- log_must rm -f ${ZEDLET_DIR}/zed.rc
- log_must rm -f ${ZEDLET_DIR}/zed-functions.sh
- log_must rm -f ${ZEDLET_DIR}/all-syslog.sh
- log_must rm -f ${ZEDLET_DIR}/all-debug.sh
- log_must rm -f ${ZEDLET_DIR}/state
-+
-+ if [[ -n "$EXTRA_ZEDLETS" ]] ; then
-+ for i in $EXTRA_ZEDLETS ; do
-+ log_must rm -f ${ZEDLET_DIR}/$i
-+ done
-+ fi
- log_must rm -f $ZED_LOG
- log_must rm -f $ZED_DEBUG_LOG
- log_must rm -f $VDEVID_CONF_ETC
-@@ -3425,7 +3461,7 @@ function zed_start
- # run ZED in the background and redirect foreground logging
- # output to $ZED_LOG.
- log_must truncate -s 0 $ZED_DEBUG_LOG
-- log_must eval "zed -vF -d $ZEDLET_DIR -p $ZEDLET_DIR/zed.pid" \
-+ log_must eval "zed -vF -d $ZEDLET_DIR -p $ZEDLET_DIR/zed.pid -P $PATH" \
- "-s $ZEDLET_DIR/state 2>$ZED_LOG &"
-
- return 0
-diff --git a/tests/zfs-tests/tests/functional/events/cleanup.ksh b/tests/zfs-tests/tests/functional/events/cleanup.ksh
-index bc536e260..4905342b7 100755
---- a/tests/zfs-tests/tests/functional/events/cleanup.ksh
-+++ b/tests/zfs-tests/tests/functional/events/cleanup.ksh
-@@ -26,6 +26,6 @@
-
- . $STF_SUITE/include/libtest.shlib
-
--zed_cleanup
-+zed_cleanup all-debug.sh all-syslog.sh
-
- default_cleanup
-diff --git a/tests/zfs-tests/tests/functional/events/setup.ksh b/tests/zfs-tests/tests/functional/events/setup.ksh
-index 7113c1f39..2f81d16b1 100755
---- a/tests/zfs-tests/tests/functional/events/setup.ksh
-+++ b/tests/zfs-tests/tests/functional/events/setup.ksh
-@@ -28,6 +28,6 @@
-
- DISK=${DISKS%% *}
-
--zed_setup
-+zed_setup all-debug.sh all-syslog.sh
-
- default_setup $DISK
-diff --git a/tests/zfs-tests/tests/functional/fault/cleanup.ksh b/tests/zfs-tests/tests/functional/fault/cleanup.ksh
-index f39f05d6f..d3de742b3 100755
---- a/tests/zfs-tests/tests/functional/fault/cleanup.ksh
-+++ b/tests/zfs-tests/tests/functional/fault/cleanup.ksh
-@@ -31,7 +31,7 @@ verify_runnable "global"
- cleanup_devices $DISKS
-
- zed_stop
--zed_cleanup
-+zed_cleanup resilver_finish-start-scrub.sh
-
- SD=$(lsscsi | nawk '/scsi_debug/ {print $6; exit}')
- SDDEVICE=$(echo $SD | nawk -F / '{print $3}')
-diff --git a/tests/zfs-tests/tests/functional/fault/scrub_after_resilver.ksh b/tests/zfs-tests/tests/functional/fault/scrub_after_resilver.ksh
-new file mode 100755
-index 000000000..558cb065f
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/fault/scrub_after_resilver.ksh
-@@ -0,0 +1,65 @@
-+#!/bin/ksh -p
-+#
-+# This file and its contents are supplied under the terms of the
-+# Common Development and Distribution License ("CDDL"), version 1.0.
-+# You may only use this file in accordance with the terms of version
-+# 1.0 of the CDDL.
-+#
-+# A full copy of the text of the CDDL should have accompanied this
-+# source. A copy of the CDDL is also available via the Internet at
-+# http://www.illumos.org/license/CDDL.
-+#
-+
-+#
-+# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
-+# All rights reserved.
-+#
-+
-+. $STF_SUITE/include/libtest.shlib
-+. $STF_SUITE/tests/functional/fault/fault.cfg
-+
-+#
-+# DESCRIPTION:
-+# Test the scrub after resilver zedlet
-+#
-+# STRATEGY:
-+# 1. Create a mirrored pool
-+# 2. Fault a disk
-+# 3. Replace the disk, starting a resilver
-+# 4. Verify that a scrub happens after the resilver finishes
-+#
-+
-+log_assert "Testing the scrub after resilver zedlet"
-+
-+# Backup our zed.rc
-+zedrc_backup="$(mktemp)"
-+log_must cp $ZEDLET_DIR/zed.rc $zedrc_backup
-+
-+# Enable ZED_SCRUB_AFTER_RESILVER
-+eval "sed -i 's/\#ZED_SCRUB_AFTER_RESILVER/ZED_SCRUB_AFTER_RESILVER/g' $ZEDLET_DIR/zed.rc"
-+
-+function cleanup
-+{
-+ # Restore our zed.rc
-+ log_must mv $zedrc_backup $ZEDLET_DIR/zed.rc
-+ default_cleanup_noexit
-+}
-+
-+log_onexit cleanup
-+
-+verify_disk_count "$DISKS" 3
-+default_mirror_setup_noexit $DISK1 $DISK2
-+
-+log_must zpool offline -f $TESTPOOL $DISK1
-+
-+# Write to our degraded pool so we have some data to resilver
-+log_must mkfile 16M $TESTDIR/file1
-+
-+# Replace the failed disks, forcing a resilver
-+log_must zpool replace $TESTPOOL $DISK1 $DISK3
-+
-+# Wait for the resilver to finish, and then the subsequent scrub to finish.
-+# Waiting for the scrub has the effect of waiting for both. Timeout after 10
-+# seconds if nothing is happening.
-+log_must wait_scrubbed $TESTPOOL 10
-+log_pass "Successfully ran the scrub after resilver zedlet"
-diff --git a/tests/zfs-tests/tests/functional/fault/setup.ksh b/tests/zfs-tests/tests/functional/fault/setup.ksh
-index 3d54d4f21..484bc4587 100755
---- a/tests/zfs-tests/tests/functional/fault/setup.ksh
-+++ b/tests/zfs-tests/tests/functional/fault/setup.ksh
-@@ -28,7 +28,7 @@
-
- verify_runnable "global"
-
--zed_setup
-+zed_setup resilver_finish-start-scrub.sh
- zed_start
-
- # Create a scsi_debug device to be used with auto-online (if using loop devices)
---
-2.14.2
-
diff --git a/zfs-patches/0043-Add-SMART-self-test-results-to-zpool-status-c.patch b/zfs-patches/0043-Add-SMART-self-test-results-to-zpool-status-c.patch
deleted file mode 100644
index a562ecd..0000000
--- a/zfs-patches/0043-Add-SMART-self-test-results-to-zpool-status-c.patch
+++ /dev/null
@@ -1,322 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Tue, 27 Feb 2018 09:31:27 -0800
-Subject: [PATCH] Add SMART self-test results to zpool status -c
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add in SMART self-test results to zpool status|iostat -c. This
-works for both SAS and SATA drives.
-
-Also, add plumbing to allow the 'smart' script to take smartctl
-output from a directory of output text files instead of running
-it against the vdevs.
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Tony Hutter <***@llnl.gov>
-Closes #7178
-(cherry picked from commit 5e3085e360161456fe2af697494c479de0ee2085)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/zpool/Makefile.am | 14 ++++-
- cmd/zpool/zpool.d/smart | 132 +++++++++++++++++++++++++++++++++++-----
- cmd/zpool/zpool.d/smart_test | 1 +
- cmd/zpool/zpool.d/test_ended | 1 +
- cmd/zpool/zpool.d/test_progress | 1 +
- cmd/zpool/zpool.d/test_status | 1 +
- cmd/zpool/zpool.d/test_type | 1 +
- 7 files changed, 133 insertions(+), 18 deletions(-)
- create mode 120000 cmd/zpool/zpool.d/smart_test
- create mode 120000 cmd/zpool/zpool.d/test_ended
- create mode 120000 cmd/zpool/zpool.d/test_progress
- create mode 120000 cmd/zpool/zpool.d/test_status
- create mode 120000 cmd/zpool/zpool.d/test_type
-
-diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am
-index c7b8b76e3..d07f8d616 100644
---- a/cmd/zpool/Makefile.am
-+++ b/cmd/zpool/Makefile.am
-@@ -63,7 +63,12 @@ dist_zpoolexec_SCRIPTS = \
- zpool.d/nvme_err \
- zpool.d/pwr_cyc \
- zpool.d/upath \
-- zpool.d/vendor
-+ zpool.d/vendor \
-+ zpool.d/smart_test \
-+ zpool.d/test_type \
-+ zpool.d/test_status \
-+ zpool.d/test_progress \
-+ zpool.d/test_ended
-
- zpoolconfdefaults = \
- enc \
-@@ -102,7 +107,12 @@ zpoolconfdefaults = \
- nvme_err \
- pwr_cyc \
- upath \
-- vendor
-+ vendor \
-+ smart_test \
-+ test_type \
-+ test_status \
-+ test_progress \
-+ test_ended
-
- install-data-hook:
- $(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)"
-diff --git a/cmd/zpool/zpool.d/smart b/cmd/zpool/zpool.d/smart
-index 4bc3af39d..64b5f6e4e 100755
---- a/cmd/zpool/zpool.d/smart
-+++ b/cmd/zpool/zpool.d/smart
-@@ -24,8 +24,44 @@ ata_err: Show SMART ATA errors (ATA).
- pwr_cyc: Show SMART power cycle count (ATA).
- serial: Show disk serial number.
- nvme_err: Show SMART NVMe errors (NVMe).
-+smart_test: Show SMART self-test results summary.
-+test_type: Show SMART self-test type (short, long... ).
-+test_status: Show SMART self-test status.
-+test_progress: Show SMART self-test percentage done.
-+test_ended: Show when the last SMART self-test ended (if supported).
- "
-
-+# Hack for developer testing
-+#
-+# If you set $samples to a directory containing smartctl output text files,
-+# we will use them instead of running smartctl on the vdevs. This can be
-+# useful if you want to test a bunch of different smartctl outputs. Also, if
-+# $samples is set, and additional 'file' column is added to the zpool output
-+# showing the filename.
-+samples=
-+
-+# get_filename_from_dir DIR
-+#
-+# Look in directory DIR and return a filename from it. The filename returned
-+# is chosen quasi-sequentially (based off our PID). This allows us to return
-+# a different filename every time this script is invoked (which we do for each
-+# vdev), without having to maintain state.
-+get_filename_from_dir()
-+{
-+ dir=$1
-+ pid="$$"
-+ num_files=$(find "$dir" -maxdepth 1 -type f | wc -l)
-+ mod=$((pid % num_files))
-+ i=0
-+ find "$dir" -type f -printf "%f\n" | while read -r file ; do
-+ if [ "$mod" = "$i" ] ; then
-+ echo "$file"
-+ break
-+ fi
-+ i=$((i+1))
-+ done
-+}
-+
- script=$(basename "$0")
-
- if [ "$1" = "-h" ] ; then
-@@ -35,8 +71,16 @@ fi
-
- smartctl_path=$(which smartctl)
-
--if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ]; then
-- raw_out=$(eval "sudo $smartctl_path -a $VDEV_UPATH")
-+if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ] || [ -n "$samples" ] ; then
-+ if [ -n "$samples" ] ; then
-+ # cat a smartctl output text file instead of running smartctl
-+ # on a vdev (only used for developer testing).
-+ file=$(get_filename_from_dir $samples)
-+ echo "file=$file"
-+ raw_out=$(cat "$samples/$file")
-+ else
-+ raw_out=$(eval "sudo $smartctl_path -a $VDEV_UPATH")
-+ fi
-
- # What kind of drive are we? Look for the right line in smartctl:
- #
-@@ -49,7 +93,6 @@ if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ]; then
- # NVMe:
- # SMART/Health Information (NVMe Log 0xnn, NSID 0xnn)
- #
-- type=$(echo "$raw_out" | grep -m 1 -Eo '^ATA|NVMe|SAS$')
- out=$(echo "$raw_out" | awk '
- # SAS specific
- /read:/{print "rrd="$4"\nr_cor="$5"\nr_proc="$7"\nr_ucor="$8}
-@@ -58,10 +101,11 @@ if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ]; then
- /Elements in grown defect list/{print "defect="$6}
-
- # SAS common
-+/SAS/{type="sas"}
- /Drive Temperature:/{print "temp="$4}
- # Status can be a long string, substitute spaces for '_'
- /SMART Health Status:/{printf "health="; for(i=4;i<=NF-1;i++){printf "%s_", $i}; printf "%s\n", $i}
--/number of hours powered up/{print "hours_on="$7}
-+/number of hours powered up/{print "hours_on="$7; hours_on=int($7)}
- /Serial number:/{print "serial="$3}
-
- # SATA specific
-@@ -74,13 +118,16 @@ if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ]; then
- /Power_Cycle_Count/{print "pwr_cyc="$10}
-
- # SATA common
-+/SATA/{type="sata"}
- /Temperature_Celsius/{print "temp="$10}
- /Airflow_Temperature_Cel/{print "temp="$10}
-+/Current Temperature:/{print "temp="$3}
- /SMART overall-health self-assessment test result:/{print "health="$6}
--/Power_On_Hours/{print "hours_on="$10}
-+/Power_On_Hours/{print "hours_on="$10; hours_on=int($10)}
- /Serial Number:/{print "serial="$3}
-
- # NVMe common
-+/NVMe/{type="nvme"}
- /Temperature:/{print "temp="$2}
- /SMART overall-health self-assessment test result:/{print "health="$6}
- /Power On Hours:/{gsub("[^0-9]","",$4); print "hours_on="$4}
-@@ -90,39 +137,92 @@ if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ]; then
- # NVMe specific
- /Media and Data Integrity Errors:/{print "nvme_err="$6}
-
--END {ORS="\n"; print ""}
-+# SMART self-test info
-+/Self-test execution status:/{progress=tolower($4)} # SAS
-+/SMART Self-test log/{test_seen=1} # SAS
-+/SMART Extended Self-test Log/{test_seen=1} # SATA
-+/# 1/{
-+ test_type=tolower($3"_"$4);
-+ # Status could be one word ("Completed") or multiple ("Completed: read
-+ # failure"). Look for the ":" to see if we need to grab more words.
-+
-+ if ($5 ~ ":")
-+ status=tolower($5""$6"_"$7)
-+ else
-+ status=tolower($5)
-+ if (status=="self")
-+ status="running";
-+
-+ if (type == "sas") {
-+ hours=int($(NF-4))
-+ } else {
-+ hours=int($(NF-1))
-+ # SATA reports percent remaining, rather than percent done
-+ # Convert it to percent done.
-+ progress=(100-int($(NF-2)))"%"
-+ }
-+ # When we int()-ify "hours", it converts stuff like "NOW" and "-" into
-+ # 0. In those cases, set it to hours_on, so they will cancel out in
-+ # the "hours_ago" calculation later on.
-+ if (hours == 0)
-+ hours=hours_on
-+
-+ if (test_seen) {
-+ print "test="hours_on
-+ print "test_type="test_type
-+ print "test_status="status
-+ print "test_progress="progress
-+ }
-+ # Not all drives report hours_on
-+ if (hours_on && hours) {
-+ total_hours_ago=(hours_on-hours)
-+ days_ago=int(total_hours_ago/24)
-+ hours_ago=(total_hours_ago % 24)
-+ if (days_ago != 0)
-+ ago_str=days_ago"d"
-+ if (hours_ago !=0)
-+ ago_str=ago_str""hours_ago"h"
-+ print "test_ended="ago_str
-+ }
-+}
-+
-+END {print "type="type; ORS="\n"; print ""}
- ');
- fi
-+type=$(echo "$out" | grep '^type=' | cut -d '=' -f 2)
-
--# if type is not set by now, either we don't have a block device
--# or smartctl failed. Either way, default to ATA and set out to
--# nothing
-+# If type is not set by now, either we don't have a block device
-+# or smartctl failed. Either way, default to ATA and set $out to
-+# nothing.
- if [ -z "$type" ]; then
-- type="ATA"
-+ type="sata"
- out=
- fi
-
- case $script in
- smart)
- # Print temperature plus common predictors of drive failure
-- if [ "$type" = "SAS" ] ; then
-+ if [ "$type" = "sas" ] ; then
- scripts="temp|health|r_ucor|w_ucor"
-- elif [ "$type" = "ATA" ] ; then
-+ elif [ "$type" = "sata" ] ; then
- scripts="temp|health|ata_err|realloc|rep_ucor|cmd_to|pend_sec|off_ucor"
-- elif [ "$type" = "NVMe" ] ; then
-+ elif [ "$type" = "nvme" ] ; then
- scripts="temp|health|nvme_err"
- fi
- ;;
- smartx)
- # Print some other interesting stats
-- if [ "$type" = "SAS" ] ; then
-+ if [ "$type" = "sas" ] ; then
- scripts="hours_on|defect|nonmed|r_proc|w_proc"
-- elif [ "$type" = "ATA" ] ; then
-+ elif [ "$type" = "sata" ] ; then
- scripts="hours_on|pwr_cyc"
-- elif [ "$type" = "NVMe" ] ; then
-+ elif [ "$type" = "nvme" ] ; then
- scripts="hours_on|pwr_cyc"
- fi
- ;;
-+smart_test)
-+ scripts="test_type|test_status|test_progress|test_ended"
-+ ;;
- *)
- scripts="$script"
- esac
-diff --git a/cmd/zpool/zpool.d/smart_test b/cmd/zpool/zpool.d/smart_test
-new file mode 120000
-index 000000000..94f22861f
---- /dev/null
-+++ b/cmd/zpool/zpool.d/smart_test
-@@ -0,0 +1 @@
-+smart
-\ No newline at end of file
-diff --git a/cmd/zpool/zpool.d/test_ended b/cmd/zpool/zpool.d/test_ended
-new file mode 120000
-index 000000000..94f22861f
---- /dev/null
-+++ b/cmd/zpool/zpool.d/test_ended
-@@ -0,0 +1 @@
-+smart
-\ No newline at end of file
-diff --git a/cmd/zpool/zpool.d/test_progress b/cmd/zpool/zpool.d/test_progress
-new file mode 120000
-index 000000000..94f22861f
---- /dev/null
-+++ b/cmd/zpool/zpool.d/test_progress
-@@ -0,0 +1 @@
-+smart
-\ No newline at end of file
-diff --git a/cmd/zpool/zpool.d/test_status b/cmd/zpool/zpool.d/test_status
-new file mode 120000
-index 000000000..94f22861f
---- /dev/null
-+++ b/cmd/zpool/zpool.d/test_status
-@@ -0,0 +1 @@
-+smart
-\ No newline at end of file
-diff --git a/cmd/zpool/zpool.d/test_type b/cmd/zpool/zpool.d/test_type
-new file mode 120000
-index 000000000..94f22861f
---- /dev/null
-+++ b/cmd/zpool/zpool.d/test_type
-@@ -0,0 +1 @@
-+smart
-\ No newline at end of file
---
-2.14.2
-
diff --git a/zfs-patches/0044-Fix-zpool-8-list-example-to-match-actual-format.patch b/zfs-patches/0044-Fix-zpool-8-list-example-to-match-actual-format.patch
deleted file mode 100644
index 6817629..0000000
--- a/zfs-patches/0044-Fix-zpool-8-list-example-to-match-actual-format.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tomohiro Kusumi <***@gmail.com>
-Date: Thu, 1 Mar 2018 01:54:53 +0900
-Subject: [PATCH] Fix zpool(8) list example to match actual format
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-a05dfd00 (Illumos 5147) has swapped FRAG and EXPANDSZ,
-so it's natural to modify these examples.
-
- # zpool list | head -1
- NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
- ^^^^^^^^^^^^^^^
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Tomohiro Kusumi <***@osnexus.com>
-Closes #7244
-(cherry picked from commit bcaba38e428be8dc90564d15c7e13f154c535edd)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- man/man8/zpool.8 | 20 ++++++++++----------
- 1 file changed, 10 insertions(+), 10 deletions(-)
-
-diff --git a/man/man8/zpool.8 b/man/man8/zpool.8
-index 22579101a..7c99f5868 100644
---- a/man/man8/zpool.8
-+++ b/man/man8/zpool.8
-@@ -2087,10 +2087,10 @@ is faulted due to a missing device.
- The results from this command are similar to the following:
- .Bd -literal
- # zpool list
--NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT
--rpool 19.9G 8.43G 11.4G 33% - 42% 1.00x ONLINE -
--tank 61.5G 20.0G 41.5G 48% - 32% 1.00x ONLINE -
--zion - - - - - - - FAULTED -
-+NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
-+rpool 19.9G 8.43G 11.4G - 33% 42% 1.00x ONLINE -
-+tank 61.5G 20.0G 41.5G - 48% 32% 1.00x ONLINE -
-+zion - - - - - - - FAULTED -
- .Ed
- .It Sy Example 7 No Destroying a ZFS Storage Pool
- The following command destroys the pool
-@@ -2215,12 +2215,12 @@ In this example, the pool will not be able to utilize this extra capacity until
- all the devices under the raidz vdev have been expanded.
- .Bd -literal
- # zpool list -v data
--NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT
--data 23.9G 14.6G 9.30G 48% - 61% 1.00x ONLINE -
-- raidz1 23.9G 14.6G 9.30G 48% -
-- sda - - - - -
-- sdb - - - - 10G
-- sdc - - - - -
-+NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
-+data 23.9G 14.6G 9.30G - 48% 61% 1.00x ONLINE -
-+ raidz1 23.9G 14.6G 9.30G - 48%
-+ sda - - - - -
-+ sdb - - - 10G -
-+ sdc - - - - -
- .Ed
- .It Sy Example 16 No Adding output columns
- Additional columns can be added to the
---
-2.14.2
-
diff --git a/zfs-patches/0045-Fix-some-typos.patch b/zfs-patches/0045-Fix-some-typos.patch
deleted file mode 100644
index 43da44d..0000000
--- a/zfs-patches/0045-Fix-some-typos.patch
+++ /dev/null
@@ -1,275 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: John Eismeier <32205350+***@users.noreply.github.com>
-Date: Wed, 28 Feb 2018 11:57:10 -0500
-Subject: [PATCH] Fix some typos
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed by: George Melikov <***@gmelikov.ru>
-Signed-off-by: John Eismeier <***@gmail.com>
-Closes #7237
-(cherry picked from commit 33bb1e82568a9734cc3f41d3e1d33003ebf0e123)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- cmd/arcstat/arcstat.py | 4 ++--
- cmd/dbufstat/dbufstat.py | 4 ++--
- contrib/initramfs/scripts/zfs | 2 +-
- man/man8/zpool.8 | 2 +-
- tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh | 4 ++--
- tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh | 4 ++--
- 16 files changed, 30 insertions(+), 30 deletions(-)
-
-diff --git a/cmd/arcstat/arcstat.py b/cmd/arcstat/arcstat.py
-index aa54ee87a..85c83ccc4 100755
---- a/cmd/arcstat/arcstat.py
-+++ b/cmd/arcstat/arcstat.py
-@@ -280,7 +280,7 @@ def init():
- "outfile",
- "help",
- "verbose",
-- "seperator",
-+ "separator",
- "columns"
- ]
- )
-@@ -299,7 +299,7 @@ def init():
- hflag = True
- if opt in ('-v', '--verbose'):
- vflag = True
-- if opt in ('-s', '--seperator'):
-+ if opt in ('-s', '--separator'):
- sep = arg
- i += 1
- if opt in ('-f', '--columns'):
-diff --git a/cmd/dbufstat/dbufstat.py b/cmd/dbufstat/dbufstat.py
-index dda0a143f..42bb0c7c7 100755
---- a/cmd/dbufstat/dbufstat.py
-+++ b/cmd/dbufstat/dbufstat.py
-@@ -474,7 +474,7 @@ def main():
- "help",
- "infile",
- "outfile",
-- "seperator",
-+ "separator",
- "types",
- "verbose",
- "extended"
-@@ -499,7 +499,7 @@ def main():
- ofile = arg
- if opt in ('-r', '--raw'):
- raw += 1
-- if opt in ('-s', '--seperator'):
-+ if opt in ('-s', '--separator'):
- sep = arg
- if opt in ('-t', '--types'):
- tflag = True
-diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs
-index 8770a2e8e..86329e764 100644
---- a/contrib/initramfs/scripts/zfs
-+++ b/contrib/initramfs/scripts/zfs
-@@ -478,7 +478,7 @@ destroy_fs()
- echo "Message: $ZFS_STDERR"
- echo "Error: $ZFS_ERROR"
- echo ""
-- echo "Failed to destroy '$fs'. Please make sure that '$fs' is not availible."
-+ echo "Failed to destroy '$fs'. Please make sure that '$fs' is not available."
- echo "Hint: Try: zfs destroy -Rfn $fs"
- echo "If this dryrun looks good, then remove the 'n' from '-Rfn' and try again."
- /bin/sh
-diff --git a/man/man8/zpool.8 b/man/man8/zpool.8
-index 7c99f5868..6d7c2271c 100644
---- a/man/man8/zpool.8
-+++ b/man/man8/zpool.8
-@@ -733,7 +733,7 @@ man page. In order to enable this property each host must set a unique hostid.
- See
- .Xr genhostid 1
- .Xr zgenhostid 8
--.Xr spl-module-paramters 5
-+.Xr spl-module-parameters 5
- for additional details. The default value is
- .Sy off .
- .It Sy version Ns = Ns Ar version
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh
-index 4d5fbb9ff..875d2f7c7 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "tar cf $TESTDIR/tar$$.tar $BNAME"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $TESTDIR $SUMA $SUMB "tar xf $TESTDIR/tar$$.tar"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from ZFS fs to ZFS fs".
-+log_pass "Successfully migrated test file from ZFS fs to ZFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh
-index e0655248d..6b97e2a40 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "tar cf $TESTDIR/tar$$.tar $BNAME"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $NONZFS_TESTDIR $SUMA $SUMB "tar xf $TESTDIR/tar$$.tar"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to UFS fs"
-
--log_pass "Successully migrated test file from ZFS fs to UFS fs".
-+log_pass "Successfully migrated test file from ZFS fs to UFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh
-index 904a2b1a0..dd0baeaa9 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "tar cf $NONZFS_TESTDIR/tar$$.tar $BNAME"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $TESTDIR $SUMA $SUMB "tar xvf $NONZFS_TESTDIR/tar$$.tar"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "UFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from UFS fs to ZFS fs".
-+log_pass "Successfully migrated test file from UFS fs to ZFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh
-index 6d33dd5b3..00a6cc172 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh
-@@ -67,7 +67,7 @@ cd $cwd
- (( $? != 0 )) && log_untested "Could not change directory to $cwd"
-
- migrate_cpio $TESTDIR "$TESTDIR/cpio$$.cpio" $SUMA $SUMB
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from ZFS fs to ZFS fs".
-+log_pass "Successfully migrated test file from ZFS fs to ZFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh
-index a41b19b5f..4386596f7 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh
-@@ -67,7 +67,7 @@ cd $cwd
- (( $? != 0 )) && log_untested "Could not change directory to $cwd"
-
- migrate_cpio $NONZFS_TESTDIR "$TESTDIR/cpio$$.cpio" $SUMA $SUMB
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to UFS fs"
-
--log_pass "Successully migrated test file from ZFS fs to UFS fs".
-+log_pass "Successfully migrated test file from ZFS fs to UFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh
-index 5b444421a..9b5c9166e 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh
-@@ -67,7 +67,7 @@ cd $cwd
- (( $? != 0 )) && log_untested "Could not change directory to $cwd"
-
- migrate_cpio $TESTDIR "$NONZFS_TESTDIR/cpio$$.cpio" $SUMA $SUMB
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from UFS fs to ZFS fs".
-+log_pass "Successfully migrated test file from UFS fs to ZFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh
-index c3197052c..0d136550f 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "dd if=$BNAME obs=128k of=$TESTDIR/dd$$.dd"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $TESTDIR $SUMA $SUMB "dd if=$TESTDIR/dd$$.dd obs=128k of=$BNAME"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from ZFS fs to ZFS fs".
-+log_pass "Successfully migrated test file from ZFS fs to ZFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh
-index 2e51eef36..f62b1f33a 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "dd if=$BNAME obs=128k of=$TESTDIR/dd$$.dd"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $NONZFS_TESTDIR $SUMA $SUMB "dd if=$TESTDIR/dd$$.dd obs=128k of=$BNAME"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from ZFS fs to UFS fs".
-+log_pass "Successfully migrated test file from ZFS fs to UFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh
-index 7749494e5..907be39eb 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "dd if=$BNAME obs=128k of=$NONZFS_TESTDIR/dd$$.dd"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $TESTDIR $SUMA $SUMB "dd if=$NONZFS_TESTDIR/dd$$.dd obs=128k of=$BNAME"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from UFS fs to ZFS fs".
-+log_pass "Successfully migrated test file from UFS fs to ZFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh
-index a11ab72df..e80dd67cd 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "cp $BNAME $TESTDIR/cp$$.cp"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $TESTDIR $SUMA $SUMB "cp $TESTDIR/cp$$.cp $BNAME"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from ZFS fs to ZFS fs".
-+log_pass "Successfully migrated test file from ZFS fs to ZFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh
-index 17e1c78f9..2d7ecb45e 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "cp $BNAME $TESTDIR/cp$$.cp"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $NONZFS_TESTDIR $SUMA $SUMB "cp $TESTDIR/cp$$.cp $BNAME"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to UFS fs"
-
--log_pass "Successully migrated test file from ZFS fs to UFS fs".
-+log_pass "Successfully migrated test file from ZFS fs to UFS fs".
-diff --git a/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh b/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh
-index 823dabeae..fd9c45491 100755
---- a/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh
-@@ -60,7 +60,7 @@ prepare $DNAME "cp $BNAME $NONZFS_TESTDIR/cp$$.cp"
- (( $? != 0 )) && log_fail "Unable to create src archive"
-
- migrate $TESTDIR $SUMA $SUMB "cp $NONZFS_TESTDIR/cp$$.cp $BNAME"
--(( $? != 0 )) && log_fail "Uable to successfully migrate test file from" \
-+(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "UFS fs to ZFS fs"
-
--log_pass "Successully migrated test file from UFS fs to ZFS fs".
-+log_pass "Successfully migrated test file from UFS fs to ZFS fs".
---
-2.14.2
-
diff --git a/zfs-patches/0046-Increment-zil_itx_needcopy_bytes-properly.patch b/zfs-patches/0046-Increment-zil_itx_needcopy_bytes-properly.patch
deleted file mode 100644
index f66d8db..0000000
--- a/zfs-patches/0046-Increment-zil_itx_needcopy_bytes-properly.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: chrisrd <***@onthe.net.au>
-Date: Sat, 3 Mar 2018 05:01:53 +1100
-Subject: [PATCH] Increment zil_itx_needcopy_bytes properly
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-In zil_lwb_commit() with TX_WRITE, we copy the log write record (lrw)
-into the log write block (lwb) and send it off using zil_lwb_add_txg().
-If we also have WR_NEED_COPY, we additionally copy the lwr's data into
-the lwb to be sent off. If the lwr + data doesn't fit into the lwb, we
-send the lrw and as much data as will fit (dnow bytes), then go back
-and do the same with the remaining data.
-
-Each time through this loop we're sending dnow data bytes. I.e.
-zil_itx_needcopy_bytes should be incremented by dnow.
-
-Reviewed-by: Richard Elling <***@RichardElling.com>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Chris Dunlop <***@onthe.net.au>
-Closes #6988
-Closes #7176
-(cherry picked from commit 792f88131c647a70440c709c78d43210db6c6534)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/zil.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/module/zfs/zil.c b/module/zfs/zil.c
-index 4d714cefc..645b1d4d8 100644
---- a/module/zfs/zil.c
-+++ b/module/zfs/zil.c
-@@ -1167,8 +1167,7 @@ cont:
- lrw->lr_offset += dnow;
- lrw->lr_length -= dnow;
- ZIL_STAT_BUMP(zil_itx_needcopy_count);
-- ZIL_STAT_INCR(zil_itx_needcopy_bytes,
-- lrw->lr_length);
-+ ZIL_STAT_INCR(zil_itx_needcopy_bytes, dnow);
- } else {
- ASSERT(itx->itx_wr_state == WR_INDIRECT);
- dbuf = NULL;
---
-2.14.2
-
diff --git a/zfs-patches/0047-Change-checksum-IO-delay-ratelimit-values.patch b/zfs-patches/0047-Change-checksum-IO-delay-ratelimit-values.patch
deleted file mode 100644
index 0c36c60..0000000
--- a/zfs-patches/0047-Change-checksum-IO-delay-ratelimit-values.patch
+++ /dev/null
@@ -1,201 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Sun, 4 Mar 2018 17:34:51 -0800
-Subject: [PATCH] Change checksum & IO delay ratelimit values
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Change checksum & IO delay ratelimit thresholds from 5/sec to 20/sec.
-This allows zed to actually trigger if a bunch of these events arrive in
-a short period of time (zed has a threshold of 10 events in 10 sec).
-Previously, if you had, say, 100 checksum errors in 1 sec, it would get
-ratelimited to 5/sec which wouldn't trigger zed to fault the drive.
-
-Also, convert the checksum and IO delay thresholds to module params for
-easy testing.
-
-Reviewed-by: loli10K <***@gmail.com>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Signed-off-by: Tony Hutter <***@llnl.gov>
-Closes #7252
-(cherry picked from commit 6dc40e2ada2d0d008bd314ff3525f2b0acc2bb01)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/sys/vdev_impl.h | 2 --
- include/sys/zfs_ratelimit.h | 12 +++++++++---
- module/zcommon/zfs_comutil.c | 4 ++--
- module/zfs/vdev.c | 23 +++++++++++++++++++++--
- man/man5/zfs-module-parameters.5 | 39 +++++++++++++++++++++++++++++++++++++++
- 5 files changed, 71 insertions(+), 9 deletions(-)
-
-diff --git a/include/sys/vdev_impl.h b/include/sys/vdev_impl.h
-index 13c495822..4f9f1a903 100644
---- a/include/sys/vdev_impl.h
-+++ b/include/sys/vdev_impl.h
-@@ -255,8 +255,6 @@ struct vdev {
- * We rate limit ZIO delay and ZIO checksum events, since they
- * can flood ZED with tons of events when a drive is acting up.
- */
--#define DELAYS_PER_SECOND 5
--#define CHECKSUMS_PER_SECOND 5
- zfs_ratelimit_t vdev_delay_rl;
- zfs_ratelimit_t vdev_checksum_rl;
- };
-diff --git a/include/sys/zfs_ratelimit.h b/include/sys/zfs_ratelimit.h
-index f36e07841..012825fad 100644
---- a/include/sys/zfs_ratelimit.h
-+++ b/include/sys/zfs_ratelimit.h
-@@ -25,13 +25,19 @@
- typedef struct {
- hrtime_t start;
- unsigned int count;
-- unsigned int burst; /* Number to allow per interval */
-- unsigned int interval; /* Interval length in seconds */
-+
-+ /*
-+ * Pointer to number of events per interval. We do this to
-+ * allow the burst to be a (changeable) module parameter.
-+ */
-+ unsigned int *burst;
-+
-+ unsigned int interval; /* Interval length in seconds */
- kmutex_t lock;
- } zfs_ratelimit_t;
-
- int zfs_ratelimit(zfs_ratelimit_t *rl);
--void zfs_ratelimit_init(zfs_ratelimit_t *rl, unsigned int burst,
-+void zfs_ratelimit_init(zfs_ratelimit_t *rl, unsigned int *burst,
- unsigned int interval);
- void zfs_ratelimit_fini(zfs_ratelimit_t *rl);
-
-diff --git a/module/zcommon/zfs_comutil.c b/module/zcommon/zfs_comutil.c
-index 52cb7e365..44cdc8523 100644
---- a/module/zcommon/zfs_comutil.c
-+++ b/module/zcommon/zfs_comutil.c
-@@ -215,7 +215,7 @@ const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS] = {
- * interval: Interval time in seconds
- */
- void
--zfs_ratelimit_init(zfs_ratelimit_t *rl, unsigned int burst,
-+zfs_ratelimit_init(zfs_ratelimit_t *rl, unsigned int *burst,
- unsigned int interval)
- {
- rl->count = 0;
-@@ -270,7 +270,7 @@ zfs_ratelimit(zfs_ratelimit_t *rl)
- rl->start = now;
- rl->count = 0;
- } else {
-- if (rl->count >= rl->burst) {
-+ if (rl->count >= *rl->burst) {
- rc = 0; /* We're ratelimiting */
- }
- }
-diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
-index df07d893d..0786fbb83 100644
---- a/module/zfs/vdev.c
-+++ b/module/zfs/vdev.c
-@@ -56,6 +56,16 @@
- */
- int metaslabs_per_vdev = 200;
-
-+/*
-+ * Rate limit delay events to this many IO delays per second.
-+ */
-+unsigned int zfs_delays_per_second = 20;
-+
-+/*
-+ * Rate limit checksum events after this many checksum errors per second.
-+ */
-+unsigned int zfs_checksums_per_second = 20;
-+
- /*
- * Virtual device management.
- */
-@@ -357,8 +367,8 @@ vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid, vdev_ops_t *ops)
- * and checksum events so that we don't overwhelm ZED with thousands
- * of events when a disk is acting up.
- */
-- zfs_ratelimit_init(&vd->vdev_delay_rl, DELAYS_PER_SECOND, 1);
-- zfs_ratelimit_init(&vd->vdev_checksum_rl, CHECKSUMS_PER_SECOND, 1);
-+ zfs_ratelimit_init(&vd->vdev_delay_rl, &zfs_delays_per_second, 1);
-+ zfs_ratelimit_init(&vd->vdev_checksum_rl, &zfs_checksums_per_second, 1);
-
- list_link_init(&vd->vdev_config_dirty_node);
- list_link_init(&vd->vdev_state_dirty_node);
-@@ -3776,5 +3786,14 @@ module_param(metaslabs_per_vdev, int, 0644);
- MODULE_PARM_DESC(metaslabs_per_vdev,
- "Divide added vdev into approximately (but no more than) this number "
- "of metaslabs");
-+
-+module_param(zfs_delays_per_second, uint, 0644);
-+MODULE_PARM_DESC(zfs_delays_per_second, "Rate limit delay events to this many "
-+ "IO delays per second");
-+
-+module_param(zfs_checksums_per_second, uint, 0644);
-+ MODULE_PARM_DESC(zfs_checksums_per_second, "Rate limit checksum events "
-+ "to this many checksum errors per second (do not set below zed"
-+ "threshold).");
- /* END CSTYLED */
- #endif
-diff --git a/man/man5/zfs-module-parameters.5 b/man/man5/zfs-module-parameters.5
-index d4daffde6..8d5ac2576 100644
---- a/man/man5/zfs-module-parameters.5
-+++ b/man/man5/zfs-module-parameters.5
-@@ -739,6 +739,34 @@ Disable pool import at module load by ignoring the cache file (typically \fB/etc
- Use \fB1\fR for yes (default) and \fB0\fR for no.
- .RE
-
-+.sp
-+.ne 2
-+.na
-+\fBzfs_checksums_per_second\fR (int)
-+.ad
-+.RS 12n
-+Rate limit checksum events to this many per second. Note that this should
-+not be set below the zed thresholds (currently 10 checksums over 10 sec)
-+or else zed may not trigger any action.
-+.sp
-+Default value: 20
-+.RE
-+
-+.sp
-+.ne 2
-+.na
-+\fBzfs_commit_timeout_pct\fR (int)
-+.ad
-+.RS 12n
-+This controls the amount of time that a ZIL block (lwb) will remain "open"
-+when it isn't "full", and it has a thread waiting for it to be committed to
-+stable storage. The timeout is scaled based on a percentage of the last lwb
-+latency to avoid significantly impacting the latency of each individual
-+transaction record (itx).
-+.sp
-+Default value: \fB5\fR%.
-+.RE
-+
- .sp
- .ne 2
- .na
-@@ -866,6 +894,17 @@ Note: \fBzfs_delay_scale\fR * \fBzfs_dirty_data_max\fR must be < 2^64.
- Default value: \fB500,000\fR.
- .RE
-
-+.sp
-+.ne 2
-+.na
-+\fBzfs_delays_per_second\fR (int)
-+.ad
-+.RS 12n
-+Rate limit IO delay events to this many per second.
-+.sp
-+Default value: 20
-+.RE
-+
- .sp
- .ne 2
- .na
---
-2.14.2
-
diff --git a/zfs-patches/0048-Linux-4.16-compat-get_disk_and_module.patch b/zfs-patches/0048-Linux-4.16-compat-get_disk_and_module.patch
deleted file mode 100644
index 93acdef..0000000
--- a/zfs-patches/0048-Linux-4.16-compat-get_disk_and_module.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Giuseppe Di Natale <***@users.noreply.github.com>
-Date: Mon, 5 Mar 2018 12:44:35 -0800
-Subject: [PATCH] Linux 4.16 compat: get_disk_and_module()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-As of https://github.com/torvalds/linux/commit/fb6d47a, get_disk()
-is now get_disk_and_module(). Add a configure check to determine
-if we need to use get_disk_and_module().
-
-Reviewed-by: loli10K <***@gmail.com>
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Giuseppe Di Natale <***@llnl.gov>
-Closes #7264
-(cherry picked from commit 8d7f17798d0faa0001bf7257759be0c688b91044)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- include/linux/blkdev_compat.h | 8 ++++++++
- module/zfs/zvol.c | 2 +-
- config/kernel-get-disk-and-module.m4 | 19 +++++++++++++++++++
- config/kernel.m4 | 1 +
- 4 files changed, 29 insertions(+), 1 deletion(-)
- create mode 100644 config/kernel-get-disk-and-module.m4
-
-diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h
-index c8a8e856d..4406493e4 100644
---- a/include/linux/blkdev_compat.h
-+++ b/include/linux/blkdev_compat.h
-@@ -139,6 +139,14 @@ blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages)
- #endif
- }
-
-+#ifndef HAVE_GET_DISK_AND_MODULE
-+static inline struct kobject *
-+get_disk_and_module(struct gendisk *disk)
-+{
-+ return (get_disk(disk));
-+}
-+#endif
-+
- #ifndef HAVE_GET_DISK_RO
- static inline int
- get_disk_ro(struct gendisk *disk)
-diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
-index aac494209..62176e1cf 100644
---- a/module/zfs/zvol.c
-+++ b/module/zfs/zvol.c
-@@ -1559,7 +1559,7 @@ zvol_probe(dev_t dev, int *part, void *arg)
- struct kobject *kobj;
-
- zv = zvol_find_by_dev(dev);
-- kobj = zv ? get_disk(zv->zv_disk) : NULL;
-+ kobj = zv ? get_disk_and_module(zv->zv_disk) : NULL;
- ASSERT(zv == NULL || MUTEX_HELD(&zv->zv_state_lock));
- if (zv)
- mutex_exit(&zv->zv_state_lock);
-diff --git a/config/kernel-get-disk-and-module.m4 b/config/kernel-get-disk-and-module.m4
-new file mode 100644
-index 000000000..2a51a5af7
---- /dev/null
-+++ b/config/kernel-get-disk-and-module.m4
-@@ -0,0 +1,19 @@
-+dnl #
-+dnl # 4.16 API change
-+dnl # Verify if get_disk_and_module() symbol is available.
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_AND_MODULE],
-+ [AC_MSG_CHECKING([whether get_disk_and_module() is available])
-+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
-+ #include <linux/genhd.h>
-+ ], [
-+ struct gendisk *disk = NULL;
-+ (void) get_disk_and_module(disk);
-+ ], [get_disk_and_module], [block/genhd.c], [
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_GET_DISK_AND_MODULE,
-+ 1, [get_disk_and_module() is available])
-+ ], [
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index 3e499e447..419ed1a2c 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -40,6 +40,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
- ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
- ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BIO_RW_UNPLUG
- ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BLK_PLUG
-+ ZFS_AC_KERNEL_GET_DISK_AND_MODULE
- ZFS_AC_KERNEL_GET_DISK_RO
- ZFS_AC_KERNEL_GET_GENDISK
- ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS
---
-2.14.2
-
diff --git a/zfs-patches/0049-Detect-long-config-lock-acquisition-in-mmp.patch b/zfs-patches/0049-Detect-long-config-lock-acquisition-in-mmp.patch
deleted file mode 100644
index 6e53d3d..0000000
--- a/zfs-patches/0049-Detect-long-config-lock-acquisition-in-mmp.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Olaf Faaland <***@llnl.gov>
-Date: Tue, 20 Feb 2018 17:33:51 -0800
-Subject: [PATCH] Detect long config lock acquisition in mmp
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-If something holds the config lock as a writer for too long, MMP will
-fail to issue MMP writes in a timely manner. This will result either in
-the pool being suspended, or in an extreme case, in the pool not being
-protected.
-
-If the time to acquire the config lock exceeds 1/10 of the minimum
-zfs_multihost_interval, report it in the zfs debug log.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Olaf Faaland <***@llnl.gov>
-Closes #7212
-(cherry picked from commit c17922b8a9db00ad7e7d59a5ff975b2a1edcf887)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/mmp.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
-index ee8e9201b..634e48287 100644
---- a/module/zfs/mmp.c
-+++ b/module/zfs/mmp.c
-@@ -323,7 +323,13 @@ mmp_write_uberblock(spa_t *spa)
- int label;
- uint64_t offset;
-
-+ hrtime_t lock_acquire_time = gethrtime();
- spa_config_enter(spa, SCL_STATE, mmp_tag, RW_READER);
-+ lock_acquire_time = gethrtime() - lock_acquire_time;
-+ if (lock_acquire_time > (MSEC2NSEC(MMP_MIN_INTERVAL) / 10))
-+ zfs_dbgmsg("SCL_STATE acquisition took %llu ns\n",
-+ (u_longlong_t)lock_acquire_time);
-+
- vd = mmp_random_leaf(spa->spa_root_vdev);
- if (vd == NULL) {
- spa_config_exit(spa, SCL_STATE, FTAG);
---
-2.14.2
-
diff --git a/zfs-patches/0050-Take-user-namespaces-into-account-in-policy-checks.patch b/zfs-patches/0050-Take-user-namespaces-into-account-in-policy-checks.patch
deleted file mode 100644
index 604a33d..0000000
--- a/zfs-patches/0050-Take-user-namespaces-into-account-in-policy-checks.patch
+++ /dev/null
@@ -1,786 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Wolfgang Bumiller <***@users.noreply.github.com>
-Date: Thu, 8 Mar 2018 00:40:42 +0100
-Subject: [PATCH] Take user namespaces into account in policy checks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Change file related checks to use user namespaces and make
-sure involved uids/gids are mappable in the current
-namespace.
-
-Note that checks without file ownership information will
-still not take user namespaces into account, as some of
-these should be handled via 'zfs allow' (otherwise root in a
-user namespace could issue commands such as `zpool export`).
-
-This also adds an initial user namespace regression test
-for the setgid bit loss, with a user_ns_exec helper usable
-in further tests.
-
-Additionally, configure checks for the required user
-namespace related features are added for:
- * ns_capable
- * kuid/kgid_has_mapping()
- * user_ns in cred_t
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Wolfgang Bumiller <***@proxmox.com>
-Closes #6800
-Closes #7270
-(cherry picked from commit 3808006edfc46b18f0a40a2e9df54c6567bf52cc)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- configure.ac | 2 +
- tests/zfs-tests/cmd/Makefile.am | 1 +
- tests/zfs-tests/cmd/user_ns_exec/Makefile.am | 6 +
- tests/zfs-tests/tests/functional/Makefile.am | 1 +
- .../tests/functional/user_namespace/Makefile.am | 7 +
- module/zfs/policy.c | 66 +++++++-
- tests/zfs-tests/cmd/user_ns_exec/user_ns_exec.c | 179 +++++++++++++++++++++
- config/kernel-userns-capabilities.m4 | 67 ++++++++
- config/kernel.m4 | 1 +
- tests/runfiles/linux.run | 4 +
- tests/zfs-tests/cmd/user_ns_exec/.gitignore | 1 +
- tests/zfs-tests/include/commands.cfg | 1 +
- .../tests/functional/user_namespace/cleanup.ksh | 25 +++
- .../tests/functional/user_namespace/setup.ksh | 32 ++++
- .../functional/user_namespace/user_namespace.cfg | 23 +++
- .../user_namespace/user_namespace_001.ksh | 89 ++++++++++
- .../user_namespace/user_namespace_common.kshlib | 23 +++
- 17 files changed, 521 insertions(+), 7 deletions(-)
- create mode 100644 tests/zfs-tests/cmd/user_ns_exec/Makefile.am
- create mode 100644 tests/zfs-tests/tests/functional/user_namespace/Makefile.am
- create mode 100644 tests/zfs-tests/cmd/user_ns_exec/user_ns_exec.c
- create mode 100644 config/kernel-userns-capabilities.m4
- create mode 100644 tests/zfs-tests/cmd/user_ns_exec/.gitignore
- create mode 100755 tests/zfs-tests/tests/functional/user_namespace/cleanup.ksh
- create mode 100755 tests/zfs-tests/tests/functional/user_namespace/setup.ksh
- create mode 100644 tests/zfs-tests/tests/functional/user_namespace/user_namespace.cfg
- create mode 100755 tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh
- create mode 100644 tests/zfs-tests/tests/functional/user_namespace/user_namespace_common.kshlib
-
-diff --git a/configure.ac b/configure.ac
-index d71712e4c..77e5764fc 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -153,6 +153,7 @@ AC_CONFIG_FILES([
- tests/zfs-tests/callbacks/Makefile
- tests/zfs-tests/cmd/Makefile
- tests/zfs-tests/cmd/chg_usr_exec/Makefile
-+ tests/zfs-tests/cmd/user_ns_exec/Makefile
- tests/zfs-tests/cmd/devname2devid/Makefile
- tests/zfs-tests/cmd/dir_rd_update/Makefile
- tests/zfs-tests/cmd/file_check/Makefile
-@@ -284,6 +285,7 @@ AC_CONFIG_FILES([
- tests/zfs-tests/tests/functional/threadsappend/Makefile
- tests/zfs-tests/tests/functional/tmpfile/Makefile
- tests/zfs-tests/tests/functional/truncate/Makefile
-+ tests/zfs-tests/tests/functional/user_namespace/Makefile
- tests/zfs-tests/tests/functional/userquota/Makefile
- tests/zfs-tests/tests/functional/upgrade/Makefile
- tests/zfs-tests/tests/functional/vdev_zaps/Makefile
-diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am
-index f55ff8ce2..1cce6947b 100644
---- a/tests/zfs-tests/cmd/Makefile.am
-+++ b/tests/zfs-tests/cmd/Makefile.am
-@@ -2,6 +2,7 @@ EXTRA_DIST = file_common.h
-
- SUBDIRS = \
- chg_usr_exec \
-+ user_ns_exec \
- devname2devid \
- dir_rd_update \
- file_check \
-diff --git a/tests/zfs-tests/cmd/user_ns_exec/Makefile.am b/tests/zfs-tests/cmd/user_ns_exec/Makefile.am
-new file mode 100644
-index 000000000..5b4bc9aaa
---- /dev/null
-+++ b/tests/zfs-tests/cmd/user_ns_exec/Makefile.am
-@@ -0,0 +1,6 @@
-+include $(top_srcdir)/config/Rules.am
-+
-+pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
-+
-+pkgexec_PROGRAMS = user_ns_exec
-+user_ns_exec_SOURCES = user_ns_exec.c
-diff --git a/tests/zfs-tests/tests/functional/Makefile.am b/tests/zfs-tests/tests/functional/Makefile.am
-index d68f254ef..cd60324f3 100644
---- a/tests/zfs-tests/tests/functional/Makefile.am
-+++ b/tests/zfs-tests/tests/functional/Makefile.am
-@@ -58,6 +58,7 @@ SUBDIRS = \
- tmpfile \
- truncate \
- upgrade \
-+ user_namespace \
- userquota \
- vdev_zaps \
- write_dirs \
-diff --git a/tests/zfs-tests/tests/functional/user_namespace/Makefile.am b/tests/zfs-tests/tests/functional/user_namespace/Makefile.am
-new file mode 100644
-index 000000000..0c0f6887a
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/user_namespace/Makefile.am
-@@ -0,0 +1,7 @@
-+pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/user_namespace
-+dist_pkgdata_SCRIPTS = \
-+ setup.ksh \
-+ cleanup.ksh \
-+ user_namespace_common.kshlib \
-+ user_namespace.cfg \
-+ user_namespace_001.ksh
-diff --git a/module/zfs/policy.c b/module/zfs/policy.c
-index 03e8f748b..55c932747 100644
---- a/module/zfs/policy.c
-+++ b/module/zfs/policy.c
-@@ -42,19 +42,47 @@
- * all other cases this function must fail and return the passed err.
- */
- static int
--priv_policy(const cred_t *cr, int capability, boolean_t all, int err)
-+priv_policy_ns(const cred_t *cr, int capability, boolean_t all, int err,
-+ struct user_namespace *ns)
- {
- ASSERT3S(all, ==, B_FALSE);
-
- if (cr != CRED() && (cr != kcred))
- return (err);
-
-+#if defined(CONFIG_USER_NS) && defined(HAVE_NS_CAPABLE)
-+ if (!(ns ? ns_capable(ns, capability) : capable(capability)))
-+#else
- if (!capable(capability))
-+#endif
- return (err);
-
- return (0);
- }
-
-+static int
-+priv_policy(const cred_t *cr, int capability, boolean_t all, int err)
-+{
-+ return (priv_policy_ns(cr, capability, all, err, NULL));
-+}
-+
-+static int
-+priv_policy_user(const cred_t *cr, int capability, boolean_t all, int err)
-+{
-+ /*
-+ * All priv_policy_user checks are preceeded by kuid/kgid_has_mapping()
-+ * checks. If we cannot do them, we shouldn't be using ns_capable()
-+ * since we don't know whether the affected files are valid in our
-+ * namespace. Note that kuid_has_mapping() came after cred->user_ns, so
-+ * we shouldn't need to re-check for HAVE_CRED_USER_NS
-+ */
-+#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
-+ return (priv_policy_ns(cr, capability, all, err, cr->user_ns));
-+#else
-+ return (priv_policy_ns(cr, capability, all, err, NULL));
-+#endif
-+}
-+
- /*
- * Checks for operations that are either client-only or are used by
- * both clients and servers.
-@@ -102,10 +130,15 @@ secpolicy_vnode_any_access(const cred_t *cr, struct inode *ip, uid_t owner)
- if (zpl_inode_owner_or_capable(ip))
- return (0);
-
-- if (priv_policy(cr, CAP_DAC_OVERRIDE, B_FALSE, EPERM) == 0)
-+#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
-+ if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
-+ return (EPERM);
-+#endif
-+
-+ if (priv_policy_user(cr, CAP_DAC_OVERRIDE, B_FALSE, EPERM) == 0)
- return (0);
-
-- if (priv_policy(cr, CAP_DAC_READ_SEARCH, B_FALSE, EPERM) == 0)
-+ if (priv_policy_user(cr, CAP_DAC_READ_SEARCH, B_FALSE, EPERM) == 0)
- return (0);
-
- return (EPERM);
-@@ -120,7 +153,12 @@ secpolicy_vnode_chown(const cred_t *cr, uid_t owner)
- if (crgetfsuid(cr) == owner)
- return (0);
-
-- return (priv_policy(cr, CAP_FOWNER, B_FALSE, EPERM));
-+#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
-+ if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
-+ return (EPERM);
-+#endif
-+
-+ return (priv_policy_user(cr, CAP_FOWNER, B_FALSE, EPERM));
- }
-
- /*
-@@ -152,7 +190,12 @@ secpolicy_vnode_setdac(const cred_t *cr, uid_t owner)
- if (crgetfsuid(cr) == owner)
- return (0);
-
-- return (priv_policy(cr, CAP_FOWNER, B_FALSE, EPERM));
-+#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
-+ if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
-+ return (EPERM);
-+#endif
-+
-+ return (priv_policy_user(cr, CAP_FOWNER, B_FALSE, EPERM));
- }
-
- /*
-@@ -175,8 +218,12 @@ secpolicy_vnode_setid_retain(const cred_t *cr, boolean_t issuidroot)
- int
- secpolicy_vnode_setids_setgids(const cred_t *cr, gid_t gid)
- {
-+#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
-+ if (!kgid_has_mapping(cr->user_ns, SGID_TO_KGID(gid)))
-+ return (EPERM);
-+#endif
- if (crgetfsgid(cr) != gid && !groupmember(gid, cr))
-- return (priv_policy(cr, CAP_FSETID, B_FALSE, EPERM));
-+ return (priv_policy_user(cr, CAP_FSETID, B_FALSE, EPERM));
-
- return (0);
- }
-@@ -222,7 +269,12 @@ secpolicy_vnode_setid_modify(const cred_t *cr, uid_t owner)
- if (crgetfsuid(cr) == owner)
- return (0);
-
-- return (priv_policy(cr, CAP_FSETID, B_FALSE, EPERM));
-+#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING)
-+ if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
-+ return (EPERM);
-+#endif
-+
-+ return (priv_policy_user(cr, CAP_FSETID, B_FALSE, EPERM));
- }
-
- /*
-diff --git a/tests/zfs-tests/cmd/user_ns_exec/user_ns_exec.c b/tests/zfs-tests/cmd/user_ns_exec/user_ns_exec.c
-new file mode 100644
-index 000000000..cd46738bd
---- /dev/null
-+++ b/tests/zfs-tests/cmd/user_ns_exec/user_ns_exec.c
-@@ -0,0 +1,179 @@
-+/*
-+ * CDDL HEADER START
-+ *
-+ * The contents of this file are subject to the terms of the
-+ * Common Development and Distribution License (the "License").
-+ * You may not use this file except in compliance with the License.
-+ *
-+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+ * or http://www.opensolaris.org/os/licensing.
-+ * See the License for the specific language governing permissions
-+ * and limitations under the License.
-+ *
-+ * When distributing Covered Code, include this CDDL HEADER in each
-+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+ * If applicable, add the following below this CDDL HEADER, with the
-+ * fields enclosed by brackets "[]" replaced with your own identifying
-+ * information: Portions Copyright [yyyy] [name of copyright owner]
-+ *
-+ * CDDL HEADER END
-+ */
-+
-+#include <stdio.h>
-+#include <unistd.h>
-+#include <string.h>
-+#include <limits.h>
-+#include <sys/types.h>
-+#include <sys/types.h>
-+#include <sys/socket.h>
-+#include <sys/wait.h>
-+#include <fcntl.h>
-+#include <errno.h>
-+#include <signal.h>
-+#include <sched.h>
-+
-+#define EXECSHELL "/bin/sh"
-+#define UIDMAP "0 100000 65536"
-+
-+static int
-+child_main(int argc, char *argv[], int sync_pipe)
-+{
-+ char sync_buf;
-+ char cmds[BUFSIZ] = { 0 };
-+ char sep[] = " ";
-+ int i, len;
-+
-+ if (unshare(CLONE_NEWUSER | CLONE_NEWNS) != 0) {
-+ perror("unshare");
-+ return (1);
-+ }
-+
-+ /* tell parent we entered the new namespace */
-+ if (write(sync_pipe, "1", 1) != 1) {
-+ perror("write");
-+ return (1);
-+ }
-+
-+ /* wait for parent to setup the uid mapping */
-+ if (read(sync_pipe, &sync_buf, 1) != 1) {
-+ (void) fprintf(stderr, "user namespace setup failed\n");
-+ return (1);
-+ }
-+
-+ close(sync_pipe);
-+
-+ if (setuid(0) != 0) {
-+ perror("setuid");
-+ return (1);
-+ }
-+ if (setgid(0) != 0) {
-+ perror("setgid");
-+ return (1);
-+ }
-+
-+ len = 0;
-+ for (i = 1; i < argc; i++) {
-+ (void) snprintf(cmds+len, sizeof (cmds)-len,
-+ "%s%s", argv[i], sep);
-+ len += strlen(argv[i]) + strlen(sep);
-+ }
-+
-+ if (execl(EXECSHELL, "sh", "-c", cmds, (char *)NULL) != 0) {
-+ perror("execl: " EXECSHELL);
-+ return (1);
-+ }
-+
-+ return (0);
-+}
-+
-+static int
-+set_idmap(pid_t pid, const char *file)
-+{
-+ int result = 0;
-+ int mapfd;
-+ char path[PATH_MAX];
-+
-+ (void) snprintf(path, sizeof (path), "/proc/%d/%s", (int)pid, file);
-+
-+ mapfd = open(path, O_WRONLY);
-+ if (mapfd < 0) {
-+ result = errno;
-+ perror("open");
-+ return (errno);
-+ }
-+
-+ if (write(mapfd, UIDMAP, sizeof (UIDMAP)-1) != sizeof (UIDMAP)-1) {
-+ perror("write");
-+ result = (errno);
-+ }
-+
-+ close(mapfd);
-+
-+ return (result);
-+}
-+
-+int
-+main(int argc, char *argv[])
-+{
-+ char sync_buf;
-+ int result, wstatus;
-+ int syncfd[2];
-+ pid_t child;
-+
-+ if (argc < 2 || strlen(argv[1]) == 0) {
-+ (void) printf("\tUsage: %s <commands> ...\n", argv[0]);
-+ return (1);
-+ }
-+
-+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, syncfd) != 0) {
-+ perror("socketpair");
-+ return (1);
-+ }
-+
-+ child = fork();
-+ if (child == (pid_t)-1) {
-+ perror("fork");
-+ return (1);
-+ }
-+
-+ if (child == 0) {
-+ close(syncfd[0]);
-+ return (child_main(argc, argv, syncfd[1]));
-+ }
-+
-+ close(syncfd[1]);
-+
-+ result = 0;
-+ /* wait for the child to have unshared its namespaces */
-+ if (read(syncfd[0], &sync_buf, 1) != 1) {
-+ perror("read");
-+ kill(child, SIGKILL);
-+ result = 1;
-+ goto reap;
-+ }
-+
-+ /* write uid mapping */
-+ if (set_idmap(child, "uid_map") != 0 ||
-+ set_idmap(child, "gid_map") != 0) {
-+ result = 1;
-+ kill(child, SIGKILL);
-+ goto reap;
-+ }
-+
-+ /* tell the child to proceed */
-+ if (write(syncfd[0], "1", 1) != 1) {
-+ perror("write");
-+ kill(child, SIGKILL);
-+ result = 1;
-+ goto reap;
-+ }
-+ close(syncfd[0]);
-+
-+reap:
-+ while (waitpid(child, &wstatus, 0) != child)
-+ kill(child, SIGKILL);
-+ if (result == 0)
-+ result = WEXITSTATUS(wstatus);
-+
-+ return (result);
-+}
-diff --git a/config/kernel-userns-capabilities.m4 b/config/kernel-userns-capabilities.m4
-new file mode 100644
-index 000000000..fa3381978
---- /dev/null
-+++ b/config/kernel-userns-capabilities.m4
-@@ -0,0 +1,67 @@
-+dnl #
-+dnl # 2.6.38 API change
-+dnl # ns_capable() was introduced
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [
-+ AC_MSG_CHECKING([whether ns_capable exists])
-+ ZFS_LINUX_TRY_COMPILE([
-+ #include <linux/capability.h>
-+ ],[
-+ ns_capable((struct user_namespace *)NULL, CAP_SYS_ADMIN);
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_NS_CAPABLE, 1,
-+ [ns_capable exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # 2.6.39 API change
-+dnl # struct user_namespace was added to struct cred_t as
-+dnl # cred->user_ns member
-+dnl # Note that current_user_ns() was added in 2.6.28.
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [
-+ AC_MSG_CHECKING([whether cred_t->user_ns exists])
-+ ZFS_LINUX_TRY_COMPILE([
-+ #include <linux/cred.h>
-+ ],[
-+ struct cred cr;
-+ cr.user_ns = (struct user_namespace *)NULL;
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_CRED_USER_NS, 1,
-+ [cred_t->user_ns exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+dnl #
-+dnl # 3.4 API change
-+dnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish
-+dnl # between internal kernel uids/gids and user namespace uids/gids.
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [
-+ AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist])
-+ ZFS_LINUX_TRY_COMPILE([
-+ #include <linux/uidgid.h>
-+ ],[
-+ kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0));
-+ kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0));
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_KUID_HAS_MAPPING, 1,
-+ [kuid_has_mapping/kgid_has_mapping exist])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_USERNS_CAPABILITIES], [
-+ ZFS_AC_KERNEL_NS_CAPABLE
-+ ZFS_AC_KERNEL_CRED_USER_NS
-+ ZFS_AC_KERNEL_KUID_HAS_MAPPING
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index 419ed1a2c..910d4ff25 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -126,6 +126,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
- ZFS_AC_KERNEL_CURRENT_TIME
- ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
- ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
-+ ZFS_AC_KERNEL_USERNS_CAPABILITIES
-
- AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
- KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
-diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
-index 89c923db1..25ae3fe5e 100644
---- a/tests/runfiles/linux.run
-+++ b/tests/runfiles/linux.run
-@@ -648,6 +648,10 @@ tags = ['functional', 'truncate']
- tests = [ 'upgrade_userobj_001_pos' ]
- tags = ['functional', 'upgrade']
-
-+[tests/functional/user_namespace]
-+tests = ['user_namespace_001']
-+tags = ['functional', 'user_namespace']
-+
- [tests/functional/userquota]
- tests = [
- 'userquota_001_pos', 'userquota_002_pos', 'userquota_003_pos',
-diff --git a/tests/zfs-tests/cmd/user_ns_exec/.gitignore b/tests/zfs-tests/cmd/user_ns_exec/.gitignore
-new file mode 100644
-index 000000000..655867a64
---- /dev/null
-+++ b/tests/zfs-tests/cmd/user_ns_exec/.gitignore
-@@ -0,0 +1 @@
-+/user_ns_exec
-diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg
-index 936e54c1a..0d768a3cf 100644
---- a/tests/zfs-tests/include/commands.cfg
-+++ b/tests/zfs-tests/include/commands.cfg
-@@ -164,4 +164,5 @@ export ZFSTEST_FILES='chg_usr_exec
- rename_dir
- rm_lnkcnt_zero_file
- threadsappend
-+ user_ns_exec
- xattrtest'
-diff --git a/tests/zfs-tests/tests/functional/user_namespace/cleanup.ksh b/tests/zfs-tests/tests/functional/user_namespace/cleanup.ksh
-new file mode 100755
-index 000000000..61caf3910
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/user_namespace/cleanup.ksh
-@@ -0,0 +1,25 @@
-+#!/bin/ksh -p
-+#
-+# CDDL HEADER START
-+#
-+# The contents of this file are subject to the terms of the
-+# Common Development and Distribution License (the "License").
-+# You may not use this file except in compliance with the License.
-+#
-+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+# or http://www.opensolaris.org/os/licensing.
-+# See the License for the specific language governing permissions
-+# and limitations under the License.
-+#
-+# When distributing Covered Code, include this CDDL HEADER in each
-+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+# If applicable, add the following below this CDDL HEADER, with the
-+# fields enclosed by brackets "[]" replaced with your own identifying
-+# information: Portions Copyright [yyyy] [name of copyright owner]
-+#
-+# CDDL HEADER END
-+#
-+
-+. $STF_SUITE/include/libtest.shlib
-+
-+default_cleanup
-diff --git a/tests/zfs-tests/tests/functional/user_namespace/setup.ksh b/tests/zfs-tests/tests/functional/user_namespace/setup.ksh
-new file mode 100755
-index 000000000..354cc9a6b
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/user_namespace/setup.ksh
-@@ -0,0 +1,32 @@
-+#!/bin/ksh -p
-+#
-+# CDDL HEADER START
-+#
-+# The contents of this file are subject to the terms of the
-+# Common Development and Distribution License (the "License").
-+# You may not use this file except in compliance with the License.
-+#
-+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+# or http://www.opensolaris.org/os/licensing.
-+# See the License for the specific language governing permissions
-+# and limitations under the License.
-+#
-+# When distributing Covered Code, include this CDDL HEADER in each
-+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+# If applicable, add the following below this CDDL HEADER, with the
-+# fields enclosed by brackets "[]" replaced with your own identifying
-+# information: Portions Copyright [yyyy] [name of copyright owner]
-+#
-+# CDDL HEADER END
-+#
-+
-+. $STF_SUITE/include/libtest.shlib
-+
-+if ! [ -f /proc/self/uid_map ]; then
-+ log_unsupported "The kernel doesn't support user namespaces."
-+fi
-+
-+verify_runnable "both"
-+
-+DISK=${DISKS%% *}
-+default_setup $DISK
-diff --git a/tests/zfs-tests/tests/functional/user_namespace/user_namespace.cfg b/tests/zfs-tests/tests/functional/user_namespace/user_namespace.cfg
-new file mode 100644
-index 000000000..9e55398e2
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/user_namespace/user_namespace.cfg
-@@ -0,0 +1,23 @@
-+#
-+# CDDL HEADER START
-+#
-+# The contents of this file are subject to the terms of the
-+# Common Development and Distribution License (the "License").
-+# You may not use this file except in compliance with the License.
-+#
-+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+# or http://www.opensolaris.org/os/licensing.
-+# See the License for the specific language governing permissions
-+# and limitations under the License.
-+#
-+# When distributing Covered Code, include this CDDL HEADER in each
-+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+# If applicable, add the following below this CDDL HEADER, with the
-+# fields enclosed by brackets "[]" replaced with your own identifying
-+# information: Portions Copyright [yyyy] [name of copyright owner]
-+#
-+# CDDL HEADER END
-+#
-+
-+export ROOT_UID=100000
-+export OTHER_UID=101000
-diff --git a/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh
-new file mode 100755
-index 000000000..6be30ab4d
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh
-@@ -0,0 +1,89 @@
-+#!/bin/ksh -p
-+#
-+# CDDL HEADER START
-+#
-+# The contents of this file are subject to the terms of the
-+# Common Development and Distribution License (the "License").
-+# You may not use this file except in compliance with the License.
-+#
-+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+# or http://www.opensolaris.org/os/licensing.
-+# See the License for the specific language governing permissions
-+# and limitations under the License.
-+#
-+# When distributing Covered Code, include this CDDL HEADER in each
-+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+# If applicable, add the following below this CDDL HEADER, with the
-+# fields enclosed by brackets "[]" replaced with your own identifying
-+# information: Portions Copyright [yyyy] [name of copyright owner]
-+#
-+# CDDL HEADER END
-+#
-+
-+. $STF_SUITE/tests/functional/user_namespace/user_namespace_common.kshlib
-+
-+#
-+#
-+# DESCRIPTION:
-+# Regression test for secpolicy_vnode_setids_setgids
-+#
-+#
-+# STRATEGY:
-+# 1. Create files with various owners.
-+# 2. Try to set setgid bit.
-+#
-+
-+verify_runnable "both"
-+
-+# rroot: real root,
-+# uroot: root within user namespace
-+# uother: other user within user namespace
-+set -A files rroot_rroot uroot_uroot uroot_other uother_uroot uother_uother
-+
-+function cleanup
-+{
-+ for i in ${files[*]}; do
-+ log_must rm -f $TESTDIR/$i
-+ done
-+}
-+
-+log_onexit cleanup
-+
-+log_assert "Check root in user namespaces"
-+
-+TOUCH=$(readlink -e $(which touch))
-+CHMOD=$(readlink -e $(which chmod))
-+
-+for i in ${files[*]}; do
-+ log_must $TOUCH $TESTDIR/$i
-+ log_must $CHMOD 0644 $TESTDIR/$i
-+done
-+
-+log_must chown 0:0 $TESTDIR/rroot_rroot
-+log_must chown $ROOT_UID:$ROOT_UID $TESTDIR/uroot_uroot
-+log_must chown $ROOT_UID:$OTHER_UID $TESTDIR/uroot_other
-+log_must chown $OTHER_UID:$ROOT_UID $TESTDIR/uother_uroot
-+log_must chown $OTHER_UID:$OTHER_UID $TESTDIR/uother_uother
-+
-+log_mustnot user_ns_exec $CHMOD 02755 $TESTDIR/rroot_rroot
-+log_mustnot test -g $TESTDIR/rroot_rroot
-+
-+log_must user_ns_exec $CHMOD 02755 $TESTDIR/uroot_uroot
-+log_must test -g $TESTDIR/uroot_uroot
-+
-+log_must user_ns_exec $CHMOD 02755 $TESTDIR/uroot_other
-+log_must test -g $TESTDIR/uroot_other
-+
-+log_must user_ns_exec $CHMOD 02755 $TESTDIR/uother_uroot
-+log_must test -g $TESTDIR/uother_uroot
-+
-+log_must user_ns_exec $CHMOD 02755 $TESTDIR/uother_uother
-+log_must test -g $TESTDIR/uother_uother
-+
-+log_mustnot user_ns_exec $TOUCH $TESTDIR/rroot_rroot
-+log_must $CHMOD 0666 $TESTDIR/rroot_rroot
-+for i in ${files[*]}; do
-+ log_must user_ns_exec $TOUCH $TESTDIR/$i
-+done
-+
-+log_pass "Check root in user namespaces"
-diff --git a/tests/zfs-tests/tests/functional/user_namespace/user_namespace_common.kshlib b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_common.kshlib
-new file mode 100644
-index 000000000..8577294d0
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_common.kshlib
-@@ -0,0 +1,23 @@
-+#
-+# CDDL HEADER START
-+#
-+# The contents of this file are subject to the terms of the
-+# Common Development and Distribution License (the "License").
-+# You may not use this file except in compliance with the License.
-+#
-+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+# or http://www.opensolaris.org/os/licensing.
-+# See the License for the specific language governing permissions
-+# and limitations under the License.
-+#
-+# When distributing Covered Code, include this CDDL HEADER in each
-+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+# If applicable, add the following below this CDDL HEADER, with the
-+# fields enclosed by brackets "[]" replaced with your own identifying
-+# information: Portions Copyright [yyyy] [name of copyright owner]
-+#
-+# CDDL HEADER END
-+#
-+
-+. $STF_SUITE/include/libtest.shlib
-+. $STF_SUITE/tests/functional/user_namespace/user_namespace.cfg
---
-2.14.2
-
diff --git a/zfs-patches/0051-zdb-and-inuse-tests-don-t-pass-with-real-disks.patch b/zfs-patches/0051-zdb-and-inuse-tests-don-t-pass-with-real-disks.patch
deleted file mode 100644
index bebe5b1..0000000
--- a/zfs-patches/0051-zdb-and-inuse-tests-don-t-pass-with-real-disks.patch
+++ /dev/null
@@ -1,232 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Zuchowski <31706010+PaulZ-***@users.noreply.github.com>
-Date: Wed, 7 Mar 2018 20:03:33 -0500
-Subject: [PATCH] zdb and inuse tests don't pass with real disks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Due to zpool create auto-partioning in Linux (i.e. sdb1),
-certain utilities need to use the parition (sdb1) while
-others use the whole disk name (sdb).
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Paul Zuchowski <***@datto.com>
-Closes #6939
-Closes #7261
-(cherry picked from commit 0a0af41bd926ca20a26d7476d792ce82bca9c077)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- tests/zfs-tests/include/libtest.shlib | 31 +++++++++++++++++++---
- .../tests/functional/cli_root/zdb/zdb_003_pos.ksh | 5 ++++
- .../tests/functional/cli_root/zdb/zdb_004_pos.ksh | 11 +++++---
- .../tests/functional/cli_root/zdb/zdb_005_pos.ksh | 4 +++
- .../tests/functional/inuse/inuse_005_pos.ksh | 8 +++---
- .../tests/functional/inuse/inuse_008_pos.ksh | 5 ++--
- .../tests/functional/inuse/inuse_009_pos.ksh | 10 +++++--
- 7 files changed, 59 insertions(+), 15 deletions(-)
-
-diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
-index 48fb5e7c5..d51d73e61 100644
---- a/tests/zfs-tests/include/libtest.shlib
-+++ b/tests/zfs-tests/include/libtest.shlib
-@@ -767,7 +767,11 @@ function zero_partitions #<whole_disk_name>
- typeset i
-
- if is_linux; then
-- log_must parted $DEV_DSKDIR/$diskname -s -- mklabel gpt
-+ DSK=$DEV_DSKDIR/$diskname
-+ DSK=$(echo $DSK | sed -e "s|//|/|g")
-+ log_must parted $DSK -s -- mklabel gpt
-+ blockdev --rereadpt $DSK 2>/dev/null
-+ block_device_wait
- else
- for i in 0 1 3 4 5 6 7
- do
-@@ -795,10 +799,11 @@ function set_partition #<slice_num> <slice_start> <size_plus_units> <whole_disk
- typeset start=$2
- typeset size=$3
- typeset disk=$4
-- [[ -z $slicenum || -z $size || -z $disk ]] && \
-- log_fail "The slice, size or disk name is unspecified."
-
- if is_linux; then
-+ if [[ -z $size || -z $disk ]]; then
-+ log_fail "The size or disk name is unspecified."
-+ fi
- typeset size_mb=${size%%[mMgG]}
-
- size_mb=${size_mb%%[mMgG][bB]}
-@@ -841,6 +846,10 @@ function set_partition #<slice_num> <slice_start> <size_plus_units> <whole_disk
- blockdev --rereadpt $DEV_DSKDIR/$disk 2>/dev/null
- block_device_wait
- else
-+ if [[ -z $slicenum || -z $size || -z $disk ]]; then
-+ log_fail "The slice, size or disk name is unspecified."
-+ fi
-+
- typeset format_file=/var/tmp/format_in.$$
-
- echo "partition" >$format_file
-@@ -3634,3 +3643,19 @@ function get_tunable_impl
-
- return 1
- }
-+
-+#
-+# Get actual devices used by the pool (i.e. linux sdb1 not sdb).
-+#
-+function get_pool_devices #testpool #devdir
-+{
-+ typeset testpool=$1
-+ typeset devdir=$2
-+ typeset out=""
-+
-+ if is_linux; then
-+ out=$(zpool status -P $testpool |grep ${devdir} | awk '{print $1}')
-+ out=$(echo $out | sed -e "s|${devdir}/||g" | tr '\n' ' ')
-+ fi
-+ echo $out
-+}
-diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh
-index 4c57cb587..3c444ae98 100755
---- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh
-@@ -43,6 +43,11 @@ config_count=(1 2)
- set -A DISK $DISKS
-
- default_mirror_setup_noexit $DISKS
-+
-+DEVS=$(get_pool_devices ${TESTPOOL} ${DEV_RDSKDIR})
-+log_note "$DEVS"
-+[[ -n $DEVS ]] && set -A DISK $DEVS
-+
- log_must dd if=/dev/${DISK[0]} of=/dev/${DISK[1]} bs=1K count=256 conv=notrunc
-
- for x in 0 1 ; do
-diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
-index 2b4057aa7..91a5c9799 100755
---- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
-@@ -45,17 +45,22 @@ function cleanup
- verify_runnable "global"
- verify_disk_count "$DISKS" 2
- set -A DISK $DISKS
-+WHOLE_DISK=${DISK[0]}
-
- default_mirror_setup_noexit $DISKS
--log_must zpool offline $TESTPOOL ${DISK[0]}
-+DEVS=$(get_pool_devices ${TESTPOOL} ${DEV_RDSKDIR})
-+[[ -n $DEVS ]] && set -A DISK $DEVS
-+
-+log_must zpool offline $TESTPOOL ${WHOLE_DISK}
- log_must dd if=/dev/urandom of=$TESTDIR/testfile bs=1K count=2
- log_must zpool export $TESTPOOL
-+
- log_must dd if=$DEV_RDSKDIR/${DISK[0]} of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=256 conv=notrunc
-
--ubs=$(zdb -lu $DEV_RDSKDIR/${DISK[1]} | grep -e LABEL -e Uberblock -e 'labels = ')
-+ubs=$(zdb -lu ${DISK[1]} | grep -e LABEL -e Uberblock -e 'labels = ')
- log_note "vdev 1: ubs $ubs"
-
--ub_dump_counts=$(zdb -lu $DEV_RDSKDIR/${DISK[1]} | \
-+ub_dump_counts=$(zdb -lu ${DISK[1]} | \
- awk ' /LABEL/ {label=$NF; blocks[label]=0};
- /Uberblock/ {blocks[label]++};
- END {print blocks[0],blocks[1],blocks[2],blocks[3]}')
-diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_005_pos.ksh
-index 60bbb5615..f6730f611 100755
---- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_005_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_005_pos.ksh
-@@ -44,6 +44,10 @@ verify_disk_count "$DISKS" 2
- set -A DISK $DISKS
-
- default_mirror_setup_noexit $DISKS
-+DEVS=$(get_pool_devices ${TESTPOOL} ${DEV_RDSKDIR})
-+log_note "$DEVS"
-+[[ -n $DEVS ]] && set -A DISK $DEVS
-+
- log_must dd if=/dev/zero of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=256 conv=notrunc
- log_must truncate -s 0 $TEMPFILE
-
-diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_005_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_005_pos.ksh
-index 9dd1e25bf..6b0abf429 100755
---- a/tests/zfs-tests/tests/functional/inuse/inuse_005_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/inuse/inuse_005_pos.ksh
-@@ -82,19 +82,18 @@ typeset -i i=0
-
- unset NOINUSE_CHECK
- while (( i < ${#vdevs[*]} )); do
--
- for num in 0 1 2 3 ; do
- eval typeset disk=\${FS_DISK$num}
- zero_partitions $disk
- done
--
- typeset cyl=""
- for num in 0 1 2 3 ; do
- eval typeset slice=\${FS_SIDE$num}
- disk=${slice%${SLICE_PREFIX}*}
-- slice=${slice##*${SLICE_PREFIX}}
-+ [[ -z $SLICE_PREFIX ]] && eval typeset disk=\${FS_DISK$num}
-+ slice=$(echo $slice | awk '{ print substr($1,length($1),1) }')
- log_must set_partition $slice "$cyl" $FS_SIZE $disk
-- cyl=$(get_endslice $disk $slice)
-+ [[ $num < 3 ]] && cyl=$(get_endslice $disk $slice)
- done
-
- if [[ -n $SINGLE_DISK && -n ${vdevs[i]} ]]; then
-@@ -115,7 +114,6 @@ while (( i < ${#vdevs[*]} )); do
- (( i = i + 1 ))
- continue
- fi
--
- create_pool $TESTPOOL1 ${vdevs[i]} $vdisks spare $sdisks
- verify_assertion "$rawtargets"
- destroy_pool $TESTPOOL1
-diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh
-index 95d39d958..ddc8fa7a4 100755
---- a/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh
-@@ -92,9 +92,10 @@ done
- for num in 0 1 2 3 ; do
- eval typeset slice=\${FS_SIDE$num}
- disk=${slice%${SLICE_PREFIX}*}
-- slice=${slice##*${SLICE_PREFIX}}
-+ [[ -z $SLICE_PREFIX ]] && eval typeset disk=\${FS_DISK$num}
-+ slice=$(echo $slice | awk '{ print substr($1,length($1),1) }')
- log_must set_partition $slice "$cyl" $FS_SIZE $disk
-- cyl=$(get_endslice $disk $slice)
-+ [[ $num < 3 ]] && cyl=$(get_endslice $disk $slice)
- done
-
- while (( i < ${#vdevs[*]} )); do
-diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_009_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_009_pos.ksh
-index 6a9b9623c..a5e9fda59 100755
---- a/tests/zfs-tests/tests/functional/inuse/inuse_009_pos.ksh
-+++ b/tests/zfs-tests/tests/functional/inuse/inuse_009_pos.ksh
-@@ -82,13 +82,19 @@ typeset -i i=0
-
- while (( i < ${#vdevs[*]} )); do
-
-+ for num in 0 1 2 3 ; do
-+ eval typeset disk=\${FS_DISK$num}
-+ zero_partitions $disk
-+ done
-+
- typeset cyl=""
- for num in 0 1 2 3 ; do
- eval typeset slice=\${FS_SIDE$num}
- disk=${slice%${SLICE_PREFIX}*}
-- slice=${slice##*${SLICE_PREFIX}}
-+ [[ -z $SLICE_PREFIX ]] && eval typeset disk=\${FS_DISK$num}
-+ slice=$(echo $slice | awk '{ print substr($1,length($1),1) }')
- log_must set_partition $slice "$cyl" $FS_SIZE $disk
-- cyl=$(get_endslice $disk $slice)
-+ [[ $num < 3 ]] && cyl=$(get_endslice $disk $slice)
- done
-
- if [[ -n $SINGLE_DISK && -n ${vdevs[i]} ]]; then
---
-2.14.2
-
diff --git a/zfs-patches/0052-Fix-zfs-kmod-builds-when-using-rpm-4.14.patch b/zfs-patches/0052-Fix-zfs-kmod-builds-when-using-rpm-4.14.patch
deleted file mode 100644
index 12cbe4d..0000000
--- a/zfs-patches/0052-Fix-zfs-kmod-builds-when-using-rpm-4.14.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: LOLi <***@users.noreply.github.com>
-Date: Fri, 9 Mar 2018 22:52:37 +0100
-Subject: [PATCH] Fix zfs-kmod builds when using rpm >= 4.14
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-With rpm-software-management/***@5e94633 a package version containing
-invalid characters (most commonly a double '-') causes the kmod package
-generation to terminate with an error. This change takes advantage of
-the newly introduced rpm macro "_wrong_version_format_terminate_build"
-to allow kmod packages to be built.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: loli10K <***@gmail.com>
-Closes #7284
-(cherry picked from commit dc0176eeec9719827610fc68742ea3c76796a81f)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- config/zfs-build.m4 | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
-index 7c19cecd6..8fc3863f4 100644
---- a/config/zfs-build.m4
-+++ b/config/zfs-build.m4
-@@ -162,6 +162,8 @@ AC_DEFUN([ZFS_AC_RPM], [
- RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"'
- RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS) $(DEFINE_SYSTEMD)'
- RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"'
-+ RPM_DEFINE_KMOD+=' --define "_wrong_version_format_terminate_build 0"'
-+
- RPM_DEFINE_DKMS=
-
- dnl # Override default lib directory on Debian/Ubuntu systems. The provided
---
-2.14.2
-
diff --git a/zfs-patches/0053-Handle-zio_resume-and-mmp-off.patch b/zfs-patches/0053-Handle-zio_resume-and-mmp-off.patch
deleted file mode 100644
index 3dfc727..0000000
--- a/zfs-patches/0053-Handle-zio_resume-and-mmp-off.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Olaf Faaland <***@llnl.gov>
-Date: Thu, 8 Mar 2018 15:21:54 -0800
-Subject: [PATCH] Handle zio_resume and mmp => off
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When multihost is disabled on a pool, and the pool is resumed via zpool
-clear, within a single cycle of the mmp thread's loop (e.g. while it's
-in the cv_timedwait call), both mmp_last_write and mmp_delay should be
-updated.
-
-The original code mistakenly treated the two cases as if they could not
-occur at the same time.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Reviewed-by: Tony Hutter <***@llnl.gov>
-Signed-off-by: Olaf Faaland <***@llnl.gov>
-Closes #7286
-(cherry picked from commit 267fd7b0f14251026c35d7ceab4fbbe2f06717e6)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- module/zfs/mmp.c | 14 ++++++++++----
- 1 file changed, 10 insertions(+), 4 deletions(-)
-
-diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
-index 634e48287..15eea41ab 100644
---- a/module/zfs/mmp.c
-+++ b/module/zfs/mmp.c
-@@ -409,16 +409,22 @@ mmp_thread(spa_t *spa)
- }
-
- /*
-- * When MMP goes off => on, or spa goes suspended =>
-- * !suspended, we know no writes occurred recently. We
-- * update mmp_last_write to give us some time to try.
-+ * MMP off => on, or suspended => !suspended:
-+ * No writes occurred recently. Update mmp_last_write to give
-+ * us some time to try.
- */
- if ((!last_spa_multihost && multihost) ||
- (last_spa_suspended && !suspended)) {
- mutex_enter(&mmp->mmp_io_lock);
- mmp->mmp_last_write = gethrtime();
- mutex_exit(&mmp->mmp_io_lock);
-- } else if (last_spa_multihost && !multihost) {
-+ }
-+
-+ /*
-+ * MMP on => off:
-+ * mmp_delay == 0 tells importing node to skip activity check.
-+ */
-+ if (last_spa_multihost && !multihost) {
- mutex_enter(&mmp->mmp_io_lock);
- mmp->mmp_delay = 0;
- mutex_exit(&mmp->mmp_io_lock);
---
-2.14.2
-
diff --git a/zfs-patches/0054-Fix-MMP-write-frequency-for-large-pools.patch b/zfs-patches/0054-Fix-MMP-write-frequency-for-large-pools.patch
deleted file mode 100644
index 1b334a2..0000000
--- a/zfs-patches/0054-Fix-MMP-write-frequency-for-large-pools.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <***@llnl.gov>
-Date: Mon, 12 Mar 2018 11:26:05 -0700
-Subject: [PATCH] Fix MMP write frequency for large pools
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When a single pool contains more vdevs than the CONFIG_HZ for
-for the kernel the mmp thread will not delay properly. Switch
-to using cv_timedwait_sig_hires() to handle higher resolution
-delays.
-
-This issue was reported on Arch Linux where HZ defaults to only
-100 and this could be fairly easily reproduced with a reasonably
-large pool. Most distribution kernels set CONFIG_HZ=250 or
-CONFIG_HZ=1000 and thus are unlikely to be impacted.
-
-Reviewed-by: George Melikov <***@gmelikov.ru>
-Reviewed-by: Giuseppe Di Natale <***@llnl.gov>
-Reviewed-by: Olaf Faaland <***@llnl.gov>
-Reviewed-by: Tony Hutter <***@llnl.gov>
-Signed-off-by: Brian Behlendorf <***@llnl.gov>
-Closes #7205
-Closes #7289
-(cherry picked from commit c30e716c8149b7df7cf968373c22aa00b48d17b8)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- lib/libspl/include/sys/time.h | 6 +++++-
- module/zfs/mmp.c | 6 +++---
- 2 files changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h
-index f05fcaa1c..dc645fa5c 100644
---- a/lib/libspl/include/sys/time.h
-+++ b/lib/libspl/include/sys/time.h
-@@ -54,10 +54,14 @@
- #define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
- #endif
-
--#ifndef NSEC2MSEC
-+#ifndef NSEC2MSEC
- #define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
- #endif
-
-+#ifndef USEC2NSEC
-+#define USEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MICROSEC))
-+#endif
-+
- #ifndef NSEC2SEC
- #define NSEC2SEC(n) ((n) / (NANOSEC / SEC))
- #endif
-diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
-index 15eea41ab..dc5c6a74f 100644
---- a/module/zfs/mmp.c
-+++ b/module/zfs/mmp.c
-@@ -462,9 +462,9 @@ mmp_thread(spa_t *spa)
- mmp_write_uberblock(spa);
-
- CALLB_CPR_SAFE_BEGIN(&cpr);
-- (void) cv_timedwait_sig(&mmp->mmp_thread_cv,
-- &mmp->mmp_thread_lock, ddi_get_lbolt() +
-- ((next_time - gethrtime()) / (NANOSEC / hz)));
-+ (void) cv_timedwait_sig_hires(&mmp->mmp_thread_cv,
-+ &mmp->mmp_thread_lock, next_time, USEC2NSEC(1),
-+ CALLOUT_FLAG_ABSOLUTE);
- CALLB_CPR_SAFE_END(&cpr, &mmp->mmp_thread_lock);
- }
-
---
-2.14.2
-
diff --git a/zfs-patches/0055-Tag-zfs-0.7.7.patch b/zfs-patches/0055-Tag-zfs-0.7.7.patch
deleted file mode 100644
index edd2710..0000000
--- a/zfs-patches/0055-Tag-zfs-0.7.7.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Wed, 14 Mar 2018 16:16:43 -0700
-Subject: [PATCH] Tag zfs-0.7.7
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-META file and changelog updated.
-
-Signed-off-by: Tony Hutter <***@llnl.gov>
-(cherry picked from commit 240ccfc13adb46faf3d6e5e17e25a9769dd06733)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- rpm/generic/zfs-kmod.spec.in | 3 +++
- rpm/generic/zfs.spec.in | 3 +++
- META | 2 +-
- 3 files changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in
-index cb23b0a8f..bf52fa2c4 100644
---- a/rpm/generic/zfs-kmod.spec.in
-+++ b/rpm/generic/zfs-kmod.spec.in
-@@ -191,6 +191,9 @@ chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/*
- rm -rf $RPM_BUILD_ROOT
-
- %changelog
-+* Wed Mar 14 2018 Tony Hutter <***@llnl.gov> - 0.7.7-1
-+- Released 0.7.7-1, detailed release notes are available at:
-+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.7
- * Thu Feb 01 2018 Tony Hutter <***@llnl.gov> - 0.7.6-1
- - Released 0.7.6-1, detailed release notes are available at:
- - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.6
-diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
-index ce028794c..7479e987e 100644
---- a/rpm/generic/zfs.spec.in
-+++ b/rpm/generic/zfs.spec.in
-@@ -352,6 +352,9 @@ systemctl --system daemon-reload >/dev/null || true
- %endif
-
- %changelog
-+* Wed Mar 14 2018 Tony Hutter <***@llnl.gov> - 0.7.7-1
-+- Released 0.7.7-1, detailed release notes are available at:
-+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.7
- * Thu Feb 01 2018 Tony Hutter <***@llnl.gov> - 0.7.6-1
- - Released 0.7.6-1, detailed release notes are available at:
- - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.6
-diff --git a/META b/META
-index 1f4686df7..eefafb10d 100644
---- a/META
-+++ b/META
-@@ -1,7 +1,7 @@
- Meta: 1
- Name: zfs
- Branch: 1.0
--Version: 0.7.6
-+Version: 0.7.7
- Release: 1
- Release-Tags: relext
- License: CDDL
---
-2.14.2
-
diff --git a/zfs-patches/0056-Revert-Handle-zap_add-failures-in-mixed.patch b/zfs-patches/0056-Revert-Handle-zap_add-failures-in-mixed.patch
deleted file mode 100644
index 77f3ecb..0000000
--- a/zfs-patches/0056-Revert-Handle-zap_add-failures-in-mixed.patch
+++ /dev/null
@@ -1,551 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Mon, 9 Apr 2018 14:24:46 -0700
-Subject: [PATCH] Revert "Handle zap_add() failures in mixed ... "
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This reverts commit cc63068e95ee725cce03b1b7ce50179825a6cda5.
-
-Under certain circumstances this change can result in an ENOSPC
-error when adding new files to a directory. See #7401 for full
-details.
-
-Reviewed-by: Brian Behlendorf <***@llnl.gov>
-Signed-off-by: Tony Hutter <***@llnl.gov>
-Issue #7401
-Closes #7416
-(cherry picked from commit 9a2e90c9fc469d377c14eb863952261f9ec12d2c)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- .../tests/functional/casenorm/Makefile.am | 1 -
- include/sys/zap_leaf.h | 15 +--
- module/zfs/zap.c | 25 +---
- module/zfs/zap_leaf.c | 2 +-
- module/zfs/zap_micro.c | 38 +-----
- module/zfs/zfs_dir.c | 29 +----
- module/zfs/zfs_vnops.c | 73 +++--------
- tests/runfiles/linux.run | 2 +-
- .../functional/casenorm/mixed_create_failure.ksh | 136 ---------------------
- 9 files changed, 32 insertions(+), 289 deletions(-)
- delete mode 100755 tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
-
-diff --git a/tests/zfs-tests/tests/functional/casenorm/Makefile.am b/tests/zfs-tests/tests/functional/casenorm/Makefile.am
-index 00cb59074..00a19c7ff 100644
---- a/tests/zfs-tests/tests/functional/casenorm/Makefile.am
-+++ b/tests/zfs-tests/tests/functional/casenorm/Makefile.am
-@@ -9,7 +9,6 @@ dist_pkgdata_SCRIPTS = \
- insensitive_formd_lookup.ksh \
- insensitive_none_delete.ksh \
- insensitive_none_lookup.ksh \
-- mixed_create_failure.ksh \
- mixed_formd_delete.ksh \
- mixed_formd_lookup_ci.ksh \
- mixed_formd_lookup.ksh \
-diff --git a/include/sys/zap_leaf.h b/include/sys/zap_leaf.h
-index a3da1036a..e784c5963 100644
---- a/include/sys/zap_leaf.h
-+++ b/include/sys/zap_leaf.h
-@@ -46,15 +46,10 @@ struct zap_stats;
- * block size (1<<l->l_bs) - hash entry size (2) * number of hash
- * entries - header space (2*chunksize)
- */
--#define ZAP_LEAF_NUMCHUNKS_BS(bs) \
-- (((1<<(bs)) - 2*ZAP_LEAF_HASH_NUMENTRIES_BS(bs)) / \
-+#define ZAP_LEAF_NUMCHUNKS(l) \
-+ (((1<<(l)->l_bs) - 2*ZAP_LEAF_HASH_NUMENTRIES(l)) / \
- ZAP_LEAF_CHUNKSIZE - 2)
-
--#define ZAP_LEAF_NUMCHUNKS(l) (ZAP_LEAF_NUMCHUNKS_BS(((l)->l_bs)))
--
--#define ZAP_LEAF_NUMCHUNKS_DEF \
-- (ZAP_LEAF_NUMCHUNKS_BS(fzap_default_block_shift))
--
- /*
- * The amount of space within the chunk available for the array is:
- * chunk size - space for type (1) - space for next pointer (2)
-@@ -79,10 +74,8 @@ struct zap_stats;
- * which is less than block size / CHUNKSIZE (24) / minimum number of
- * chunks per entry (3).
- */
--#define ZAP_LEAF_HASH_SHIFT_BS(bs) ((bs) - 5)
--#define ZAP_LEAF_HASH_NUMENTRIES_BS(bs) (1 << ZAP_LEAF_HASH_SHIFT_BS(bs))
--#define ZAP_LEAF_HASH_SHIFT(l) (ZAP_LEAF_HASH_SHIFT_BS(((l)->l_bs)))
--#define ZAP_LEAF_HASH_NUMENTRIES(l) (ZAP_LEAF_HASH_NUMENTRIES_BS(((l)->l_bs)))
-+#define ZAP_LEAF_HASH_SHIFT(l) ((l)->l_bs - 5)
-+#define ZAP_LEAF_HASH_NUMENTRIES(l) (1 << ZAP_LEAF_HASH_SHIFT(l))
-
- /*
- * The chunks start immediately after the hash table. The end of the
-diff --git a/module/zfs/zap.c b/module/zfs/zap.c
-index 9843d8c50..ee9962bff 100644
---- a/module/zfs/zap.c
-+++ b/module/zfs/zap.c
-@@ -819,19 +819,15 @@ fzap_lookup(zap_name_t *zn,
- return (err);
- }
-
--#define MAX_EXPAND_RETRIES 2
--
- int
- fzap_add_cd(zap_name_t *zn,
- uint64_t integer_size, uint64_t num_integers,
- const void *val, uint32_t cd, void *tag, dmu_tx_t *tx)
- {
- zap_leaf_t *l;
-- zap_leaf_t *prev_l = NULL;
- int err;
- zap_entry_handle_t zeh;
- zap_t *zap = zn->zn_zap;
-- int expand_retries = 0;
-
- ASSERT(RW_LOCK_HELD(&zap->zap_rwlock));
- ASSERT(!zap->zap_ismicro);
-@@ -855,29 +851,10 @@ retry:
- if (err == 0) {
- zap_increment_num_entries(zap, 1, tx);
- } else if (err == EAGAIN) {
-- /*
-- * If the last two expansions did not help, there is no point
-- * trying to expand again
-- */
-- if (expand_retries > MAX_EXPAND_RETRIES && prev_l == l) {
-- err = SET_ERROR(ENOSPC);
-- goto out;
-- }
--
- err = zap_expand_leaf(zn, l, tag, tx, &l);
- zap = zn->zn_zap; /* zap_expand_leaf() may change zap */
-- if (err == 0) {
-- prev_l = l;
-- expand_retries++;
-+ if (err == 0)
- goto retry;
-- } else if (err == ENOSPC) {
-- /*
-- * If we failed to expand the leaf, then bailout
-- * as there is no point trying
-- * zap_put_leaf_maybe_grow_ptrtbl().
-- */
-- return (err);
-- }
- }
-
- out:
-diff --git a/module/zfs/zap_leaf.c b/module/zfs/zap_leaf.c
-index 526e46606..c342695c7 100644
---- a/module/zfs/zap_leaf.c
-+++ b/module/zfs/zap_leaf.c
-@@ -53,7 +53,7 @@ static uint16_t *zap_leaf_rehash_entry(zap_leaf_t *l, uint16_t entry);
- ((h) >> \
- (64 - ZAP_LEAF_HASH_SHIFT(l) - zap_leaf_phys(l)->l_hdr.lh_prefix_len)))
-
--#define LEAF_HASH_ENTPTR(l, h) (&zap_leaf_phys(l)->l_hash[LEAF_HASH(l, h)])
-+#define LEAF_HASH_ENTPTR(l, h) (&zap_leaf_phys(l)->l_hash[LEAF_HASH(l, h)])
-
- extern inline zap_leaf_phys_t *zap_leaf_phys(zap_leaf_t *l);
-
-diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c
-index 34bef3e63..3ebf995c6 100644
---- a/module/zfs/zap_micro.c
-+++ b/module/zfs/zap_micro.c
-@@ -363,41 +363,6 @@ mze_find_unused_cd(zap_t *zap, uint64_t hash)
- return (cd);
- }
-
--/*
-- * Each mzap entry requires at max : 4 chunks
-- * 3 chunks for names + 1 chunk for value.
-- */
--#define MZAP_ENT_CHUNKS (1 + ZAP_LEAF_ARRAY_NCHUNKS(MZAP_NAME_LEN) + \
-- ZAP_LEAF_ARRAY_NCHUNKS(sizeof (uint64_t)))
--
--/*
-- * Check if the current entry keeps the colliding entries under the fatzap leaf
-- * size.
-- */
--static boolean_t
--mze_canfit_fzap_leaf(zap_name_t *zn, uint64_t hash)
--{
-- zap_t *zap = zn->zn_zap;
-- mzap_ent_t mze_tofind;
-- mzap_ent_t *mze;
-- avl_index_t idx;
-- avl_tree_t *avl = &zap->zap_m.zap_avl;
-- uint32_t mzap_ents = 0;
--
-- mze_tofind.mze_hash = hash;
-- mze_tofind.mze_cd = 0;
--
-- for (mze = avl_find(avl, &mze_tofind, &idx);
-- mze && mze->mze_hash == hash; mze = AVL_NEXT(avl, mze)) {
-- mzap_ents++;
-- }
--
-- /* Include the new entry being added */
-- mzap_ents++;
--
-- return (ZAP_LEAF_NUMCHUNKS_DEF > (mzap_ents * MZAP_ENT_CHUNKS));
--}
--
- static void
- mze_remove(zap_t *zap, mzap_ent_t *mze)
- {
-@@ -1226,8 +1191,7 @@ zap_add_impl(zap_t *zap, const char *key,
- err = fzap_add(zn, integer_size, num_integers, val, tag, tx);
- zap = zn->zn_zap; /* fzap_add() may change zap */
- } else if (integer_size != 8 || num_integers != 1 ||
-- strlen(key) >= MZAP_NAME_LEN ||
-- !mze_canfit_fzap_leaf(zn, zn->zn_hash)) {
-+ strlen(key) >= MZAP_NAME_LEN) {
- err = mzap_upgrade(&zn->zn_zap, tag, tx, 0);
- if (err == 0) {
- err = fzap_add(zn, integer_size, num_integers, val,
-diff --git a/module/zfs/zfs_dir.c b/module/zfs/zfs_dir.c
-index 6398a1d15..9a8bbccd9 100644
---- a/module/zfs/zfs_dir.c
-+++ b/module/zfs/zfs_dir.c
-@@ -742,11 +742,7 @@ zfs_dirent(znode_t *zp, uint64_t mode)
- }
-
- /*
-- * Link zp into dl. Can fail in the following cases :
-- * - if zp has been unlinked.
-- * - if the number of entries with the same hash (aka. colliding entries)
-- * exceed the capacity of a leaf-block of fatzap and splitting of the
-- * leaf-block does not help.
-+ * Link zp into dl. Can only fail if zp has been unlinked.
- */
- int
- zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
-@@ -780,24 +776,6 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
- NULL, &links, sizeof (links));
- }
- }
--
-- value = zfs_dirent(zp, zp->z_mode);
-- error = zap_add(ZTOZSB(zp)->z_os, dzp->z_id, dl->dl_name, 8, 1,
-- &value, tx);
--
-- /*
-- * zap_add could fail to add the entry if it exceeds the capacity of the
-- * leaf-block and zap_leaf_split() failed to help.
-- * The caller of this routine is responsible for failing the transaction
-- * which will rollback the SA updates done above.
-- */
-- if (error != 0) {
-- if (!(flag & ZRENAMING) && !(flag & ZNEW))
-- drop_nlink(ZTOI(zp));
-- mutex_exit(&zp->z_lock);
-- return (error);
-- }
--
- SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_PARENT(zfsvfs), NULL,
- &dzp->z_id, sizeof (dzp->z_id));
- SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_FLAGS(zfsvfs), NULL,
-@@ -835,6 +813,11 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
- ASSERT(error == 0);
- mutex_exit(&dzp->z_lock);
-
-+ value = zfs_dirent(zp, zp->z_mode);
-+ error = zap_add(ZTOZSB(zp)->z_os, dzp->z_id, dl->dl_name,
-+ 8, 1, &value, tx);
-+ ASSERT(error == 0);
-+
- return (0);
- }
-
-diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
-index 8a7ad702c..6f6ce79db 100644
---- a/module/zfs/zfs_vnops.c
-+++ b/module/zfs/zfs_vnops.c
-@@ -1443,22 +1443,10 @@ top:
- }
- zfs_mknode(dzp, vap, tx, cr, 0, &zp, &acl_ids);
-
-- error = zfs_link_create(dl, zp, tx, ZNEW);
-- if (error != 0) {
-- /*
-- * Since, we failed to add the directory entry for it,
-- * delete the newly created dnode.
-- */
-- zfs_znode_delete(zp, tx);
-- remove_inode_hash(ZTOI(zp));
-- zfs_acl_ids_free(&acl_ids);
-- dmu_tx_commit(tx);
-- goto out;
-- }
--
- if (fuid_dirtied)
- zfs_fuid_sync(zfsvfs, tx);
-
-+ (void) zfs_link_create(dl, zp, tx, ZNEW);
- txtype = zfs_log_create_txtype(Z_FILE, vsecp, vap);
- if (flag & FIGNORECASE)
- txtype |= TX_CI;
-@@ -2049,18 +2037,13 @@ top:
- */
- zfs_mknode(dzp, vap, tx, cr, 0, &zp, &acl_ids);
-
-+ if (fuid_dirtied)
-+ zfs_fuid_sync(zfsvfs, tx);
-+
- /*
- * Now put new name in parent dir.
- */
-- error = zfs_link_create(dl, zp, tx, ZNEW);
-- if (error != 0) {
-- zfs_znode_delete(zp, tx);
-- remove_inode_hash(ZTOI(zp));
-- goto out;
-- }
--
-- if (fuid_dirtied)
-- zfs_fuid_sync(zfsvfs, tx);
-+ (void) zfs_link_create(dl, zp, tx, ZNEW);
-
- *ipp = ZTOI(zp);
-
-@@ -2070,7 +2053,6 @@ top:
- zfs_log_create(zilog, tx, txtype, dzp, zp, dirname, vsecp,
- acl_ids.z_fuidp, vap);
-
--out:
- zfs_acl_ids_free(&acl_ids);
-
- dmu_tx_commit(tx);
-@@ -2080,14 +2062,10 @@ out:
- if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
- zil_commit(zilog, 0);
-
-- if (error != 0) {
-- iput(ZTOI(zp));
-- } else {
-- zfs_inode_update(dzp);
-- zfs_inode_update(zp);
-- }
-+ zfs_inode_update(dzp);
-+ zfs_inode_update(zp);
- ZFS_EXIT(zfsvfs);
-- return (error);
-+ return (0);
- }
-
- /*
-@@ -3705,13 +3683,6 @@ top:
- VERIFY3U(zfs_link_destroy(tdl, szp, tx,
- ZRENAMING, NULL), ==, 0);
- }
-- } else {
-- /*
-- * If we had removed the existing target, subsequent
-- * call to zfs_link_create() to add back the same entry
-- * but, the new dnode (szp) should not fail.
-- */
-- ASSERT(tzp == NULL);
- }
- }
-
-@@ -3882,18 +3853,14 @@ top:
- /*
- * Insert the new object into the directory.
- */
-- error = zfs_link_create(dl, zp, tx, ZNEW);
-- if (error != 0) {
-- zfs_znode_delete(zp, tx);
-- remove_inode_hash(ZTOI(zp));
-- } else {
-- if (flags & FIGNORECASE)
-- txtype |= TX_CI;
-- zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link);
-+ (void) zfs_link_create(dl, zp, tx, ZNEW);
-
-- zfs_inode_update(dzp);
-- zfs_inode_update(zp);
-- }
-+ if (flags & FIGNORECASE)
-+ txtype |= TX_CI;
-+ zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link);
-+
-+ zfs_inode_update(dzp);
-+ zfs_inode_update(zp);
-
- zfs_acl_ids_free(&acl_ids);
-
-@@ -3901,14 +3868,10 @@ top:
-
- zfs_dirent_unlock(dl);
-
-- if (error == 0) {
-- *ipp = ZTOI(zp);
-+ *ipp = ZTOI(zp);
-
-- if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
-- zil_commit(zilog, 0);
-- } else {
-- iput(ZTOI(zp));
-- }
-+ if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
-+ zil_commit(zilog, 0);
-
- ZFS_EXIT(zfsvfs);
- return (error);
-diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
-index 25ae3fe5e..4b2694202 100644
---- a/tests/runfiles/linux.run
-+++ b/tests/runfiles/linux.run
-@@ -55,7 +55,7 @@ tags = ['functional', 'cachefile']
- # 'mixed_none_lookup', 'mixed_none_lookup_ci', 'mixed_none_delete',
- # 'mixed_formd_lookup', 'mixed_formd_lookup_ci', 'mixed_formd_delete']
- [tests/functional/casenorm]
--tests = ['case_all_values', 'norm_all_values', 'mixed_create_failure']
-+tests = ['case_all_values', 'norm_all_values']
- tags = ['functional', 'casenorm']
-
- [tests/functional/chattr]
-diff --git a/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh b/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
-deleted file mode 100755
-index 51b5bb3f6..000000000
---- a/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
-+++ /dev/null
-@@ -1,136 +0,0 @@
--#!/bin/ksh -p
--#
--#
--# This file and its contents are supplied under the terms of the
--# Common Development and Distribution License ("CDDL"), version 1.0.
--# You may only use this file in accordance with the terms of version
--# 1.0 of the CDDL.
--#
--# A full copy of the text of the CDDL should have accompanied this
--# source. A copy of the CDDL is also available via the Internet at
--# http://www.illumos.org/license/CDDL.
--#
--#
--# Copyright 2018 Nutanix Inc. All rights reserved.
--#
--
--. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
--
--# DESCRIPTION:
--# For the filesystem with casesensitivity=mixed, normalization=none,
--# when multiple files with the same name (differing only in case) are created,
--# the number of files is limited to what can fit in a fatzap leaf-block.
--# And beyond that, it fails with ENOSPC.
--#
--# Ensure that the create/rename operations fail gracefully and not trigger an
--# ASSERT.
--#
--# STRATEGY:
--# Repeat the below steps for objects: files, directories, symlinks and hardlinks
--# 1. Create objects with same name but varying in case.
--# E.g. 'abcdefghijklmnop', 'Abcdefghijklmnop', 'ABcdefghijklmnop' etc.
--# The create should fail with ENOSPC.
--# 2. Create an object with name 'tmp_obj' and try to rename it to name that we
--# failed to add in step 1 above.
--# This should fail as well.
--
--verify_runnable "global"
--
--function cleanup
--{
-- destroy_testfs
--}
--
--log_onexit cleanup
--log_assert "With mixed mode: ensure create fails with ENOSPC beyond a certain limit"
--
--create_testfs "-o casesensitivity=mixed -o normalization=none"
--
--# Different object types
--obj_type=('file' 'dir' 'symlink' 'hardlink')
--
--# Commands to create different object types
--typeset -A ops
--ops['file']='touch'
--ops['dir']='mkdir'
--ops['symlink']='ln -s'
--ops['hardlink']='ln'
--
--# This function tests the following for a give object type :
--# - Create multiple objects with the same name (varying only in case).
--# Ensure that it eventually fails once the leaf-block limit is exceeded.
--# - Create another object with a different name. And attempt rename it to the
--# name (for which the create had failed in the previous step).
--# This should fail as well.
--# Args :
--# $1 - object type (file/dir/symlink/hardlink)
--# $2 - test directory
--#
--function test_ops
--{
-- typeset obj_type=$1
-- typeset testdir=$2
--
-- target_obj='target-file'
--
-- op="${ops[$obj_type]}"
--
-- log_note "The op : $op"
-- log_note "testdir=$testdir obj_type=$obj_type"
--
-- test_path="$testdir/$obj_type"
-- mkdir $test_path
-- log_note "Created test dir $test_path"
--
-- if [[ $obj_type = "symlink" || $obj_type = "hardlink" ]]; then
-- touch $test_path/$target_obj
-- log_note "Created target: $test_path/$target_obj"
-- op="$op $test_path/$target_obj"
-- fi
--
-- log_note "op : $op"
-- names='{a,A}{b,B}{c,C}{d,D}{e,E}{f,F}{g,G}{h,H}{i,I}{j,J}{k,K}{l,L}'
-- for name in $names; do
-- cmd="$op $test_path/$name"
-- out=$($cmd 2>&1)
-- ret=$?
-- log_note "cmd: $cmd ret: $ret out=$out"
-- if (($ret != 0)); then
-- if [[ $out = *@(No space left on device)* ]]; then
-- save_name="$test_path/$name"
-- break;
-- else
-- log_err "$cmd failed with unexpected error : $out"
-- fi
-- fi
-- done
--
-- log_note 'Test rename \"sample_name\" rename'
-- TMP_OBJ="$test_path/tmp_obj"
-- cmd="$op $TMP_OBJ"
-- out=$($cmd 2>&1)
-- ret=$?
-- if (($ret != 0)); then
-- log_err "cmd:$cmd failed out:$out"
-- fi
--
-- # Now, try to rename the tmp_obj to the name which we failed to add earlier.
-- # This should fail as well.
-- out=$(mv $TMP_OBJ $save_name 2>&1)
-- ret=$?
-- if (($ret != 0)); then
-- if [[ $out = *@(No space left on device)* ]]; then
-- log_note "$cmd failed as expected : $out"
-- else
-- log_err "$cmd failed with : $out"
-- fi
-- fi
--}
--
--for obj_type in ${obj_type[*]};
--do
-- log_note "Testing create of $obj_type"
-- test_ops $obj_type $TESTDIR
--done
--
--log_pass "Mixed mode FS: Ops on large number of colliding names fail gracefully"
---
-2.14.2
-
diff --git a/zfs-patches/0057-Tag-zfs-0.7.8.patch b/zfs-patches/0057-Tag-zfs-0.7.8.patch
deleted file mode 100644
index e923c1b..0000000
--- a/zfs-patches/0057-Tag-zfs-0.7.8.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Tony Hutter <***@llnl.gov>
-Date: Mon, 9 Apr 2018 14:31:57 -0700
-Subject: [PATCH] Tag zfs-0.7.8
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-META file and changelog updated.
-
-Signed-off-by: Tony Hutter <***@llnl.gov>
-(cherry picked from commit bd69ae3b537ac4e796c53b0c3d6efdc92d652da6)
-Signed-off-by: Fabian Grünbichler <***@proxmox.com>
----
- rpm/generic/zfs-kmod.spec.in | 3 +++
- rpm/generic/zfs.spec.in | 3 +++
- META | 2 +-
- 3 files changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in
-index bf52fa2c4..9db8e370a 100644
---- a/rpm/generic/zfs-kmod.spec.in
-+++ b/rpm/generic/zfs-kmod.spec.in
-@@ -191,6 +191,9 @@ chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/*
- rm -rf $RPM_BUILD_ROOT
-
- %changelog
-+* Mon Apr 09 2018 Tony Hutter <***@llnl.gov> - 0.7.8-1
-+- Released 0.7.8-1, detailed release notes are available at:
-+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.8
- * Wed Mar 14 2018 Tony Hutter <***@llnl.gov> - 0.7.7-1
- - Released 0.7.7-1, detailed release notes are available at:
- - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.7
-diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
-index 7479e987e..769bdab10 100644
---- a/rpm/generic/zfs.spec.in
-+++ b/rpm/generic/zfs.spec.in
-@@ -352,6 +352,9 @@ systemctl --system daemon-reload >/dev/null || true
- %endif
-
- %changelog
-+* Mon Apr 09 2018 Tony Hutter <***@llnl.gov> - 0.7.8-1
-+- Released 0.7.8-1, detailed release notes are available at:
-+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.8
- * Wed Mar 14 2018 Tony Hutter <***@llnl.gov> - 0.7.7-1
- - Released 0.7.7-1, detailed release notes are available at:
- - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.7
-diff --git a/META b/META
-index eefafb10d..615008960 100644
---- a/META
-+++ b/META
-@@ -1,7 +1,7 @@
- Meta: 1
- Name: zfs
- Branch: 1.0
--Version: 0.7.7
-+Version: 0.7.8
- Release: 1
- Release-Tags: relext
- License: CDDL
---
-2.14.2
-
diff --git a/zfs-patches/series b/zfs-patches/series
index 5ae2941..3d515ce 100644
--- a/zfs-patches/series
+++ b/zfs-patches/series
@@ -1,57 +1,3 @@
0001-remove-DKMS-modules-and-dracut-build.patch
0002-import-with-d-dev-disk-by-id-in-scan-service.patch
0003-always-load-ZFS-module-on-boot.patch
-0004-Make-enable-debug-fail-when-given-bogus-args.patch
-0005-Implement-enable-debuginfo-to-force-debuginfo.patch
-0006-Add-configure-option-to-enable-gcov-analysis.patch
-0007-Make-fno-inline-compile-option-more-accessible.patch
-0008-Add-support-for-enable-code-coverage-option.patch
-0009-Update-codecov.yml.patch
-0010-Fix-enable-code-coverage-debug-build.patch
-0011-Remove-vn_rename-and-vn_remove-dependency.patch
-0012-Fix-with-systemd-on-Debian-based-distributions-6963.patch
-0013-ZTS-Fix-create-o_ashift-test-case.patch
-0014-Emit-an-error-message-before-MMP-suspends-pool.patch
-0015-Fix-systemd_-RPM-macros-usage-on-Debian-based-distri.patch
-0016-Bug-fix-in-qat_compress.c-for-vmalloc-addr-check.patch
-0017-Fix-default-libdir-for-Debian-Ubuntu.patch
-0018-Remove-deprecated-zfs_arc_p_aggressive_disable.patch
-0019-OpenZFS-8966-Source-file-zfs_acl.c-function-zfs_acls.patch
-0020-Linux-4.16-compat-inode_set_iversion.patch
-0021-Linux-4.11-compat-avoid-refcount_t-name-conflict.patch
-0022-Fix-zdb-c-traverse-stop-on-damaged-objset-root.patch
-0023-Fix-zle_decompress-out-of-bound-access.patch
-0024-Fix-racy-assignment-of-zcb.zcb_haderrors.patch
-0025-Fix-zdb-R-decompression.patch
-0026-Fix-zdb-E-segfault.patch
-0027-Fix-zdb-ed-on-objset-for-exported-pool.patch
-0028-Handle-zap_add-failures-in-mixed-case-mode.patch
-0029-mmp-should-use-a-fixed-tag-for-spa_config-locks.patch
-0030-contrib-initramfs-add-missing-conf.d-zfs.patch
-0031-zfs-receive-fails-with-dataset-is-busy.patch
-0032-OpenZFS-8857-zio_remove_child-panic-due-to-already-d.patch
-0033-Clarify-zinject-8-explanation-of-e.patch
-0034-Fix-config-issues-frame-size-and-headers.patch
-0035-Correct-count_uberblocks-in-mmp.kshlib.patch
-0036-Add-SMART-attributes-for-SSD-and-NVMe.patch
-0037-Allow-modprobe-to-fail-when-called-within-systemd.patch
-0038-Linux-4.16-compat-use-correct-_dec_and_test.patch
-0039-Do-not-initiate-MMP-writes-while-pool-is-suspended.patch
-0040-Report-duration-and-error-in-mmp_history-entries.patch
-0041-Fix-free-memory-calculation-on-v3.14.patch
-0042-Add-scrub-after-resilver-zed-script.patch
-0043-Add-SMART-self-test-results-to-zpool-status-c.patch
-0044-Fix-zpool-8-list-example-to-match-actual-format.patch
-0045-Fix-some-typos.patch
-0046-Increment-zil_itx_needcopy_bytes-properly.patch
-0047-Change-checksum-IO-delay-ratelimit-values.patch
-0048-Linux-4.16-compat-get_disk_and_module.patch
-0049-Detect-long-config-lock-acquisition-in-mmp.patch
-0050-Take-user-namespaces-into-account-in-policy-checks.patch
-0051-zdb-and-inuse-tests-don-t-pass-with-real-disks.patch
-0052-Fix-zfs-kmod-builds-when-using-rpm-4.14.patch
-0053-Handle-zio_resume-and-mmp-off.patch
-0054-Fix-MMP-write-frequency-for-large-pools.patch
-0055-Tag-zfs-0.7.7.patch
-0056-Revert-Handle-zap_add-failures-in-mixed.patch
-0057-Tag-zfs-0.7.8.patch
--
2.11.0
Thomas Lamprecht
2018-05-22 11:23:09 UTC
Permalink
Bumped ZFS and SPL to new debian tag 0.7.9-2.
This removed most PVE patches for both projects, since they contained the
changes of the past upstream releases.
Added a patch (from https://salsa.debian.org/zfsonlinux-team/zfs/merge_requests/2)
to fix package metadata for zfsutils and zfs-test (files were moved between
both packages).
applied series
Regards,
stoiko
update ZFS submodule to debian/0.7.9-2
rebase ZFS on top of debian/0.7.9-2
update SPL submodule to debian/0.7.9-2
rebase SPL on top of debian/0.7.9-2
Add patch for fixing zfs-test/zfsutils file move
bump version to 0.7.9-pve1~bpo9
Makefile | 2 +-
spl-changelog.Debian | 6 +
spl-debian | 2 +-
.../0001-remove-DKMS-and-module-build.patch | 46 +-
.../0002-Allow-longer-SPA-names-in-stats.patch | 70 -
.../0003-Remove-vn_rename-and-vn_remove.patch | 527 --
.../0004-Remove-all-spin_is_locked-calls.patch | 169 -
spl-patches/0005-Add-cv_timedwait_io.patch | 189 -
spl-patches/0006-Fix-cstyle-warnings.patch | 7052 --------------------
spl-patches/0007-Split-spl-build.m4.patch | 2088 ------
...e-evaluations-of-VERIFY-and-ASSERT-on-fai.patch | 48 -
.../0009-Staticize-kstat_default_update.patch | 36 -
spl-patches/0010-Fix-function-name-typos.patch | 50 -
spl-patches/0011-Fix-more-cstyle-warnings.patch | 391 --
...2-Fix-spl-kmod-builds-when-using-rpm-4.14.patch | 38 -
spl-patches/0013-Tag-spl-0.7.7.patch | 63 -
spl-patches/0014-Tag-spl-0.7.8.patch | 63 -
spl-patches/series | 13 -
zfs-changelog.Debian | 6 +
zfs-debian | 2 +-
...0001-remove-DKMS-modules-and-dracut-build.patch | 62 +-
...ort-with-d-dev-disk-by-id-in-scan-service.patch | 6 +-
.../0003-always-load-ZFS-module-on-boot.patch | 4 +-
...-Expand-zfs-test-and-add-Breaks-Conflicts.patch | 102 +
...e-enable-debug-fail-when-given-bogus-args.patch | 89 -
...ement-enable-debuginfo-to-force-debuginfo.patch | 122 -
...-configure-option-to-enable-gcov-analysis.patch | 121 -
...fno-inline-compile-option-more-accessible.patch | 43 -
...d-support-for-enable-code-coverage-option.patch | 399 --
zfs-patches/0009-Update-codecov.yml.patch | 97 -
...0010-Fix-enable-code-coverage-debug-build.patch | 35 -
...Remove-vn_rename-and-vn_remove-dependency.patch | 153 -
...ystemd-on-Debian-based-distributions-6963.patch | 102 -
.../0013-ZTS-Fix-create-o_ashift-test-case.patch | 137 -
...an-error-message-before-MMP-suspends-pool.patch | 49 -
..._-RPM-macros-usage-on-Debian-based-distri.patch | 85 -
...-in-qat_compress.c-for-vmalloc-addr-check.patch | 39 -
...0017-Fix-default-libdir-for-Debian-Ubuntu.patch | 52 -
...e-deprecated-zfs_arc_p_aggressive_disable.patch | 71 -
...6-Source-file-zfs_acl.c-function-zfs_acls.patch | 51 -
...0020-Linux-4.16-compat-inode_set_iversion.patch | 145 -
....11-compat-avoid-refcount_t-name-conflict.patch | 53 -
...db-c-traverse-stop-on-damaged-objset-root.patch | 116 -
...23-Fix-zle_decompress-out-of-bound-access.patch | 40 -
...-Fix-racy-assignment-of-zcb.zcb_haderrors.patch | 59 -
zfs-patches/0025-Fix-zdb-R-decompression.patch | 130 -
zfs-patches/0026-Fix-zdb-E-segfault.patch | 50 -
...27-Fix-zdb-ed-on-objset-for-exported-pool.patch | 217 -
...andle-zap_add-failures-in-mixed-case-mode.patch | 553 --
...ould-use-a-fixed-tag-for-spa_config-locks.patch | 56 -
...-contrib-initramfs-add-missing-conf.d-zfs.patch | 66 -
...31-zfs-receive-fails-with-dataset-is-busy.patch | 90 -
...7-zio_remove_child-panic-due-to-already-d.patch | 247 -
.../0033-Clarify-zinject-8-explanation-of-e.patch | 40 -
...-Fix-config-issues-frame-size-and-headers.patch | 199 -
...35-Correct-count_uberblocks-in-mmp.kshlib.patch | 38 -
...036-Add-SMART-attributes-for-SSD-and-NVMe.patch | 131 -
...dprobe-to-fail-when-called-within-systemd.patch | 52 -
...nux-4.16-compat-use-correct-_dec_and_test.patch | 85 -
...itiate-MMP-writes-while-pool-is-suspended.patch | 39 -
...duration-and-error-in-mmp_history-entries.patch | 237 -
...0041-Fix-free-memory-calculation-on-v3.14.patch | 451 --
.../0042-Add-scrub-after-resilver-zed-script.patch | 516 --
...SMART-self-test-results-to-zpool-status-c.patch | 322 -
...ool-8-list-example-to-match-actual-format.patch | 66 -
zfs-patches/0045-Fix-some-typos.patch | 275 -
...Increment-zil_itx_needcopy_bytes-properly.patch | 46 -
...Change-checksum-IO-delay-ratelimit-values.patch | 201 -
...048-Linux-4.16-compat-get_disk_and_module.patch | 98 -
...etect-long-config-lock-acquisition-in-mmp.patch | 46 -
...-namespaces-into-account-in-policy-checks.patch | 786 ---
...nd-inuse-tests-don-t-pass-with-real-disks.patch | 232 -
...2-Fix-zfs-kmod-builds-when-using-rpm-4.14.patch | 39 -
.../0053-Handle-zio_resume-and-mmp-off.patch | 60 -
...4-Fix-MMP-write-frequency-for-large-pools.patch | 72 -
zfs-patches/0055-Tag-zfs-0.7.7.patch | 63 -
...6-Revert-Handle-zap_add-failures-in-mixed.patch | 551 --
zfs-patches/0057-Tag-zfs-0.7.8.patch | 63 -
zfs-patches/series | 55 +-
79 files changed, 177 insertions(+), 19088 deletions(-)
delete mode 100644 spl-patches/0002-Allow-longer-SPA-names-in-stats.patch
delete mode 100644 spl-patches/0003-Remove-vn_rename-and-vn_remove.patch
delete mode 100644 spl-patches/0004-Remove-all-spin_is_locked-calls.patch
delete mode 100644 spl-patches/0005-Add-cv_timedwait_io.patch
delete mode 100644 spl-patches/0006-Fix-cstyle-warnings.patch
delete mode 100644 spl-patches/0007-Split-spl-build.m4.patch
delete mode 100644 spl-patches/0008-Fix-multiple-evaluations-of-VERIFY-and-ASSERT-on-fai.patch
delete mode 100644 spl-patches/0009-Staticize-kstat_default_update.patch
delete mode 100644 spl-patches/0010-Fix-function-name-typos.patch
delete mode 100644 spl-patches/0011-Fix-more-cstyle-warnings.patch
delete mode 100644 spl-patches/0012-Fix-spl-kmod-builds-when-using-rpm-4.14.patch
delete mode 100644 spl-patches/0013-Tag-spl-0.7.7.patch
delete mode 100644 spl-patches/0014-Tag-spl-0.7.8.patch
create mode 100644 zfs-patches/0004-Expand-zfs-test-and-add-Breaks-Conflicts.patch
delete mode 100644 zfs-patches/0004-Make-enable-debug-fail-when-given-bogus-args.patch
delete mode 100644 zfs-patches/0005-Implement-enable-debuginfo-to-force-debuginfo.patch
delete mode 100644 zfs-patches/0006-Add-configure-option-to-enable-gcov-analysis.patch
delete mode 100644 zfs-patches/0007-Make-fno-inline-compile-option-more-accessible.patch
delete mode 100644 zfs-patches/0008-Add-support-for-enable-code-coverage-option.patch
delete mode 100644 zfs-patches/0009-Update-codecov.yml.patch
delete mode 100644 zfs-patches/0010-Fix-enable-code-coverage-debug-build.patch
delete mode 100644 zfs-patches/0011-Remove-vn_rename-and-vn_remove-dependency.patch
delete mode 100644 zfs-patches/0012-Fix-with-systemd-on-Debian-based-distributions-6963.patch
delete mode 100644 zfs-patches/0013-ZTS-Fix-create-o_ashift-test-case.patch
delete mode 100644 zfs-patches/0014-Emit-an-error-message-before-MMP-suspends-pool.patch
delete mode 100644 zfs-patches/0015-Fix-systemd_-RPM-macros-usage-on-Debian-based-distri.patch
delete mode 100644 zfs-patches/0016-Bug-fix-in-qat_compress.c-for-vmalloc-addr-check.patch
delete mode 100644 zfs-patches/0017-Fix-default-libdir-for-Debian-Ubuntu.patch
delete mode 100644 zfs-patches/0018-Remove-deprecated-zfs_arc_p_aggressive_disable.patch
delete mode 100644 zfs-patches/0019-OpenZFS-8966-Source-file-zfs_acl.c-function-zfs_acls.patch
delete mode 100644 zfs-patches/0020-Linux-4.16-compat-inode_set_iversion.patch
delete mode 100644 zfs-patches/0021-Linux-4.11-compat-avoid-refcount_t-name-conflict.patch
delete mode 100644 zfs-patches/0022-Fix-zdb-c-traverse-stop-on-damaged-objset-root.patch
delete mode 100644 zfs-patches/0023-Fix-zle_decompress-out-of-bound-access.patch
delete mode 100644 zfs-patches/0024-Fix-racy-assignment-of-zcb.zcb_haderrors.patch
delete mode 100644 zfs-patches/0025-Fix-zdb-R-decompression.patch
delete mode 100644 zfs-patches/0026-Fix-zdb-E-segfault.patch
delete mode 100644 zfs-patches/0027-Fix-zdb-ed-on-objset-for-exported-pool.patch
delete mode 100644 zfs-patches/0028-Handle-zap_add-failures-in-mixed-case-mode.patch
delete mode 100644 zfs-patches/0029-mmp-should-use-a-fixed-tag-for-spa_config-locks.patch
delete mode 100644 zfs-patches/0030-contrib-initramfs-add-missing-conf.d-zfs.patch
delete mode 100644 zfs-patches/0031-zfs-receive-fails-with-dataset-is-busy.patch
delete mode 100644 zfs-patches/0032-OpenZFS-8857-zio_remove_child-panic-due-to-already-d.patch
delete mode 100644 zfs-patches/0033-Clarify-zinject-8-explanation-of-e.patch
delete mode 100644 zfs-patches/0034-Fix-config-issues-frame-size-and-headers.patch
delete mode 100644 zfs-patches/0035-Correct-count_uberblocks-in-mmp.kshlib.patch
delete mode 100644 zfs-patches/0036-Add-SMART-attributes-for-SSD-and-NVMe.patch
delete mode 100644 zfs-patches/0037-Allow-modprobe-to-fail-when-called-within-systemd.patch
delete mode 100644 zfs-patches/0038-Linux-4.16-compat-use-correct-_dec_and_test.patch
delete mode 100644 zfs-patches/0039-Do-not-initiate-MMP-writes-while-pool-is-suspended.patch
delete mode 100644 zfs-patches/0040-Report-duration-and-error-in-mmp_history-entries.patch
delete mode 100644 zfs-patches/0041-Fix-free-memory-calculation-on-v3.14.patch
delete mode 100644 zfs-patches/0042-Add-scrub-after-resilver-zed-script.patch
delete mode 100644 zfs-patches/0043-Add-SMART-self-test-results-to-zpool-status-c.patch
delete mode 100644 zfs-patches/0044-Fix-zpool-8-list-example-to-match-actual-format.patch
delete mode 100644 zfs-patches/0045-Fix-some-typos.patch
delete mode 100644 zfs-patches/0046-Increment-zil_itx_needcopy_bytes-properly.patch
delete mode 100644 zfs-patches/0047-Change-checksum-IO-delay-ratelimit-values.patch
delete mode 100644 zfs-patches/0048-Linux-4.16-compat-get_disk_and_module.patch
delete mode 100644 zfs-patches/0049-Detect-long-config-lock-acquisition-in-mmp.patch
delete mode 100644 zfs-patches/0050-Take-user-namespaces-into-account-in-policy-checks.patch
delete mode 100644 zfs-patches/0051-zdb-and-inuse-tests-don-t-pass-with-real-disks.patch
delete mode 100644 zfs-patches/0052-Fix-zfs-kmod-builds-when-using-rpm-4.14.patch
delete mode 100644 zfs-patches/0053-Handle-zio_resume-and-mmp-off.patch
delete mode 100644 zfs-patches/0054-Fix-MMP-write-frequency-for-large-pools.patch
delete mode 100644 zfs-patches/0055-Tag-zfs-0.7.7.patch
delete mode 100644 zfs-patches/0056-Revert-Handle-zap_add-failures-in-mixed.patch
delete mode 100644 zfs-patches/0057-Tag-zfs-0.7.8.patch
Loading...