From ec48dd09760d363a715e5c274a82e7cf8415023f Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sat, 24 Aug 2024 21:24:59 +1000 Subject: [PATCH] config: remove ZFS_GLOBAL_ZONE_PAGE_STATE and ZFS_ENUM_* generation Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf Reviewed-by: Tony Hutter Reviewed-by: Tino Reichardt Signed-off-by: Rob Norris Closes #16479 --- config/kernel-global_page_state.m4 | 69 --------------------- config/kernel.m4 | 1 - contrib/debian/not-installed | 1 - contrib/debian/rules.in | 1 - include/os/linux/kernel/linux/page_compat.h | 26 -------- scripts/Makefile.am | 1 - scripts/enum-extract.pl | 58 ----------------- 7 files changed, 157 deletions(-) delete mode 100644 config/kernel-global_page_state.m4 delete mode 100755 scripts/enum-extract.pl diff --git a/config/kernel-global_page_state.m4 b/config/kernel-global_page_state.m4 deleted file mode 100644 index fd256cc24..000000000 --- a/config/kernel-global_page_state.m4 +++ /dev/null @@ -1,69 +0,0 @@ -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" | grep -Eqx $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]) - ZFS_LINUX_TEST_ERROR([global page state]) -]) - -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. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY], [ - AC_MSG_CHECKING([whether 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]) - - 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_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_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_GLOBAL_ZONE_PAGE_STATE_SANITY -]) diff --git a/config/kernel.m4 b/config/kernel.m4 index 81868924f..843b57307 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -149,7 +149,6 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_TYPES ZFS_AC_KERNEL_ACCESS_OK_TYPE - ZFS_AC_KERNEL_GLOBAL_PAGE_STATE ZFS_AC_KERNEL_OBJTOOL ZFS_AC_KERNEL_PDE_DATA ZFS_AC_KERNEL_GENERIC_FADVISE diff --git a/contrib/debian/not-installed b/contrib/debian/not-installed index ad14776f3..88557f76f 100644 --- a/contrib/debian/not-installed +++ b/contrib/debian/not-installed @@ -1,5 +1,4 @@ usr/bin/arc_summary.py -usr/share/zfs/enum-extract.pl usr/share/zfs/zfs-helpers.sh etc/default/zfs etc/init.d diff --git a/contrib/debian/rules.in b/contrib/debian/rules.in index a3a05efac..b3b6d9b92 100755 --- a/contrib/debian/rules.in +++ b/contrib/debian/rules.in @@ -86,7 +86,6 @@ override_dh_auto_install: @# Install the DKMS source. @# We only want the files needed to build the modules install -D -t '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts' \ - '$(CURDIR)/scripts/enum-extract.pl' \ '$(CURDIR)/scripts/dkms.postbuild' $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit 1;) diff --git a/include/os/linux/kernel/linux/page_compat.h b/include/os/linux/kernel/linux/page_compat.h index 45e4fbe74..963b96ba6 100644 --- a/include/os/linux/kernel/linux/page_compat.h +++ b/include/os/linux/kernel/linux/page_compat.h @@ -1,37 +1,11 @@ #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_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 #endif /* _ZFS_PAGE_COMPAT_H */ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index b43bf97db..7d9cef83d 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -28,7 +28,6 @@ endif dist_noinst_DATA += \ %D%/cstyle.pl \ - %D%/enum-extract.pl \ %D%/update_authors.pl \ %D%/zfs2zol-patch.sed \ %D%/zol2zfs-patch.sed diff --git a/scripts/enum-extract.pl b/scripts/enum-extract.pl deleted file mode 100755 index 5dc2e3455..000000000 --- a/scripts/enum-extract.pl +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl - -my $usage = <) { - # 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;