Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: remove code gated behind kernel version checks #16545

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions include/os/linux/kernel/linux/simd_aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,7 @@
#include <asm/elf.h>
#include <asm/hwcap.h>
#include <linux/version.h>

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
#include <asm/sysreg.h>
#else
#define sys_reg(op0, op1, crn, crm, op2) ( \
((op0) << Op0_shift) | \
((op1) << Op1_shift) | \
((crn) << CRn_shift) | \
((crm) << CRm_shift) | \
((op2) << Op2_shift))
#endif

#define ID_AA64PFR0_EL1 sys_reg(3, 0, 0, 1, 0)
#define ID_AA64ISAR0_EL1 sys_reg(3, 0, 0, 6, 0)
Expand Down
11 changes: 0 additions & 11 deletions include/os/linux/kernel/linux/simd_powerpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,10 @@
#include <asm/switch_to.h>
#include <sys/types.h>
#include <linux/version.h>

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
#include <asm/cpufeature.h>
#else
#include <asm/cputable.h>
#endif

#define kfpu_allowed() 1

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
#ifdef CONFIG_ALTIVEC
#define ENABLE_KERNEL_ALTIVEC enable_kernel_altivec();
#define DISABLE_KERNEL_ALTIVEC disable_kernel_altivec();
Expand Down Expand Up @@ -101,11 +95,6 @@
DISABLE_KERNEL_ALTIVEC \
preempt_enable(); \
}
#else
/* seems that before 4.5 no-one bothered */
#define kfpu_begin()
#define kfpu_end() preempt_enable()
#endif /* Linux version >= 4.5 */

#define kfpu_init() 0
#define kfpu_fini() ((void) 0)
Expand Down
2 changes: 1 addition & 1 deletion module/os/linux/spl/spl-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <linux/version.h>
#include "zfs_gitrev.h"

#if defined(CONSTIFY_PLUGIN) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
#if defined(CONSTIFY_PLUGIN)
typedef struct ctl_table __no_const spl_ctl_table;
#else
typedef struct ctl_table spl_ctl_table;
Expand Down
29 changes: 18 additions & 11 deletions module/os/linux/zfs/abd_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,23 +1081,30 @@ abd_return_buf_copy(abd_t *abd, void *buf, size_t n)
* Before kernel 4.5 however, compound page heads were refcounted separately
* from tail pages, such that moving back to the head page would require us to
* take a reference to it and releasing it once we're completely finished with
* it. In practice, that means when our caller is done with the ABD, which we
* it. In practice, that meant when our caller is done with the ABD, which we
* have no insight into from here. Rather than contort this API to track head
* page references on such ancient kernels, we disable this special compound
* page handling on 4.5, instead just using treating each page within it as a
* regular PAGESIZE page (which it is). This is slightly less efficient, but
* makes everything far simpler.
* page references on such ancient kernels, we disabled this special compound
* page handling on kernels before 4.5, instead just using treating each page
* within it as a regular PAGESIZE page (which it is). This is slightly less
* efficient, but makes everything far simpler.
*
* The below test sets/clears ABD_ITER_COMPOUND_PAGES to enable/disable the
* special handling, and also defines the ABD_ITER_PAGE_SIZE(page) macro to
* understand compound pages, or not, as required.
* We no longer support kernels before 4.5, so in theory none of this is
* necessary. However, this code is still relatively new in the grand scheme of
* things, so I'm leaving the ability to compile this out for the moment.
*
* Setting/clearing ABD_ITER_COMPOUND_PAGES below enables/disables the special
* handling, by defining the ABD_ITER_PAGE_SIZE(page) macro to understand
* compound pages, or not, and compiling in/out the support to detect compound
* tail pages and move back to the start.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
#define ABD_ITER_COMPOUND_PAGES 1

/* On by default */
#define ABD_ITER_COMPOUND_PAGES

#ifdef ABD_ITER_COMPOUND_PAGES
#define ABD_ITER_PAGE_SIZE(page) \
(PageCompound(page) ? page_size(page) : PAGESIZE)
#else
#undef ABD_ITER_COMPOUND_PAGES
#define ABD_ITER_PAGE_SIZE(page) (PAGESIZE)
#endif

Expand Down
Loading