From 6ac2a001590357fb85d6f56e3e52c68d3e1b9220 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 11 Sep 2021 19:18:58 +0100 Subject: sys-kernel/zfs-dkms && sys-fs/zfs-utils : add linux-5.14 compat --- .../1c24bf966c373009f2be77438e8696aabf50a7e7.diff | 84 +++++++++++++ .../eb17f92e1edabcde442e5fbdff4525054be8595.diff | 133 ++++++++++++++++++++ sys-fs/zfs-utils/zfs-utils-2.1.0-r1.ebuild | 140 +++++++++++++++++++++ sys-fs/zfs-utils/zfs-utils-2.1.0.ebuild | 135 -------------------- 4 files changed, 357 insertions(+), 135 deletions(-) create mode 100644 sys-fs/zfs-utils/files/1c24bf966c373009f2be77438e8696aabf50a7e7.diff create mode 100644 sys-fs/zfs-utils/files/eb17f92e1edabcde442e5fbdff4525054be8595.diff create mode 100644 sys-fs/zfs-utils/zfs-utils-2.1.0-r1.ebuild delete mode 100644 sys-fs/zfs-utils/zfs-utils-2.1.0.ebuild (limited to 'sys-fs') diff --git a/sys-fs/zfs-utils/files/1c24bf966c373009f2be77438e8696aabf50a7e7.diff b/sys-fs/zfs-utils/files/1c24bf966c373009f2be77438e8696aabf50a7e7.diff new file mode 100644 index 00000000..e53bfb1c --- /dev/null +++ b/sys-fs/zfs-utils/files/1c24bf966c373009f2be77438e8696aabf50a7e7.diff @@ -0,0 +1,84 @@ +diff --git a/config/kernel-vfs-set_page_dirty.m4 b/config/kernel-vfs-set_page_dirty.m4 +new file mode 100644 +index 00000000000..a9d252e4e01 +--- /dev/null ++++ b/config/kernel-vfs-set_page_dirty.m4 +@@ -0,0 +1,34 @@ ++dnl # ++dnl # Linux 5.14 adds a change to require set_page_dirty to be manually ++dnl # wired up in struct address_space_operations. Determine if this needs ++dnl # to be done. This patch set also introduced __set_page_dirty_nobuffers ++dnl # declaration in linux/pagemap.h, so these tests look for the presence ++dnl # of that function to tell the compiler to assign set_page_dirty in ++dnl # module/os/linux/zfs/zpl_file.c ++dnl # ++AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS], [ ++ ZFS_LINUX_TEST_SRC([vfs_has_set_page_dirty_nobuffers], [ ++ #include ++ #include ++ ++ static const struct address_space_operations ++ aops __attribute__ ((unused)) = { ++ .set_page_dirty = __set_page_dirty_nobuffers, ++ }; ++ ],[]) ++]) ++ ++AC_DEFUN([ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS], [ ++ dnl # ++ dnl # Linux 5.14 change requires set_page_dirty() to be assigned ++ dnl # in address_space_operations() ++ dnl # ++ AC_MSG_CHECKING([__set_page_dirty_nobuffers exists]) ++ ZFS_LINUX_TEST_RESULT([vfs_has_set_page_dirty_nobuffers], [ ++ AC_MSG_RESULT([yes]) ++ AC_DEFINE(HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS, 1, ++ [__set_page_dirty_nobuffers exists]) ++ ],[ ++ AC_MSG_RESULT([no]) ++ ]) ++]) +diff --git a/config/kernel.m4 b/config/kernel.m4 +index 7196e66ca28..5ea2286dbcc 100644 +--- a/config/kernel.m4 ++++ b/config/kernel.m4 +@@ -132,6 +132,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ + ZFS_AC_KERNEL_SRC_SIGNAL_STOP + ZFS_AC_KERNEL_SRC_SIGINFO + ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE ++ ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS + + AC_MSG_CHECKING([for available kernel interfaces]) + ZFS_LINUX_TEST_COMPILE_ALL([kabi]) +@@ -237,6 +238,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ + ZFS_AC_KERNEL_SIGNAL_STOP + ZFS_AC_KERNEL_SIGINFO + ZFS_AC_KERNEL_SET_SPECIAL_STATE ++ ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS + ]) + + dnl # +diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c +index 0319148b983..63002fe3b93 100644 +--- a/module/os/linux/zfs/zpl_file.c ++++ b/module/os/linux/zfs/zpl_file.c +@@ -33,6 +33,9 @@ + #include + #include + #include ++#ifdef HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS ++#include ++#endif + + /* + * When using fallocate(2) to preallocate space, inflate the requested +@@ -1018,6 +1021,9 @@ const struct address_space_operations zpl_address_space_operations = { + .writepage = zpl_writepage, + .writepages = zpl_writepages, + .direct_IO = zpl_direct_IO, ++#ifdef HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS ++ .set_page_dirty = __set_page_dirty_nobuffers, ++#endif + }; + + const struct file_operations zpl_file_operations = { diff --git a/sys-fs/zfs-utils/files/eb17f92e1edabcde442e5fbdff4525054be8595.diff b/sys-fs/zfs-utils/files/eb17f92e1edabcde442e5fbdff4525054be8595.diff new file mode 100644 index 00000000..1e72ebaf --- /dev/null +++ b/sys-fs/zfs-utils/files/eb17f92e1edabcde442e5fbdff4525054be8595.diff @@ -0,0 +1,133 @@ +diff --git a/config/kernel-make-request-fn.m4 b/config/kernel-make-request-fn.m4 +index 290ef6b8da7..86b202a7a27 100644 +--- a/config/kernel-make-request-fn.m4 ++++ b/config/kernel-make-request-fn.m4 +@@ -42,6 +42,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [ + struct block_device_operations o; + o.submit_bio = NULL; + ]) ++ ++ ZFS_LINUX_TEST_SRC([blk_alloc_disk], [ ++ #include ++ ],[ ++ struct gendisk *disk __attribute__ ((unused)); ++ disk = blk_alloc_disk(NUMA_NO_NODE); ++ ]) + ]) + + AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [ +@@ -56,6 +63,19 @@ AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [ + + AC_DEFINE(HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS, 1, + [submit_bio is member of struct block_device_operations]) ++ ++ dnl # ++ dnl # Linux 5.14 API Change: ++ dnl # blk_alloc_queue() + alloc_disk() combo replaced by ++ dnl # a single call to blk_alloc_disk(). ++ dnl # ++ AC_MSG_CHECKING([whether blk_alloc_disk() exists]) ++ ZFS_LINUX_TEST_RESULT([blk_alloc_disk], [ ++ AC_MSG_RESULT(yes) ++ AC_DEFINE([HAVE_BLK_ALLOC_DISK], 1, [blk_alloc_disk() exists]) ++ ], [ ++ AC_MSG_RESULT(no) ++ ]) + ],[ + AC_MSG_RESULT(no) + +diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c +index 741979f11af..8b29d73a3e0 100644 +--- a/module/os/linux/zfs/zvol_os.c ++++ b/module/os/linux/zfs/zvol_os.c +@@ -762,7 +762,7 @@ static struct block_device_operations zvol_ops = { + .getgeo = zvol_getgeo, + .owner = THIS_MODULE, + #ifdef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS +- .submit_bio = zvol_submit_bio, ++ .submit_bio = zvol_submit_bio, + #endif + }; + +@@ -795,13 +795,40 @@ zvol_alloc(dev_t dev, const char *name) + mutex_init(&zv->zv_state_lock, NULL, MUTEX_DEFAULT, NULL); + + #ifdef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS ++#ifdef HAVE_BLK_ALLOC_DISK ++ zso->zvo_disk = blk_alloc_disk(NUMA_NO_NODE); ++ if (zso->zvo_disk == NULL) ++ goto out_kmem; ++ ++ zso->zvo_disk->minors = ZVOL_MINORS; ++ zso->zvo_queue = zso->zvo_disk->queue; ++#else + zso->zvo_queue = blk_alloc_queue(NUMA_NO_NODE); ++ if (zso->zvo_queue == NULL) ++ goto out_kmem; ++ ++ zso->zvo_disk = alloc_disk(ZVOL_MINORS); ++ if (zso->zvo_disk == NULL) { ++ blk_cleanup_queue(zso->zvo_queue); ++ goto out_kmem; ++ } ++ ++ zso->zvo_disk->queue = zso->zvo_queue; ++#endif /* HAVE_BLK_ALLOC_DISK */ + #else + zso->zvo_queue = blk_generic_alloc_queue(zvol_request, NUMA_NO_NODE); +-#endif + if (zso->zvo_queue == NULL) + goto out_kmem; + ++ zso->zvo_disk = alloc_disk(ZVOL_MINORS); ++ if (zso->zvo_disk == NULL) { ++ blk_cleanup_queue(zso->zvo_queue); ++ goto out_kmem; ++ } ++ ++ zso->zvo_disk->queue = zso->zvo_queue; ++#endif /* HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ ++ + blk_queue_set_write_cache(zso->zvo_queue, B_TRUE, B_TRUE); + + /* Limit read-ahead to a single page to prevent over-prefetching. */ +@@ -810,10 +837,6 @@ zvol_alloc(dev_t dev, const char *name) + /* Disable write merging in favor of the ZIO pipeline. */ + blk_queue_flag_set(QUEUE_FLAG_NOMERGES, zso->zvo_queue); + +- zso->zvo_disk = alloc_disk(ZVOL_MINORS); +- if (zso->zvo_disk == NULL) +- goto out_queue; +- + zso->zvo_queue->queuedata = zv; + zso->zvo_dev = dev; + zv->zv_open_count = 0; +@@ -844,14 +867,11 @@ zvol_alloc(dev_t dev, const char *name) + zso->zvo_disk->first_minor = (dev & MINORMASK); + zso->zvo_disk->fops = &zvol_ops; + zso->zvo_disk->private_data = zv; +- zso->zvo_disk->queue = zso->zvo_queue; + snprintf(zso->zvo_disk->disk_name, DISK_NAME_LEN, "%s%d", + ZVOL_DEV_NAME, (dev & MINORMASK)); + + return (zv); + +-out_queue: +- blk_cleanup_queue(zso->zvo_queue); + out_kmem: + kmem_free(zso, sizeof (struct zvol_state_os)); + kmem_free(zv, sizeof (zvol_state_t)); +@@ -882,8 +902,13 @@ zvol_free(zvol_state_t *zv) + zfs_rangelock_fini(&zv->zv_rangelock); + + del_gendisk(zv->zv_zso->zvo_disk); ++#if defined(HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS) && \ ++ defined(HAVE_BLK_ALLOC_DISK) ++ blk_cleanup_disk(zv->zv_zso->zvo_disk); ++#else + blk_cleanup_queue(zv->zv_zso->zvo_queue); + put_disk(zv->zv_zso->zvo_disk); ++#endif + + ida_simple_remove(&zvol_ida, + MINOR(zv->zv_zso->zvo_dev) >> ZVOL_MINOR_BITS); diff --git a/sys-fs/zfs-utils/zfs-utils-2.1.0-r1.ebuild b/sys-fs/zfs-utils/zfs-utils-2.1.0-r1.ebuild new file mode 100644 index 00000000..fef710b0 --- /dev/null +++ b/sys-fs/zfs-utils/zfs-utils-2.1.0-r1.ebuild @@ -0,0 +1,140 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DISTUTILS_OPTIONAL=1 +PYTHON_COMPAT=( python3_{7,8,9} ) + +inherit bash-completion-r1 distutils-r1 flag-o-matic pam toolchain-funcs udev + +MY_PN="zfs" +MY_P="${MY_PN}-${PV}" + +DESCRIPTION="Userland utilities for ZFS Linux kernel module" +HOMEPAGE="https://zfsonlinux.org/" + +SRC_URI="https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz" +KEYWORDS="~amd64" +S="${WORKDIR}/${MY_P}" + +LICENSE="BSD-2 CDDL MIT" +SLOT="0" +IUSE="debug pam python test-suite static-libs" + +DEPEND=" + net-libs/libtirpc[static-libs?] + sys-apps/util-linux[static-libs?] + sys-libs/zlib[static-libs(+)?] + virtual/libudev[static-libs(-)?] + dev-libs/openssl:0=[static-libs?] + pam? ( sys-libs/pam ) + python? ( + virtual/python-cffi[${PYTHON_USEDEP}] + ) +" + +BDEPEND="virtual/awk + virtual/pkgconfig + python? ( + dev-python/setuptools[${PYTHON_USEDEP}] + ) +" + +RDEPEND="${DEPEND} + !prefix? ( virtual/udev ) + sys-fs/udev-init-scripts + test-suite? ( + sys-apps/kmod[tools] + sys-apps/util-linux + sys-devel/bc + sys-block/parted + sys-fs/lsscsi + sys-fs/mdadm + sys-process/procps + ) +" + +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RESTRICT="test" + +PATCHES=( + "${FILESDIR}"/eb17f92e1edabcde442e5fbdff4525054be8595.diff + "${FILESDIR}"/1c24bf966c373009f2be77438e8696aabf50a7e7.diff +) + +src_prepare() { + default + + if use python; then + pushd contrib/pyzfs >/dev/null || die + distutils-r1_src_prepare + popd >/dev/null || die + fi + + # prevent errors showing up on zfs-mount stop, #647688 + # openrc will unmount all filesystems anyway. + sed -i "/^ZFS_UNMOUNT=/ s/yes/no/" "etc/default/zfs.in" || die +} + +src_configure() { + local myconf=( + --bindir="${EPREFIX}/bin" + --enable-shared + --disable-systemd + --enable-sysvinit + --localstatedir="${EPREFIX}/var" + --sbindir="${EPREFIX}/sbin" + --with-config=user + --with-dracutdir="${EPREFIX}/usr/lib/dracut" + --with-udevdir="$(get_udevdir)" + --with-pamconfigsdir="${EPREFIX}/unwanted_files" + --with-pammoduledir="$(getpam_mod_dir)" + --with-vendor=gentoo + $(use_enable debug) + $(use_enable pam) + $(use_enable python pyzfs) + ) + + econf "${myconf[@]}" +} + +src_compile() { + default + if use python; then + pushd contrib/pyzfs >/dev/null || die + distutils-r1_src_compile + popd >/dev/null || die + fi +} + +src_install() { + default + + gen_usr_ldscript -a nvpair uutil zfsbootenv zfs zfs_core zpool + + use pam && { rm -rv "${ED}/unwanted_files" || die ; } + + use test-suite || { rm -r "${ED}/usr/share/zfs" || die ; } + + if ! use static-libs; then + find "${ED}/" -name '*.la' -delete || die + fi + + dobashcomp contrib/bash_completion.d/zfs + bashcomp_alias zfs zpool + + # strip executable bit from conf.d file + fperms 0644 /etc/conf.d/zfs + + if use python; then + pushd contrib/pyzfs >/dev/null || die + distutils-r1_src_install + popd >/dev/null || die + fi + + # enforce best available python implementation + python_setup + python_fix_shebang "${ED}/bin" +} diff --git a/sys-fs/zfs-utils/zfs-utils-2.1.0.ebuild b/sys-fs/zfs-utils/zfs-utils-2.1.0.ebuild deleted file mode 100644 index ee5703b3..00000000 --- a/sys-fs/zfs-utils/zfs-utils-2.1.0.ebuild +++ /dev/null @@ -1,135 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DISTUTILS_OPTIONAL=1 -PYTHON_COMPAT=( python3_{7,8,9} ) - -inherit bash-completion-r1 distutils-r1 flag-o-matic pam toolchain-funcs udev - -MY_PN="zfs" -MY_P="${MY_PN}-${PV}" - -DESCRIPTION="Userland utilities for ZFS Linux kernel module" -HOMEPAGE="https://zfsonlinux.org/" - -SRC_URI="https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz" -KEYWORDS="~amd64" -S="${WORKDIR}/${MY_P}" - -LICENSE="BSD-2 CDDL MIT" -SLOT="0" -IUSE="debug pam python test-suite static-libs" - -DEPEND=" - net-libs/libtirpc[static-libs?] - sys-apps/util-linux[static-libs?] - sys-libs/zlib[static-libs(+)?] - virtual/libudev[static-libs(-)?] - dev-libs/openssl:0=[static-libs?] - pam? ( sys-libs/pam ) - python? ( - virtual/python-cffi[${PYTHON_USEDEP}] - ) -" - -BDEPEND="virtual/awk - virtual/pkgconfig - python? ( - dev-python/setuptools[${PYTHON_USEDEP}] - ) -" - -RDEPEND="${DEPEND} - !prefix? ( virtual/udev ) - sys-fs/udev-init-scripts - test-suite? ( - sys-apps/kmod[tools] - sys-apps/util-linux - sys-devel/bc - sys-block/parted - sys-fs/lsscsi - sys-fs/mdadm - sys-process/procps - ) -" - -REQUIRED_USE="${PYTHON_REQUIRED_USE}" - -RESTRICT="test" - -src_prepare() { - default - - if use python; then - pushd contrib/pyzfs >/dev/null || die - distutils-r1_src_prepare - popd >/dev/null || die - fi - - # prevent errors showing up on zfs-mount stop, #647688 - # openrc will unmount all filesystems anyway. - sed -i "/^ZFS_UNMOUNT=/ s/yes/no/" "etc/default/zfs.in" || die -} - -src_configure() { - local myconf=( - --bindir="${EPREFIX}/bin" - --enable-shared - --disable-systemd - --enable-sysvinit - --localstatedir="${EPREFIX}/var" - --sbindir="${EPREFIX}/sbin" - --with-config=user - --with-dracutdir="${EPREFIX}/usr/lib/dracut" - --with-udevdir="$(get_udevdir)" - --with-pamconfigsdir="${EPREFIX}/unwanted_files" - --with-pammoduledir="$(getpam_mod_dir)" - --with-vendor=gentoo - $(use_enable debug) - $(use_enable pam) - $(use_enable python pyzfs) - ) - - econf "${myconf[@]}" -} - -src_compile() { - default - if use python; then - pushd contrib/pyzfs >/dev/null || die - distutils-r1_src_compile - popd >/dev/null || die - fi -} - -src_install() { - default - - gen_usr_ldscript -a nvpair uutil zfsbootenv zfs zfs_core zpool - - use pam && { rm -rv "${ED}/unwanted_files" || die ; } - - use test-suite || { rm -r "${ED}/usr/share/zfs" || die ; } - - if ! use static-libs; then - find "${ED}/" -name '*.la' -delete || die - fi - - dobashcomp contrib/bash_completion.d/zfs - bashcomp_alias zfs zpool - - # strip executable bit from conf.d file - fperms 0644 /etc/conf.d/zfs - - if use python; then - pushd contrib/pyzfs >/dev/null || die - distutils-r1_src_install - popd >/dev/null || die - fi - - # enforce best available python implementation - python_setup - python_fix_shebang "${ED}/bin" -} -- cgit v1.2.3