From 845b43d29c5209401eb78765fd3286f4cb11a4cb Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 12 Nov 2025 12:34:48 -0800 Subject: [PATCH 01/35] Remove use of d_materialise_unique This is no longer used. We always d_splice_alias. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/dir.c | 13 +------------ kmod/src/kernelcompat.h | 10 ---------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index ebe68445..232ef1fa 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,16 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v3.18-rc2-19-gb5ae6b15bd73 -# -# Folds d_materialise_unique into d_splice_alias. Note reversal -# of arguments (Also note Documentation/filesystems/porting.rst) -# -ifneq (,$(shell grep 'd_materialise_unique' include/linux/dcache.h)) -ccflags-y += -DKC_D_MATERIALISE_UNIQUE=1 -endif - # # RHEL extended the fop struct so to use it we have to set # a flag to indicate that the struct is large enough and diff --git a/kmod/src/dir.c b/kmod/src/dir.c index f9729d7d..2e482818 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -422,18 +422,7 @@ out: else inode = scoutfs_iget(sb, ino, 0, 0); - /* - * We can't splice dir aliases into the dcache. dir entries - * might have changed on other nodes so our dcache could still - * contain them, rather than having been moved in rename. For - * dirs, we use d_materialize_unique to remove any existing - * aliases which must be stale. Our inode numbers aren't reused - * so inodes pointed to by entries can't change types. - */ - if (!IS_ERR_OR_NULL(inode) && S_ISDIR(inode->i_mode)) - return d_materialise_unique(dentry, inode); - else - return d_splice_alias(inode, dentry); + return d_splice_alias(inode, dentry); } /* diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 06855bf6..0442eb04 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -45,16 +45,6 @@ do { \ #define WQ_NON_REENTRANT 0 #endif -/* - * v3.18-rc2-19-gb5ae6b15bd73 - * - * Folds d_materialise_unique into d_splice_alias. Note reversal - * of arguments (Also note Documentation/filesystems/porting.rst) - */ -#ifndef KC_D_MATERIALISE_UNIQUE -#define d_materialise_unique(dentry, inode) d_splice_alias(inode, dentry) -#endif - /* * v4.8-rc1-29-g31051c85b5e2 * From e1a8b17e0c62f977c7a48576cdcb00e074a3c69c Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 12 Nov 2025 12:54:18 -0800 Subject: [PATCH 02/35] Remove posix_acl_create We're now using __posix_acl_create instead. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/acl.c | 14 -------------- kmod/src/kernelcompat.h | 5 ----- 3 files changed, 29 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 232ef1fa..a5989ff8 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -34,16 +34,6 @@ ifneq (,$(shell grep 'static inline bool RBNAME.*_compute_max' include/linux/rbt ccflags-y += -DKC_RB_TREE_AUGMENTED_COMPUTE_MAX endif -# -# v3.13-25-g37bc15392a23 -# -# Renames posix_acl_create to __posix_acl_create and provide some -# new interfaces for creating ACLs -# -ifneq (,$(shell grep '__posix_acl_create' include/linux/posix_acl.h)) -ccflags-y += -DKC___POSIX_ACL_CREATE -endif - # # v4.8-rc1-29-g31051c85b5e2 # diff --git a/kmod/src/acl.c b/kmod/src/acl.c index c836df19..43b240f3 100644 --- a/kmod/src/acl.c +++ b/kmod/src/acl.c @@ -69,15 +69,6 @@ struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct s char *name; int ret; -#ifndef KC___POSIX_ACL_CREATE - if (!IS_POSIXACL(inode)) - return NULL; - - acl = get_cached_acl(inode, type); - if (acl != ACL_NOT_CACHED) - return acl; -#endif - ret = acl_xattr_name_len(type, &name, NULL); if (ret < 0) return ERR_PTR(ret); @@ -123,11 +114,6 @@ struct posix_acl *scoutfs_get_acl(struct inode *inode, int type) return ERR_PTR(-ECHILD); #endif -#ifndef KC___POSIX_ACL_CREATE - if (!IS_POSIXACL(inode)) - return NULL; -#endif - ret = scoutfs_lock_inode(sb, SCOUTFS_LOCK_READ, 0, inode, &lock); if (ret < 0) { acl = ERR_PTR(ret); diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 0442eb04..62002611 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -54,11 +54,6 @@ do { \ #define setattr_prepare(dentry, attr) inode_change_ok(d_inode(dentry), attr) #endif -#ifndef KC___POSIX_ACL_CREATE -#define __posix_acl_create posix_acl_create -#define __posix_acl_chmod posix_acl_chmod -#endif - #ifndef KC_PERCPU_COUNTER_ADD_BATCH #define percpu_counter_add_batch __percpu_counter_add #endif From 31c9ea40ce1819a799b587b53344a517ed60f57c Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 11:40:49 -0800 Subject: [PATCH 03/35] Remove shinker compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/kernelcompat.c | 27 --------------------------- kmod/src/kernelcompat.h | 30 ------------------------------ 3 files changed, 66 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index a5989ff8..2682cc03 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -92,15 +92,6 @@ ifneq (,$(shell grep 'bi_status' include/linux/blk_types.h)) ccflags-y += -DKC_BIO_BI_STATUS endif -# -# v3.11-8765-ga0b02131c5fc -# -# Remove the old ->shrink() API, ->{scan,count}_objects is preferred. -# -ifneq (,$(shell grep '(*shrink)' include/linux/shrinker.h)) -ccflags-y += -DKC_SHRINKER_SHRINK -endif - # # v3.19-4777-g6bec00352861 # diff --git a/kmod/src/kernelcompat.c b/kmod/src/kernelcompat.c index 2463d134..851d5e1a 100644 --- a/kmod/src/kernelcompat.c +++ b/kmod/src/kernelcompat.c @@ -3,33 +3,6 @@ #include "kernelcompat.h" -#ifdef KC_SHRINKER_SHRINK -#include -/* - * If a target doesn't have that .{count,scan}_objects() interface then - * we have a .shrink() helper that performs the shrink work in terms of - * count/scan. - */ -int kc_shrink_wrapper_fn(struct shrinker *shrink, struct shrink_control *sc) -{ - struct kc_shrinker_wrapper *wrapper = container_of(shrink, struct kc_shrinker_wrapper, shrink); - unsigned long nr; - unsigned long rc; - - if (sc->nr_to_scan != 0) { - rc = wrapper->scan_objects(shrink, sc); - /* translate magic values to the equivalent for older kernels */ - if (rc == SHRINK_STOP) - return -1; - else if (rc == SHRINK_EMPTY) - return 0; - } - - nr = wrapper->count_objects(shrink, sc); - - return min_t(unsigned long, nr, INT_MAX); -} -#endif #ifndef KC_CURRENT_TIME_INODE struct timespec64 kc_current_time(struct inode *inode) diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 62002611..3109e1e0 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -127,7 +127,6 @@ struct timespec64 kc_current_time(struct inode *inode); #define kc_timespec timespec64 #endif -#ifndef KC_SHRINKER_SHRINK #define KC_DEFINE_SHRINKER(name) struct shrinker name #define KC_INIT_SHRINKER_FUNCS(name, countfn, scanfn) do { \ @@ -145,35 +144,6 @@ struct timespec64 kc_current_time(struct inode *inode); #endif /* KC_SHRINKER_NAME */ #define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(ptr)) #define KC_SHRINKER_FN(ptr) (ptr) -#else - -#include -#ifndef SHRINK_STOP -#define SHRINK_STOP (~0UL) -#define SHRINK_EMPTY (~0UL - 1) -#endif - -int kc_shrink_wrapper_fn(struct shrinker *shrink, struct shrink_control *sc); -struct kc_shrinker_wrapper { - unsigned long (*count_objects)(struct shrinker *, struct shrink_control *sc); - unsigned long (*scan_objects)(struct shrinker *, struct shrink_control *sc); - struct shrinker shrink; -}; - -#define KC_DEFINE_SHRINKER(name) struct kc_shrinker_wrapper name; -#define KC_INIT_SHRINKER_FUNCS(name, countfn, scanfn) do { \ - struct kc_shrinker_wrapper *_wrap = (name); \ - _wrap->count_objects = (countfn); \ - _wrap->scan_objects = (scanfn); \ - _wrap->shrink.shrink = kc_shrink_wrapper_fn; \ - _wrap->shrink.seeks = DEFAULT_SEEKS; \ -} while (0) -#define KC_SHRINKER_CONTAINER_OF(ptr, type) container_of(container_of(ptr, struct kc_shrinker_wrapper, shrink), type, shrinker) -#define KC_REGISTER_SHRINKER(ptr, fmt, ...) (register_shrinker(ptr.shrink)) -#define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(ptr.shrink)) -#define KC_SHRINKER_FN(ptr) (ptr.shrink) - -#endif /* KC_SHRINKER_SHRINK */ #ifdef KC_KERNEL_GETSOCKNAME_ADDRLEN #include From 64587c505aef61473ff4a0bc9a86295aaa709c82 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 11:44:01 -0800 Subject: [PATCH 04/35] Remove backing_dev_info compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 2682cc03..8b76ab1b 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -92,16 +92,6 @@ ifneq (,$(shell grep 'bi_status' include/linux/blk_types.h)) ccflags-y += -DKC_BIO_BI_STATUS endif -# -# v3.19-4777-g6bec00352861 -# -# backing_dev_info is removed from address_space. Instead we need to use -# inode_to_bdi() inline from . -# -ifneq (,$(shell grep 'struct backing_dev_info.*backing_dev_info' include/linux/fs.h)) -ccflags-y += -DKC_LINUX_BACKING_DEV_INFO=1 -endif - # # v4.3-9290-ge409de992e3e # From 3d9a7918c488faff6dcd1629523a28493333c5cc Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 11:46:42 -0800 Subject: [PATCH 05/35] Remove KC_FMODE_KABI_ITERATE compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/dir.c | 11 ----------- 2 files changed, 20 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 8b76ab1b..43c6d1c9 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# RHEL extended the fop struct so to use it we have to set -# a flag to indicate that the struct is large enough and -# contains the pointer. -# -ifneq (,$(shell grep 'FMODE_KABI_ITERATE' include/linux/fs.h)) -ccflags-y += -DKC_FMODE_KABI_ITERATE -endif - # # v4.7-rc2-23-g0d4d717f2583 # diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 2e482818..e2bc774c 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -1903,14 +1903,6 @@ static int scoutfs_rename2(KC_VFS_NS_DEF old_dir, old_dentry, new_dir, new_dentry, flags); } -#ifdef KC_FMODE_KABI_ITERATE -/* we only need this to set the iterate flag for kabi :/ */ -static int scoutfs_dir_open(struct inode *inode, struct file *file) -{ - file->f_mode |= FMODE_KABI_ITERATE; - return 0; -} -#endif static int scoutfs_tmpfile(KC_VFS_NS_DEF struct inode *dir, @@ -2016,9 +2008,6 @@ const struct inode_operations scoutfs_symlink_iops = { const struct file_operations scoutfs_dir_fops = { .iterate = scoutfs_readdir, -#ifdef KC_FMODE_KABI_ITERATE - .open = scoutfs_dir_open, -#endif .unlocked_ioctl = scoutfs_ioctl, .fsync = scoutfs_file_fsync, .llseek = generic_file_llseek, From fcf94498fbfd7f8b1ae3e4ed1310ca113828078a Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 11:49:36 -0800 Subject: [PATCH 06/35] Remove kc_posix_acl_valid compat. This is a pre-el7 remnant, possibly from a really old rhel9 version, and was already effectively a stub. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/acl.c | 2 +- kmod/src/kernelcompat.h | 6 ------ 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 43c6d1c9..96d2dd58 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.7-rc2-23-g0d4d717f2583 -# -# Added user_ns argument to posix_acl_valid -# -ifneq (,$(shell grep 'posix_acl_valid.*user_namespace' include/linux/posix_acl.h)) -ccflags-y += -DKC_POSIX_ACL_VALID_USER_NS -endif - # # v5.3-12296-g6d2052d188d9 # diff --git a/kmod/src/acl.c b/kmod/src/acl.c index 43b240f3..f393d9af 100644 --- a/kmod/src/acl.c +++ b/kmod/src/acl.c @@ -287,7 +287,7 @@ int scoutfs_acl_set_xattr(struct dentry *dentry, const char *name, const void *v return PTR_ERR(acl); if (acl) { - ret = kc_posix_acl_valid(&init_user_ns, acl); + ret = posix_acl_valid(&init_user_ns, acl); if (ret) goto out; } diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 3109e1e0..cecd8359 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -29,12 +29,6 @@ do { \ }) #endif -#ifdef KC_POSIX_ACL_VALID_USER_NS -#define kc_posix_acl_valid(user_ns, acl) posix_acl_valid(user_ns, acl) -#else -#define kc_posix_acl_valid(user_ns, acl) posix_acl_valid(acl) -#endif - /* * v3.6-rc1-24-gdbf2576e37da * From 94d06e65bcebdcba86f19e4ff99b9216d18e807f Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 11:52:10 -0800 Subject: [PATCH 07/35] Remove KC_RB_TREE_AUGMENTED_COMPUTE_MAX compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/tseq.c | 12 ------------ 2 files changed, 22 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 96d2dd58..1140549d 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,16 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v5.3-12296-g6d2052d188d9 -# -# The RBCOMPUTE function is now passed an extra flag, and should return a bool -# to indicate whether the propagated callback should stop or not. -# -ifneq (,$(shell grep 'static inline bool RBNAME.*_compute_max' include/linux/rbtree_augmented.h)) -ccflags-y += -DKC_RB_TREE_AUGMENTED_COMPUTE_MAX -endif - # # v4.8-rc1-29-g31051c85b5e2 # diff --git a/kmod/src/tseq.c b/kmod/src/tseq.c index 2621406f..d4d24fc7 100644 --- a/kmod/src/tseq.c +++ b/kmod/src/tseq.c @@ -46,7 +46,6 @@ static struct scoutfs_tseq_entry *tseq_rb_next(struct scoutfs_tseq_entry *ent) return rb_entry(node, struct scoutfs_tseq_entry, node); } -#ifdef KC_RB_TREE_AUGMENTED_COMPUTE_MAX static bool tseq_compute_total(struct scoutfs_tseq_entry *ent, bool exit) { loff_t total = 1 + tseq_node_total(ent->node.rb_left) + @@ -61,17 +60,6 @@ static bool tseq_compute_total(struct scoutfs_tseq_entry *ent, bool exit) RB_DECLARE_CALLBACKS(static, tseq_rb_callbacks, struct scoutfs_tseq_entry, node, total, tseq_compute_total); -#else - -static loff_t tseq_compute_total(struct scoutfs_tseq_entry *ent) -{ - return 1 + tseq_node_total(ent->node.rb_left) + - tseq_node_total(ent->node.rb_right); -} - -RB_DECLARE_CALLBACKS(static, tseq_rb_callbacks, struct scoutfs_tseq_entry, - node, loff_t, total, tseq_compute_total); -#endif void scoutfs_tseq_tree_init(struct scoutfs_tseq_tree *tree, scoutfs_tseq_show_t show) From 9102dc0136aca3850b1f38754eab40d47ad852f2 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 11:54:54 -0800 Subject: [PATCH 08/35] Remove setattr_prepare() compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/kernelcompat.h | 9 --------- 2 files changed, 19 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 1140549d..6e888e0c 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,16 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.8-rc1-29-g31051c85b5e2 -# -# inode_change_ok() removed - replace with setattr_prepare() -# v5.11-rc4-7-g2f221d6f7b88 removes extern attribute -# -ifneq (,$(shell grep 'int setattr_prepare' include/linux/fs.h)) -ccflags-y += -DKC_SETATTR_PREPARE -endif - # # v4.15-rc3-4-gae5e165d855d # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index cecd8359..d2394739 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -39,15 +39,6 @@ do { \ #define WQ_NON_REENTRANT 0 #endif -/* - * v4.8-rc1-29-g31051c85b5e2 - * - * fall back to inode_change_ok() if setattr_prepare() isn't available - */ -#ifndef KC_SETATTR_PREPARE -#define setattr_prepare(dentry, attr) inode_change_ok(d_inode(dentry), attr) -#endif - #ifndef KC_PERCPU_COUNTER_ADD_BATCH #define percpu_counter_add_batch __percpu_counter_add #endif From 276034f89df8bbe9f9ad775781dae77efe28f34f Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 11:59:10 -0800 Subject: [PATCH 09/35] Remove iversion.h compat for el7 For simplicity we just include the header here now that we don't need it in the kernelcompat anymore. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/acl.c | 1 + kmod/src/data.c | 1 + kmod/src/dir.c | 1 + kmod/src/inode.c | 1 + kmod/src/kernelcompat.h | 25 ------------------------- kmod/src/xattr.c | 1 + 7 files changed, 5 insertions(+), 35 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 6e888e0c..ffe66ced 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,16 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.15-rc3-4-gae5e165d855d -# -# linux/iversion.h needs to manually be included for code that -# manipulates this field. -# -ifneq (,$(shell grep -s 'define _LINUX_IVERSION_H' include/linux/iversion.h)) -ccflags-y += -DKC_NEED_LINUX_IVERSION_H=1 -endif - # v4.11-12447-g104b4e5139fe # # Renamed __percpu_counter_add to percpu_counter_add_batch to clarify diff --git a/kmod/src/acl.c b/kmod/src/acl.c index f393d9af..8ae6e8ff 100644 --- a/kmod/src/acl.c +++ b/kmod/src/acl.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "format.h" #include "super.h" diff --git a/kmod/src/data.c b/kmod/src/data.c index b6ca5eb1..65c07f01 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "format.h" #include "super.h" diff --git a/kmod/src/dir.c b/kmod/src/dir.c index e2bc774c..59fd00aa 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "format.h" #include "file.h" diff --git a/kmod/src/inode.c b/kmod/src/inode.c index 621833d2..3c87353d 100644 --- a/kmod/src/inode.c +++ b/kmod/src/inode.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "format.h" #include "super.h" diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index d2394739..0e7d9b84 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -4,31 +4,6 @@ #include #include -/* - * v4.15-rc3-4-gae5e165d855d - * - * new API for handling inode->i_version. This forces us to - * include this API where we need. We include it here for - * convenience instead of where it's needed. - */ -#ifdef KC_NEED_LINUX_IVERSION_H -#include -#else -/* - * Kernels before above version will need to fall back to - * manipulating inode->i_version as previous with degraded - * methods. - */ -#define inode_set_iversion_queried(inode, val) \ -do { \ - (inode)->i_version = val; \ -} while (0) -#define inode_peek_iversion(inode) \ -({ \ - (inode)->i_version; \ -}) -#endif - /* * v3.6-rc1-24-gdbf2576e37da * diff --git a/kmod/src/xattr.c b/kmod/src/xattr.c index d8c468e3..cb9f0549 100644 --- a/kmod/src/xattr.c +++ b/kmod/src/xattr.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "format.h" #include "inode.h" From 7c0c1e6f3843d2a4e19e65f7e54f14991dfa4f5e Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 12:01:08 -0800 Subject: [PATCH 10/35] Remove __percpu_counter_add compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/kernelcompat.h | 3 --- 2 files changed, 12 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index ffe66ced..9247b364 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# v4.11-12447-g104b4e5139fe -# -# Renamed __percpu_counter_add to percpu_counter_add_batch to clarify -# that the __ wasn't less safe, just took an extra parameter. -# -ifneq (,$(shell grep 'percpu_counter_add_batch' include/linux/percpu_counter.h)) -ccflags-y += -DKC_PERCPU_COUNTER_ADD_BATCH -endif - # # v4.11-4550-g7dea19f9ee63 # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 0e7d9b84..be4c0857 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -14,9 +14,6 @@ #define WQ_NON_REENTRANT 0 #endif -#ifndef KC_PERCPU_COUNTER_ADD_BATCH -#define percpu_counter_add_batch __percpu_counter_add -#endif #ifndef KC_MEMALLOC_NOFS_SAVE #define memalloc_nofs_save memalloc_noio_save From 84a3e73086ffbb81a6599fa602677c86b739f865 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 12:02:50 -0800 Subject: [PATCH 11/35] Remove memalloc_noio_save/_restore compath for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/kernelcompat.h | 4 ---- 2 files changed, 13 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 9247b364..26e2aae5 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.11-4550-g7dea19f9ee63 -# -# Introduced memalloc_nofs_{save,restore} preferred instead of _noio_. -# -ifneq (,$(shell grep 'memalloc_nofs_save' include/linux/sched/mm.h)) -ccflags-y += -DKC_MEMALLOC_NOFS_SAVE -endif - # # v4.7-12414-g1eff9d322a44 # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index be4c0857..67fea5a0 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -15,10 +15,6 @@ #endif -#ifndef KC_MEMALLOC_NOFS_SAVE -#define memalloc_nofs_save memalloc_noio_save -#define memalloc_nofs_restore memalloc_noio_restore -#endif #ifdef KC_BIO_BI_OPF #define kc_bio_get_opf(bio) \ From 166238abc75d8e2e31727dd5d8662eefc6d0e2cd Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 12:12:05 -0800 Subject: [PATCH 12/35] Remove KC_BIO_BI_OPF compat for el7 Unwrap the remaining stubs everywhere used. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 --------- kmod/src/block.c | 12 +++++----- kmod/src/kernelcompat.h | 41 +--------------------------------- 3 files changed, 7 insertions(+), 56 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 26e2aae5..15e5d7d1 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,16 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.7-12414-g1eff9d322a44 -# -# Renamed bi_rw to bi_opf to force old code to catch up. We use it as a -# single switch between old and new bio structures. -# -ifneq (,$(shell grep 'bi_opf' include/linux/blk_types.h)) -ccflags-y += -DKC_BIO_BI_OPF -endif - # # v4.12-rc2-201-g4e4cbee93d56 # diff --git a/kmod/src/block.c b/kmod/src/block.c index 5ad81377..8d581da3 100644 --- a/kmod/src/block.c +++ b/kmod/src/block.c @@ -450,7 +450,7 @@ static void KC_DECLARE_BIO_END_IO(block_bio_end_io, struct bio *bio) struct super_block *sb = bp->sb; TRACE_BLOCK(end_io, bp); - block_end_io(sb, kc_bio_get_opf(bio), bp, kc_bio_get_errno(bio)); + block_end_io(sb, bio->bi_opf, bp, kc_bio_get_errno(bio)); bio_put(bio); } @@ -499,7 +499,7 @@ static int block_submit_bio(struct super_block *sb, struct block_private *bp, break; } - kc_bio_set_sector(bio, sector + (off >> 9)); + bio->bi_iter.bi_sector = sector + (off >> 9); bio->bi_end_io = block_bio_end_io; bio->bi_private = bp; @@ -516,13 +516,13 @@ static int block_submit_bio(struct super_block *sb, struct block_private *bp, BUG(); if (!bio_add_page(bio, page, PAGE_SIZE, 0)) { - kc_submit_bio(bio); + submit_bio(bio); bio = NULL; } } if (bio) - kc_submit_bio(bio); + submit_bio(bio); blk_finish_plug(&plug); @@ -1236,7 +1236,7 @@ static int sm_block_io(struct super_block *sb, struct block_device *bdev, blk_op goto out; } - kc_bio_set_sector(bio, blkno << (SCOUTFS_BLOCK_SM_SHIFT - 9)); + bio->bi_iter.bi_sector = blkno << (SCOUTFS_BLOCK_SM_SHIFT - 9); bio->bi_end_io = sm_block_bio_end_io; bio->bi_private = &sbc; bio_add_page(bio, page, SCOUTFS_BLOCK_SM_SIZE, 0); @@ -1244,7 +1244,7 @@ static int sm_block_io(struct super_block *sb, struct block_device *bdev, blk_op init_completion(&sbc.comp); sbc.err = 0; - kc_submit_bio(bio); + submit_bio(bio); wait_for_completion(&sbc.comp); ret = sbc.err; diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 67fea5a0..af36ea88 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -14,45 +14,6 @@ #define WQ_NON_REENTRANT 0 #endif - - -#ifdef KC_BIO_BI_OPF -#define kc_bio_get_opf(bio) \ -({ \ - (bio)->bi_opf; \ -}) -#define kc_bio_set_opf(bio, opf) \ -do { \ - (bio)->bi_opf = opf; \ -} while (0) -#define kc_bio_set_sector(bio, sect) \ -do { \ - (bio)->bi_iter.bi_sector = sect;\ -} while (0) -#define kc_submit_bio(bio) submit_bio(bio) -#else -#define kc_bio_get_opf(bio) \ -({ \ - (bio)->bi_rw; \ -}) -#define kc_bio_set_opf(bio, opf) \ -do { \ - (bio)->bi_rw = opf; \ -} while (0) -#define kc_bio_set_sector(bio, sect) \ -do { \ - (bio)->bi_sector = sect; \ -} while (0) -#define kc_submit_bio(bio) \ -do { \ - submit_bio((bio)->bi_rw, bio); \ -} while (0) -#define bio_set_dev(bio, bdev) \ -do { \ - (bio)->bi_bdev = (bdev); \ -} while (0) -#endif - #ifdef KC_BIO_BI_STATUS #define KC_DECLARE_BIO_END_IO(name, bio) name(bio) #define kc_bio_get_errno(bio) ({ blk_status_to_errno((bio)->bi_status); }) @@ -196,7 +157,7 @@ static inline struct bio *kc_bio_alloc(struct block_device *bdev, unsigned short { struct bio *b = bio_alloc(gfp_mask, nr_vecs); if (b) { - kc_bio_set_opf(b, opf); + b->bi_opf = opf; bio_set_dev(b, bdev); } return b; From 1824980d29e9d976e88128400196cd93fbf7bc92 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 12:20:23 -0800 Subject: [PATCH 13/35] Remove KC_BIO_BI_STATUS compat for el7 Unwrap the remaining stubs. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/block.c | 8 ++++---- kmod/src/kernelcompat.h | 8 -------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 15e5d7d1..34074a70 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,16 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.12-rc2-201-g4e4cbee93d56 -# -# Moves to bi_status BLK_STS_ API instead of having a mix of error -# end_io args or bi_error. -# -ifneq (,$(shell grep 'bi_status' include/linux/blk_types.h)) -ccflags-y += -DKC_BIO_BI_STATUS -endif - # # v4.3-9290-ge409de992e3e # diff --git a/kmod/src/block.c b/kmod/src/block.c index 8d581da3..7d28758e 100644 --- a/kmod/src/block.c +++ b/kmod/src/block.c @@ -444,13 +444,13 @@ static void block_end_io(struct super_block *sb, blk_opf_t opf, wake_up(&binf->waitq); } -static void KC_DECLARE_BIO_END_IO(block_bio_end_io, struct bio *bio) +static void block_bio_end_io(struct bio *bio) { struct block_private *bp = bio->bi_private; struct super_block *sb = bp->sb; TRACE_BLOCK(end_io, bp); - block_end_io(sb, bio->bi_opf, bp, kc_bio_get_errno(bio)); + block_end_io(sb, bio->bi_opf, bp, blk_status_to_errno(bio->bi_status)); bio_put(bio); } @@ -1179,11 +1179,11 @@ struct sm_block_completion { int err; }; -static void KC_DECLARE_BIO_END_IO(sm_block_bio_end_io, struct bio *bio) +static void sm_block_bio_end_io(struct bio *bio) { struct sm_block_completion *sbc = bio->bi_private; - sbc->err = kc_bio_get_errno(bio); + sbc->err = blk_status_to_errno(bio->bi_status); complete(&sbc->comp); bio_put(bio); } diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index af36ea88..c12f27d8 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -14,14 +14,6 @@ #define WQ_NON_REENTRANT 0 #endif -#ifdef KC_BIO_BI_STATUS -#define KC_DECLARE_BIO_END_IO(name, bio) name(bio) -#define kc_bio_get_errno(bio) ({ blk_status_to_errno((bio)->bi_status); }) -#else -#define KC_DECLARE_BIO_END_IO(name, bio) name(bio, int _error_arg) -#define kc_bio_get_errno(bio) ({ (int)((void)(bio), _error_arg); }) -#endif - /* * v4.13-rc1-6-ge462ec50cb5f * From a3b77c224fd0783c46050db6ac8398f0c2c497bf Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 14:02:27 -0800 Subject: [PATCH 14/35] Remove KC_XATTR_STRUCT_XATTR_HANDLER compat for el7 This includes removal of a lot of double function definitions. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/acl.c | 12 ------------ kmod/src/acl.h | 7 ------- kmod/src/xattr.c | 27 --------------------------- 4 files changed, 55 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 34074a70..fa0105b7 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.3-9290-ge409de992e3e -# -# xattr handlers are now passed a struct that contains `flags` -# -ifneq (,$(shell grep 'int...get..const struct xattr_handler.*struct dentry.*dentry,' include/linux/xattr.h)) -ccflags-y += -DKC_XATTR_STRUCT_XATTR_HANDLER=1 -endif - # # v4.16-rc1-1-g9b2c45d479d0 # diff --git a/kmod/src/acl.c b/kmod/src/acl.c index 8ae6e8ff..fa3066ed 100644 --- a/kmod/src/acl.c +++ b/kmod/src/acl.c @@ -227,17 +227,11 @@ int scoutfs_set_acl(KC_VFS_NS_DEF scoutfs_unlock(sb, lock, SCOUTFS_LOCK_WRITE); return ret; } -#ifdef KC_XATTR_STRUCT_XATTR_HANDLER int scoutfs_acl_get_xattr(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size) { int type = handler->flags; -#else -int scoutfs_acl_get_xattr(struct dentry *dentry, const char *name, void *value, size_t size, - int type) -{ -#endif struct posix_acl *acl; int ret = 0; @@ -260,7 +254,6 @@ int scoutfs_acl_get_xattr(struct dentry *dentry, const char *name, void *value, return ret; } -#ifdef KC_XATTR_STRUCT_XATTR_HANDLER int scoutfs_acl_set_xattr(const struct xattr_handler *handler, KC_VFS_NS_DEF struct dentry *dentry, @@ -268,11 +261,6 @@ int scoutfs_acl_set_xattr(const struct xattr_handler *handler, size_t size, int flags) { int type = handler->flags; -#else -int scoutfs_acl_set_xattr(struct dentry *dentry, const char *name, const void *value, size_t size, - int flags, int type) -{ -#endif struct posix_acl *acl = NULL; int ret; diff --git a/kmod/src/acl.h b/kmod/src/acl.h index 2b64fafa..b9c8cc84 100644 --- a/kmod/src/acl.h +++ b/kmod/src/acl.h @@ -16,7 +16,6 @@ struct posix_acl *scoutfs_get_acl(struct inode *inode, int type); struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct scoutfs_lock *lock); int scoutfs_set_acl_locked(struct inode *inode, struct posix_acl *acl, int type, struct scoutfs_lock *lock, struct list_head *ind_locks); -#ifdef KC_XATTR_STRUCT_XATTR_HANDLER int scoutfs_acl_get_xattr(const struct xattr_handler *, struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size); @@ -25,12 +24,6 @@ int scoutfs_acl_set_xattr(const struct xattr_handler *, struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags); -#else -int scoutfs_acl_get_xattr(struct dentry *dentry, const char *name, void *value, size_t size, - int type); -int scoutfs_acl_set_xattr(struct dentry *dentry, const char *name, const void *value, size_t size, - int flags, int type); -#endif int scoutfs_acl_chmod_locked(struct inode *inode, struct iattr *attr, struct scoutfs_lock *lock, struct list_head *ind_locks); int scoutfs_init_acl_locked(struct inode *inode, struct inode *dir, diff --git a/kmod/src/xattr.c b/kmod/src/xattr.c index cb9f0549..f6197c82 100644 --- a/kmod/src/xattr.c +++ b/kmod/src/xattr.c @@ -995,38 +995,17 @@ unlock: return ret; } -#ifndef KC_XATTR_STRUCT_XATTR_HANDLER -/* - * Future kernels have this amazing hack to rewind the name to get the - * skipped prefix. We're back in the stone ages without the handler - * arg, so we Just Know that this is possible. This will become a - * compat hook to either call the kernel's xattr_full_name(handler), or - * our hack to use the flags as the prefix length. - */ -static const char *full_name_hack(const char *name, int len) -{ - return name - len; -} -#endif static int scoutfs_xattr_get_handler -#ifdef KC_XATTR_STRUCT_XATTR_HANDLER (const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size) { name = xattr_full_name(handler, name); -#else - (struct dentry *dentry, const char *name, - void *value, size_t size, int handler_flags) -{ - name = full_name_hack(name, handler_flags); -#endif return scoutfs_xattr_get(dentry, name, value, size); } static int scoutfs_xattr_set_handler -#ifdef KC_XATTR_STRUCT_XATTR_HANDLER (const struct xattr_handler *handler, KC_VFS_NS_DEF struct dentry *dentry, @@ -1034,12 +1013,6 @@ static int scoutfs_xattr_set_handler size_t size, int flags) { name = xattr_full_name(handler, name); -#else - (struct dentry *dentry, const char *name, - const void *value, size_t size, int flags, int handler_flags) -{ - name = full_name_hack(name, handler_flags); -#endif return scoutfs_xattr_set(dentry, name, value, size, flags); } From d611cf1368878b17d574706eb7522342676f23a6 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 14:10:54 -0800 Subject: [PATCH 15/35] Remove kc_get_sock/peername compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/kernelcompat.h | 30 ------------------------------ kmod/src/net.c | 6 +++--- 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index fa0105b7..1af23107 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.16-rc1-1-g9b2c45d479d0 -# -# kernel_getsockname() and kernel_getpeername dropped addrlen arg -# -ifneq (,$(shell grep 'kernel_getsockname.*,$$' include/linux/net.h)) -ccflags-y += -DKC_KERNEL_GETSOCKNAME_ADDRLEN=1 -endif - # # v4.1-rc1-410-geeb1bd5c40ed # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index c12f27d8..44fdfae2 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -51,36 +51,6 @@ struct timespec64 kc_current_time(struct inode *inode); #define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(ptr)) #define KC_SHRINKER_FN(ptr) (ptr) -#ifdef KC_KERNEL_GETSOCKNAME_ADDRLEN -#include -#include -static inline int kc_kernel_getsockname(struct socket *sock, struct sockaddr *addr) -{ - int addrlen = sizeof(struct sockaddr_in); - int ret = kernel_getsockname(sock, addr, &addrlen); - if (ret == 0 && addrlen != sizeof(struct sockaddr_in)) - return -EAFNOSUPPORT; - else if (ret < 0) - return ret; - - return sizeof(struct sockaddr_in); -} -static inline int kc_kernel_getpeername(struct socket *sock, struct sockaddr *addr) -{ - int addrlen = sizeof(struct sockaddr_in); - int ret = kernel_getpeername(sock, addr, &addrlen); - if (ret == 0 && addrlen != sizeof(struct sockaddr_in)) - return -EAFNOSUPPORT; - else if (ret < 0) - return ret; - - return sizeof(struct sockaddr_in); -} -#else -#define kc_kernel_getsockname(sock, addr) kernel_getsockname(sock, addr) -#define kc_kernel_getpeername(sock, addr) kernel_getpeername(sock, addr) -#endif - #ifdef KC_SOCK_CREATE_KERN_NET #define kc_sock_create_kern(family, type, proto, res) sock_create_kern(&init_net, family, type, proto, res) #else diff --git a/kmod/src/net.c b/kmod/src/net.c index b028d7c8..cbb3d3d9 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -1113,11 +1113,11 @@ static int sock_opts_and_names(struct super_block *sb, if (ret) goto out; - ret = kc_kernel_getsockname(sock, (struct sockaddr *)&conn->sockname); + ret = kernel_getsockname(sock, (struct sockaddr *)&conn->sockname); if (ret < 0) goto out; - ret = kc_kernel_getpeername(sock, (struct sockaddr *)&conn->peername); + ret = kernel_getpeername(sock, (struct sockaddr *)&conn->peername); if (ret < 0) goto out; @@ -1651,7 +1651,7 @@ int scoutfs_net_bind(struct super_block *sb, if (ret < 0) goto out; - ret = kc_kernel_getsockname(sock, (struct sockaddr *)&conn->sockname); + ret = kernel_getsockname(sock, (struct sockaddr *)&conn->sockname); if (ret < 0) goto out; From c83e37c1c77584210f0b0dfd28381fea62e3b98f Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 14:13:59 -0800 Subject: [PATCH 16/35] Remove kc_sock_create_kern compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/kernelcompat.h | 6 ------ kmod/src/net.c | 4 ++-- kmod/src/quorum.c | 2 +- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 1af23107..b6223568 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.1-rc1-410-geeb1bd5c40ed -# -# Adds a struct net parameter to sock_create_kern -# -ifneq (,$(shell grep 'sock_create_kern.*struct net' include/linux/net.h)) -ccflags-y += -DKC_SOCK_CREATE_KERN_NET=1 -endif - # # v4.17-rc6-7-g95582b008388 # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 44fdfae2..94d87893 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -51,12 +51,6 @@ struct timespec64 kc_current_time(struct inode *inode); #define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(ptr)) #define KC_SHRINKER_FN(ptr) (ptr) -#ifdef KC_SOCK_CREATE_KERN_NET -#define kc_sock_create_kern(family, type, proto, res) sock_create_kern(&init_net, family, type, proto, res) -#else -#define kc_sock_create_kern sock_create_kern -#endif - #ifndef KC_GENERIC_FILE_BUFFERED_WRITE ssize_t kc_generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos, loff_t *ppos, diff --git a/kmod/src/net.c b/kmod/src/net.c index cbb3d3d9..b28be556 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -1218,7 +1218,7 @@ static void scoutfs_net_connect_worker(struct work_struct *work) trace_scoutfs_net_connect_work_enter(sb, 0, 0); - ret = kc_sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); + ret = sock_create_kern(&init_net, AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); if (ret) goto out; @@ -1630,7 +1630,7 @@ int scoutfs_net_bind(struct super_block *sb, if (WARN_ON_ONCE(conn->sock)) return -EINVAL; - ret = kc_sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); + ret = sock_create_kern(&init_net, AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); if (ret) goto out; diff --git a/kmod/src/quorum.c b/kmod/src/quorum.c index fc25904e..69471249 100644 --- a/kmod/src/quorum.c +++ b/kmod/src/quorum.c @@ -183,7 +183,7 @@ static int create_socket(struct super_block *sb) int addrlen; int ret; - ret = kc_sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock); + ret = sock_create_kern(&init_net, PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock); if (ret) { scoutfs_err(sb, "quorum couldn't create udp socket: %d", ret); goto out; From 99415423ae769ae75c3257bf6d2357f81bceb2d3 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 14:17:37 -0800 Subject: [PATCH 17/35] Remove timespec64 compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/data.c | 2 +- kmod/src/dir.c | 4 ++-- kmod/src/inode.h | 2 +- kmod/src/kernelcompat.c | 30 ------------------------------ kmod/src/kernelcompat.h | 9 --------- 6 files changed, 4 insertions(+), 52 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index b6223568..ddd89eef 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.17-rc6-7-g95582b008388 -# -# Kernel has current_time(inode) to uniformly retreive timespec in the right unit -# -ifneq (,$(shell grep 'struct timespec64 current_time' include/linux/fs.h)) -ccflags-y += -DKC_CURRENT_TIME_INODE=1 -endif - # # v4.9-12228-g530e9b76ae8f # diff --git a/kmod/src/data.c b/kmod/src/data.c index 65c07f01..27d528b0 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -1268,7 +1268,7 @@ int scoutfs_data_move_blocks(struct inode *from, u64 from_off, struct data_ext_args from_args; struct data_ext_args to_args; struct scoutfs_extent ext; - struct kc_timespec cur_time; + struct timespec64 cur_time; LIST_HEAD(locks); bool done = false; loff_t from_size; diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 59fd00aa..993bb3a7 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -952,7 +952,7 @@ static int scoutfs_unlink(struct inode *dir, struct dentry *dentry) { struct super_block *sb = dir->i_sb; struct inode *inode = dentry->d_inode; - struct kc_timespec ts = current_time(inode); + struct timespec64 ts = current_time(inode); struct scoutfs_lock *inode_lock = NULL; struct scoutfs_lock *orph_lock = NULL; struct scoutfs_lock *dir_lock = NULL; @@ -1625,7 +1625,7 @@ static int scoutfs_rename_common(KC_VFS_NS_DEF struct scoutfs_lock *orph_lock = NULL; struct scoutfs_dirent new_dent; struct scoutfs_dirent old_dent; - struct kc_timespec now; + struct timespec64 now; bool ins_new = false; bool del_new = false; bool ins_old = false; diff --git a/kmod/src/inode.h b/kmod/src/inode.h index fcead8fb..b5d57802 100644 --- a/kmod/src/inode.h +++ b/kmod/src/inode.h @@ -23,7 +23,7 @@ struct scoutfs_inode_info { u64 offline_blocks; u64 proj; u32 flags; - struct kc_timespec crtime; + struct timespec64 crtime; /* * Protects per-inode extent items, most particularly readers diff --git a/kmod/src/kernelcompat.c b/kmod/src/kernelcompat.c index 851d5e1a..f36a4a6a 100644 --- a/kmod/src/kernelcompat.c +++ b/kmod/src/kernelcompat.c @@ -4,36 +4,6 @@ #include "kernelcompat.h" -#ifndef KC_CURRENT_TIME_INODE -struct timespec64 kc_current_time(struct inode *inode) -{ - struct timespec64 now; - unsigned gran; - - getnstimeofday64(&now); - - if (unlikely(!inode->i_sb)) { - WARN(1, "current_time() called with uninitialized super_block in the inode"); - return now; - } - - gran = inode->i_sb->s_time_gran; - - /* Avoid division in the common cases 1 ns and 1 s. */ - if (gran == 1) { - /* nothing */ - } else if (gran == NSEC_PER_SEC) { - now.tv_nsec = 0; - } else if (gran > 1 && gran < NSEC_PER_SEC) { - now.tv_nsec -= now.tv_nsec % gran; - } else { - WARN(1, "illegal file time granularity: %u", gran); - } - - return now; -} -#endif - #ifndef KC_GENERIC_FILE_BUFFERED_WRITE ssize_t kc_generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 94d87893..58f90754 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -25,15 +25,6 @@ #define SB_I_VERSION MS_I_VERSION #endif -#ifndef KC_CURRENT_TIME_INODE -struct timespec64 kc_current_time(struct inode *inode); -#define current_time kc_current_time -#define kc_timespec timespec -#else -#define kc_timespec timespec64 -#endif - - #define KC_DEFINE_SHRINKER(name) struct shrinker name #define KC_INIT_SHRINKER_FUNCS(name, countfn, scanfn) do { \ __typeof__(name) _shrink = (name); \ From 16af2fe5ff2f5cf9678813c60a75ac075592ec72 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 14:19:52 -0800 Subject: [PATCH 18/35] Remove KC_CPU_NOTIFIER compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/item.c | 26 -------------------------- 2 files changed, 36 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index ddd89eef..ec79b23e 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,16 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.9-12228-g530e9b76ae8f -# -# register_cpu_notifier and family were all removed and to be -# replaced with cpuhp_* API calls. -# -ifneq (,$(shell grep 'define register_hotcpu_notifier' include/linux/cpu.h)) -ccflags-y += -DKC_CPU_NOTIFIER -endif - # # v3.14-rc8-130-gccad2365668f # diff --git a/kmod/src/item.c b/kmod/src/item.c index e0047be4..fdeb7c9e 100644 --- a/kmod/src/item.c +++ b/kmod/src/item.c @@ -79,9 +79,6 @@ struct item_cache_info { struct super_block *sb; struct item_percpu_pages __percpu *pcpu_pages; KC_DEFINE_SHRINKER(shrinker); -#ifdef KC_CPU_NOTIFIER - struct notifier_block notifier; -#endif /* often walked, but per-cpu refs are fast path */ rwlock_t rwlock; @@ -2584,22 +2581,6 @@ static unsigned long item_cache_scan_objects(struct shrinker *shrink, return freed; } -#ifdef KC_CPU_NOTIFIER -static int item_cpu_callback(struct notifier_block *nfb, - unsigned long action, void *hcpu) -{ - struct item_cache_info *cinf = container_of(nfb, - struct item_cache_info, - notifier); - struct super_block *sb = cinf->sb; - unsigned long cpu = (unsigned long)hcpu; - - if (action == CPU_DEAD) - drop_pcpu_pages(sb, cinf, cpu); - - return NOTIFY_OK; -} -#endif int scoutfs_item_setup(struct super_block *sb) { @@ -2630,10 +2611,6 @@ int scoutfs_item_setup(struct super_block *sb) KC_INIT_SHRINKER_FUNCS(&cinf->shrinker, item_cache_count_objects, item_cache_scan_objects); KC_REGISTER_SHRINKER(&cinf->shrinker, "scoutfs-item:" SCSBF, SCSB_ARGS(sb)); -#ifdef KC_CPU_NOTIFIER - cinf->notifier.notifier_call = item_cpu_callback; - register_hotcpu_notifier(&cinf->notifier); -#endif sbi->item_cache_info = cinf; return 0; @@ -2651,9 +2628,6 @@ void scoutfs_item_destroy(struct super_block *sb) int cpu; if (cinf) { -#ifdef KC_CPU_NOTIFIER - unregister_hotcpu_notifier(&cinf->notifier); -#endif KC_UNREGISTER_SHRINKER(&cinf->shrinker); for_each_possible_cpu(cpu) From 2944ea6424634f35337dade81715665d631c0f13 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 15:04:41 -0800 Subject: [PATCH 19/35] remove generic_file_buffered_write backport for el7 We still need to keep KC_GENERIC_PERFORM_WRITE_KIOCB_IOV_ITER for el8. So kc_generic_perform_write remains in place for now. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/ioctl.c | 6 ++++-- kmod/src/kernelcompat.c | 22 ---------------------- kmod/src/kernelcompat.h | 6 ------ 4 files changed, 4 insertions(+), 39 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index ec79b23e..ef24230a 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v3.14-rc8-130-gccad2365668f -# -# generic_file_buffered_write is removed, backport it -# -ifneq (,$(shell grep 'extern ssize_t generic_file_buffered_write' include/linux/fs.h)) -ccflags-y += -DKC_GENERIC_FILE_BUFFERED_WRITE=1 -endif - # # v5.7-438-g8151b4c8bee4 # diff --git a/kmod/src/ioctl.c b/kmod/src/ioctl.c index 156538ad..5a9622f2 100644 --- a/kmod/src/ioctl.c +++ b/kmod/src/ioctl.c @@ -489,6 +489,7 @@ static long scoutfs_ioc_stage(struct file *file, unsigned long arg) struct scoutfs_lock *lock = NULL; struct kiocb kiocb; struct iovec iov; + struct iov_iter iter; size_t written; loff_t end_size; loff_t isize; @@ -559,8 +560,9 @@ static long scoutfs_ioc_stage(struct file *file, unsigned long arg) pos = args.offset; written = 0; do { - ret = generic_file_buffered_write(&kiocb, &iov, 1, pos, &pos, - args.length, written); + iov_iter_init(&iter, WRITE, &iov, 1, args.length); + ret = kc_generic_perform_write(&kiocb, &iter, pos); + BUG_ON(ret == -EIOCBQUEUED); if (ret > 0) written += ret; diff --git a/kmod/src/kernelcompat.c b/kmod/src/kernelcompat.c index f36a4a6a..561dcad1 100644 --- a/kmod/src/kernelcompat.c +++ b/kmod/src/kernelcompat.c @@ -3,28 +3,6 @@ #include "kernelcompat.h" - -#ifndef KC_GENERIC_FILE_BUFFERED_WRITE -ssize_t -kc_generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, - unsigned long nr_segs, loff_t pos, loff_t *ppos, - size_t count, ssize_t written) -{ - ssize_t status; - struct iov_iter i; - - iov_iter_init(&i, WRITE, iov, nr_segs, count); - status = kc_generic_perform_write(iocb, &i, pos); - - if (likely(status >= 0)) { - written += status; - *ppos = pos + status; - } - - return written ? written : status; -} -#endif - #include #ifdef KC_LIST_LRU_WALK_CB_ITEM_LOCK diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 58f90754..bc150026 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -42,11 +42,6 @@ #define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(ptr)) #define KC_SHRINKER_FN(ptr) (ptr) -#ifndef KC_GENERIC_FILE_BUFFERED_WRITE -ssize_t kc_generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, - unsigned long nr_segs, loff_t pos, loff_t *ppos, - size_t count, ssize_t written); -#define generic_file_buffered_write kc_generic_file_buffered_write #ifdef KC_GENERIC_PERFORM_WRITE_KIOCB_IOV_ITER static inline int kc_generic_perform_write(struct kiocb *iocb, struct iov_iter *iter, loff_t pos) { @@ -60,7 +55,6 @@ static inline int kc_generic_perform_write(struct kiocb *iocb, struct iov_iter * return generic_perform_write(file, iter, pos); } #endif -#endif // KC_GENERIC_FILE_BUFFERED_WRITE #ifndef KC_HAVE_BLK_OPF_T /* typedef __u32 __bitwise blk_opf_t; */ From 986efe1ce10a03a62499d8a62e306bd7806378bf Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 15:11:34 -0800 Subject: [PATCH 20/35] All workqueues are non-reentrant since el8 Signed-off-by: Auke Kok --- kmod/src/fence.c | 3 +-- kmod/src/forest.c | 2 +- kmod/src/kernelcompat.h | 10 ---------- kmod/src/lock.c | 3 +-- kmod/src/net.c | 9 +++------ kmod/src/quorum.c | 3 +-- kmod/src/server.c | 2 +- kmod/src/srch.c | 3 +-- 8 files changed, 9 insertions(+), 26 deletions(-) diff --git a/kmod/src/fence.c b/kmod/src/fence.c index c63f27b4..60799917 100644 --- a/kmod/src/fence.c +++ b/kmod/src/fence.c @@ -424,8 +424,7 @@ int scoutfs_fence_setup(struct super_block *sb) goto out; } - fi->wq = alloc_workqueue("scoutfs_fence", - WQ_UNBOUND | WQ_NON_REENTRANT, 0); + fi->wq = alloc_workqueue("scoutfs_fence", WQ_UNBOUND, 0); if (!fi->wq) { ret = -ENOMEM; goto out; diff --git a/kmod/src/forest.c b/kmod/src/forest.c index 38681273..7eb9cfa5 100644 --- a/kmod/src/forest.c +++ b/kmod/src/forest.c @@ -783,7 +783,7 @@ int scoutfs_forest_setup(struct super_block *sb) scoutfs_forest_log_merge_worker); sbi->forest_info = finf; - finf->workq = alloc_workqueue("scoutfs_log_merge", WQ_NON_REENTRANT | + finf->workq = alloc_workqueue("scoutfs_log_merge", WQ_UNBOUND | WQ_HIGHPRI, 0); if (!finf->workq) { ret = -ENOMEM; diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index bc150026..cd238b99 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -4,16 +4,6 @@ #include #include -/* - * v3.6-rc1-24-gdbf2576e37da - * - * All workqueues are now non-reentrant, and the bit flag is removed - * shortly after its uses were removed. - */ -#ifndef WQ_NON_REENTRANT -#define WQ_NON_REENTRANT 0 -#endif - /* * v4.13-rc1-6-ge462ec50cb5f * diff --git a/kmod/src/lock.c b/kmod/src/lock.c index 9b3eab61..f3b21345 100644 --- a/kmod/src/lock.c +++ b/kmod/src/lock.c @@ -1693,8 +1693,7 @@ int scoutfs_lock_setup(struct super_block *sb) } linfo->workq = alloc_workqueue("scoutfs_lock_client_work", - WQ_NON_REENTRANT | WQ_UNBOUND | - WQ_HIGHPRI, 0); + WQ_UNBOUND | WQ_HIGHPRI, 0); if (!linfo->workq) { ret = -ENOMEM; goto out; diff --git a/kmod/src/net.c b/kmod/src/net.c index b28be556..8ff4a22d 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -1517,8 +1517,7 @@ scoutfs_net_alloc_conn(struct super_block *sb, conn->ordered_proc_wlists = kmalloc_array(nr, sizeof(struct scoutfs_work_list), GFP_NOFS); conn->workq = alloc_workqueue("scoutfs_net_%s", - WQ_UNBOUND | WQ_NON_REENTRANT, 0, - name_suffix); + WQ_UNBOUND, 0, name_suffix); } if (!conn || (info_size && !conn->info) || !conn->workq || !conn->ordered_proc_wlists) { if (conn) { @@ -2099,11 +2098,9 @@ int scoutfs_net_setup(struct super_block *sb) scoutfs_tseq_tree_init(&ninf->msg_tseq_tree, net_tseq_show_msg); ninf->shutdown_workq = alloc_workqueue("scoutfs_net_shutdown", - WQ_UNBOUND | WQ_NON_REENTRANT, - 0); + WQ_UNBOUND, 0); ninf->destroy_workq = alloc_workqueue("scoutfs_net_destroy", - WQ_UNBOUND | WQ_NON_REENTRANT, - 0); + WQ_UNBOUND, 0); if (!ninf->shutdown_workq || !ninf->destroy_workq) { ret = -ENOMEM; goto out; diff --git a/kmod/src/quorum.c b/kmod/src/quorum.c index 69471249..d87033c5 100644 --- a/kmod/src/quorum.c +++ b/kmod/src/quorum.c @@ -1332,8 +1332,7 @@ int scoutfs_quorum_setup(struct super_block *sb) /* a high priority single threaded context without mem reclaim */ qinf->workq = alloc_workqueue("scoutfs_quorum_work", - WQ_NON_REENTRANT | WQ_UNBOUND | - WQ_HIGHPRI, 1); + WQ_UNBOUND | WQ_HIGHPRI, 1); if (!qinf->workq) { ret = -ENOMEM; goto out; diff --git a/kmod/src/server.c b/kmod/src/server.c index ddf405b8..ed97f556 100644 --- a/kmod/src/server.c +++ b/kmod/src/server.c @@ -4751,7 +4751,7 @@ int scoutfs_server_setup(struct super_block *sb) INIT_DELAYED_WORK(&server->reclaim_dwork, reclaim_worker); server->wq = alloc_workqueue("scoutfs_server", - WQ_UNBOUND | WQ_NON_REENTRANT, 0); + WQ_UNBOUND, 0); if (!server->wq) { kfree(server); return -ENOMEM; diff --git a/kmod/src/srch.c b/kmod/src/srch.c index e1b5fb90..c4ce1b79 100644 --- a/kmod/src/srch.c +++ b/kmod/src/srch.c @@ -2392,8 +2392,7 @@ int scoutfs_srch_setup(struct super_block *sb) goto out; srinf->workq = alloc_workqueue("scoutfs_srch_compact", - WQ_NON_REENTRANT | WQ_UNBOUND | - WQ_HIGHPRI, 0); + WQ_UNBOUND | WQ_HIGHPRI, 0); if (!srinf->workq) { ret = -ENOMEM; goto out; From c81832a2c6950caceee14c97e03aad3345edd971 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 15:14:53 -0800 Subject: [PATCH 21/35] Remove MS_* (mount) flags for el7 These are obsolete, we won't need their backwards compatible versions anymore. Signed-off-by: Auke Kok --- kmod/src/kernelcompat.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index cd238b99..9b9d710f 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -4,17 +4,6 @@ #include #include -/* - * v4.13-rc1-6-ge462ec50cb5f - * - * MS_* (mount) flags from should not be used in the kernel - * anymore from 4.x onwards. Instead, we need to use the SB_* (superblock) flags - */ -#ifndef SB_POSIXACL -#define SB_POSIXACL MS_POSIXACL -#define SB_I_VERSION MS_I_VERSION -#endif - #define KC_DEFINE_SHRINKER(name) struct shrinker name #define KC_INIT_SHRINKER_FUNCS(name, countfn, scanfn) do { \ __typeof__(name) _shrink = (name); \ From 1af104063116b2a11143bfc9f49f98c3ce6f24d3 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 15:17:29 -0800 Subject: [PATCH 22/35] Remove KC_FILE_AOPS_READAHEAD compat for el7 Thanks to RH backporting this 5.x kernel feature, we can drop a large chunk of code here. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 12 -------- kmod/src/data.c | 53 ---------------------------------- 2 files changed, 65 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index ef24230a..a203f3fd 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,18 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v5.7-438-g8151b4c8bee4 -# -# struct address_space_operations switches away from .readpages to .readahead -# -# RHEL has backported this feature all the way to RHEL8, as part of RHEL_KABI, -# which means we need to detect this very precisely -# -ifneq (,$(shell grep 'readahead.*struct readahead_control' include/linux/fs.h)) -ccflags-y += -DKC_FILE_AOPS_READAHEAD -endif - # # v4.0-rc7-1743-g8436318205b9 # diff --git a/kmod/src/data.c b/kmod/src/data.c index 27d528b0..6afa224b 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -758,54 +758,6 @@ static int scoutfs_readpage(struct file *file, struct page *page) return ret; } -#ifndef KC_FILE_AOPS_READAHEAD -/* - * This is used for opportunistic read-ahead which can throw the pages - * away if it needs to. If the caller didn't deal with offline extents - * then we drop those pages rather than trying to wait. Whoever is - * staging offline extents should be doing it in enormous chunks so that - * read-ahead can ramp up within each staged region. The check for - * offline extents is cheap when the inode has no offline extents. - */ -static int scoutfs_readpages(struct file *file, struct address_space *mapping, - struct list_head *pages, unsigned nr_pages) -{ - struct inode *inode = file->f_inode; - struct super_block *sb = inode->i_sb; - struct scoutfs_lock *inode_lock = NULL; - struct page *page; - struct page *tmp; - int ret; - - ret = scoutfs_lock_inode(sb, SCOUTFS_LOCK_READ, - SCOUTFS_LKF_REFRESH_INODE, inode, &inode_lock); - if (ret) - goto out; - - list_for_each_entry_safe(page, tmp, pages, lru) { - ret = scoutfs_data_wait_check(inode, page_offset(page), - PAGE_SIZE, SEF_OFFLINE, - SCOUTFS_IOC_DWO_READ, NULL, - inode_lock); - if (ret < 0) - goto out; - if (ret > 0) { - list_del(&page->lru); - put_page(page); - if (--nr_pages == 0) { - ret = 0; - goto out; - } - } - } - - ret = mpage_readpages(mapping, pages, nr_pages, scoutfs_get_block_read); -out: - scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ); - BUG_ON(!list_empty(pages)); - return ret; -} -#else static void scoutfs_readahead(struct readahead_control *rac) { struct inode *inode = rac->file->f_inode; @@ -827,7 +779,6 @@ static void scoutfs_readahead(struct readahead_control *rac) scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ); } -#endif static int scoutfs_writepage(struct page *page, struct writeback_control *wbc) { @@ -2302,11 +2253,7 @@ const struct address_space_operations scoutfs_file_aops = { #else .readpage = scoutfs_readpage, #endif -#ifndef KC_FILE_AOPS_READAHEAD - .readpages = scoutfs_readpages, -#else .readahead = scoutfs_readahead, -#endif .writepage = scoutfs_writepage, .writepages = scoutfs_writepages, .write_begin = scoutfs_write_begin, From 32845f85c3a021d83bcefe23e4c9b620d6ff2221 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 15:28:41 -0800 Subject: [PATCH 23/35] Remove .aio_read and .aio_write methods. This removes two large duplicate code blocks. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 11 --- kmod/src/data.c | 7 -- kmod/src/file.c | 128 --------------------------------- kmod/src/file.h | 7 -- 4 files changed, 153 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index a203f3fd..f6ab5099 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,17 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.0-rc7-1743-g8436318205b9 -# -# .aio_read and .aio_write no longer exist. All reads and writes now use the -# .read_iter and .write_iter methods, or must implement .read and .write (which -# we don't). -# -ifneq (,$(shell grep 'ssize_t.*aio_read' include/linux/fs.h)) -ccflags-y += -DKC_LINUX_HAVE_FOP_AIO_READ=1 -endif - # # rhel7 has a custom inode_operations_wrapper struct that is discarded # entirely in favor of upstream structure since rhel8. diff --git a/kmod/src/data.c b/kmod/src/data.c index 6afa224b..c0cc6591 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -2261,17 +2261,10 @@ const struct address_space_operations scoutfs_file_aops = { }; const struct file_operations scoutfs_file_fops = { -#ifdef KC_LINUX_HAVE_FOP_AIO_READ - .read = do_sync_read, - .write = do_sync_write, - .aio_read = scoutfs_file_aio_read, - .aio_write = scoutfs_file_aio_write, -#else .read_iter = scoutfs_file_read_iter, .write_iter = scoutfs_file_write_iter, .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, -#endif .mmap = scoutfs_file_mmap, .unlocked_ioctl = scoutfs_ioctl, .fsync = scoutfs_file_fsync, diff --git a/kmod/src/file.c b/kmod/src/file.c index 15158a2b..0f2e7b83 100644 --- a/kmod/src/file.c +++ b/kmod/src/file.c @@ -30,133 +30,6 @@ #include "omap.h" #include "quota.h" -#ifdef KC_LINUX_HAVE_FOP_AIO_READ -/* - * Start a high level file read. We check for offline extents in the - * read region here so that we only check the extents once. We use the - * dio count to prevent releasing while we're reading after we've - * checked the extents. - */ -ssize_t scoutfs_file_aio_read(struct kiocb *iocb, const struct iovec *iov, - unsigned long nr_segs, loff_t pos) -{ - struct file *file = iocb->ki_filp; - struct inode *inode = file_inode(file); - struct scoutfs_inode_info *si = SCOUTFS_I(inode); - struct super_block *sb = inode->i_sb; - struct scoutfs_lock *scoutfs_inode_lock = NULL; - SCOUTFS_DECLARE_PER_TASK_ENTRY(pt_ent); - DECLARE_DATA_WAIT(dw); - int ret; - -retry: - /* protect checked extents from release */ - inode_lock(inode); - atomic_inc(&inode->i_dio_count); - inode_unlock(inode); - - ret = scoutfs_lock_inode(sb, SCOUTFS_LOCK_READ, - SCOUTFS_LKF_REFRESH_INODE, inode, &scoutfs_inode_lock); - if (ret) - goto out; - - if (scoutfs_per_task_add_excl(&si->pt_data_lock, &pt_ent, scoutfs_inode_lock)) { - ret = scoutfs_data_wait_check_iov(inode, iov, nr_segs, pos, - SEF_OFFLINE, - SCOUTFS_IOC_DWO_READ, - &dw, scoutfs_inode_lock); - if (ret != 0) - goto out; - } else { - WARN_ON_ONCE(true); - } - - ret = generic_file_aio_read(iocb, iov, nr_segs, pos); - -out: - inode_dio_done(inode); - scoutfs_per_task_del(&si->pt_data_lock, &pt_ent); - scoutfs_unlock(sb, scoutfs_inode_lock, SCOUTFS_LOCK_READ); - - if (scoutfs_data_wait_found(&dw)) { - ret = scoutfs_data_wait(inode, &dw); - if (ret == 0) - goto retry; - } - - return ret; -} - -ssize_t scoutfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, - unsigned long nr_segs, loff_t pos) -{ - struct file *file = iocb->ki_filp; - struct inode *inode = file_inode(file); - struct scoutfs_inode_info *si = SCOUTFS_I(inode); - struct super_block *sb = inode->i_sb; - struct scoutfs_lock *scoutfs_inode_lock = NULL; - SCOUTFS_DECLARE_PER_TASK_ENTRY(pt_ent); - DECLARE_DATA_WAIT(dw); - int ret; - - if (iocb->ki_left == 0) /* Does this even happen? */ - return 0; - -retry: - inode_lock(inode); - ret = scoutfs_lock_inode(sb, SCOUTFS_LOCK_WRITE, - SCOUTFS_LKF_REFRESH_INODE, inode, &scoutfs_inode_lock); - if (ret) - goto out; - - ret = scoutfs_inode_check_retention(inode); - if (ret < 0) - goto out; - - ret = scoutfs_complete_truncate(inode, scoutfs_inode_lock); - if (ret) - goto out; - - if (scoutfs_per_task_add_excl(&si->pt_data_lock, &pt_ent, scoutfs_inode_lock)) { - /* data_version is per inode, whole file must be online */ - ret = scoutfs_data_wait_check(inode, 0, i_size_read(inode), - SEF_OFFLINE, - SCOUTFS_IOC_DWO_WRITE, - &dw, scoutfs_inode_lock); - if (ret != 0) - goto out; - } - - ret = scoutfs_quota_check_data(sb, inode); - if (ret) - goto out; - - /* XXX: remove SUID bit */ - - ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); - -out: - scoutfs_per_task_del(&si->pt_data_lock, &pt_ent); - scoutfs_unlock(sb, scoutfs_inode_lock, SCOUTFS_LOCK_WRITE); - inode_unlock(inode); - - if (scoutfs_data_wait_found(&dw)) { - ret = scoutfs_data_wait(inode, &dw); - if (ret == 0) - goto retry; - } - - if (ret > 0 || ret == -EIOCBQUEUED) { - ssize_t err; - - err = generic_write_sync(file, pos, ret); - if (err < 0 && ret > 0) - ret = err; - } - - return ret; -} -#else ssize_t scoutfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct file *file = iocb->ki_filp; @@ -265,7 +138,6 @@ out: return ret; } -#endif int scoutfs_permission(KC_VFS_NS_DEF struct inode *inode, int mask) diff --git a/kmod/src/file.h b/kmod/src/file.h index 1009b11f..3b6651cc 100644 --- a/kmod/src/file.h +++ b/kmod/src/file.h @@ -1,15 +1,8 @@ #ifndef _SCOUTFS_FILE_H_ #define _SCOUTFS_FILE_H_ -#ifdef KC_LINUX_HAVE_FOP_AIO_READ -ssize_t scoutfs_file_aio_read(struct kiocb *iocb, const struct iovec *iov, - unsigned long nr_segs, loff_t pos); -ssize_t scoutfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, - unsigned long nr_segs, loff_t pos); -#else ssize_t scoutfs_file_read_iter(struct kiocb *, struct iov_iter *); ssize_t scoutfs_file_write_iter(struct kiocb *, struct iov_iter *); -#endif int scoutfs_permission(KC_VFS_NS_DEF struct inode *inode, int mask); loff_t scoutfs_file_llseek(struct file *file, loff_t offset, int whence); From 505d7f8198078cebc27fc6f5e8f991aa05b7cbbc Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 15:34:20 -0800 Subject: [PATCH 24/35] Remove el7 RHEL_IOPS_WRAPPER and KC_LINUX_AIO_KI_LEFT These were kind of globbed together. This removes a large amount of duplicate method definitions. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 12 ------- kmod/src/dir.c | 61 ---------------------------------- kmod/src/dir.h | 4 --- kmod/src/inode.c | 22 ------------ kmod/src/inode.h | 5 --- kmod/src/ioctl.c | 4 --- 6 files changed, 108 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index f6ab5099..ed215c1d 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,18 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# rhel7 has a custom inode_operations_wrapper struct that is discarded -# entirely in favor of upstream structure since rhel8. -# -ifneq (,$(shell grep 'void.*follow_link.*struct dentry' include/linux/fs.h)) -ccflags-y += -DKC_LINUX_HAVE_RHEL_IOPS_WRAPPER=1 -endif - -ifneq (,$(shell grep 'size_t.*ki_left;' include/linux/aio.h)) -ccflags-y += -DKC_LINUX_AIO_KI_LEFT=1 -endif - # # v4.4-rc4-4-g98e9cb5711c6 # diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 993bb3a7..6ac65f65 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -1187,24 +1187,6 @@ out: return path; } -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER -static void *scoutfs_follow_link(struct dentry *dentry, struct nameidata *nd) -{ - char *path; - - path = scoutfs_get_link_target(dentry); - if (!IS_ERR_OR_NULL(path)) - nd_set_link(nd, path); - return path; -} - -static void scoutfs_put_link(struct dentry *dentry, struct nameidata *nd, - void *cookie) -{ - if (!IS_ERR_OR_NULL(cookie)) - kfree(cookie); -} -#else static const char *scoutfs_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done) { char *path; @@ -1215,7 +1197,6 @@ static const char *scoutfs_get_link(struct dentry *dentry, struct inode *inode, return path; } -#endif /* * Symlink target paths can be annoyingly large. We store relatively @@ -1882,15 +1863,6 @@ out_unlock: return ret; } -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER -static int scoutfs_rename(struct inode *old_dir, - struct dentry *old_dentry, struct inode *new_dir, - struct dentry *new_dentry) -{ - return scoutfs_rename_common(KC_VFS_INIT_NS - old_dir, old_dentry, new_dir, new_dentry, 0); -} -#endif static int scoutfs_rename2(KC_VFS_NS_DEF struct inode *old_dir, @@ -1973,29 +1945,15 @@ out: } const struct inode_operations scoutfs_symlink_iops = { -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - .readlink = generic_readlink, - .follow_link = scoutfs_follow_link, - .put_link = scoutfs_put_link, -#else .get_link = scoutfs_get_link, -#endif .getattr = scoutfs_getattr, .setattr = scoutfs_setattr, -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, -#endif .listxattr = scoutfs_listxattr, -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - .removexattr = generic_removexattr, -#endif #ifdef KC_GET_INODE_ACL .get_inode_acl = scoutfs_get_acl, #else .get_acl = scoutfs_get_acl, #endif -#ifndef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER .tmpfile = scoutfs_tmpfile, .rename = scoutfs_rename_common, .symlink = scoutfs_symlink, @@ -2004,7 +1962,6 @@ const struct inode_operations scoutfs_symlink_iops = { .mkdir = scoutfs_mkdir, .create = scoutfs_create, .lookup = scoutfs_lookup, -#endif }; const struct file_operations scoutfs_dir_fops = { @@ -2015,12 +1972,7 @@ const struct file_operations scoutfs_dir_fops = { }; -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER -const struct inode_operations_wrapper scoutfs_dir_iops = { - .ops = { -#else const struct inode_operations scoutfs_dir_iops = { -#endif .lookup = scoutfs_lookup, .mknod = scoutfs_mknod, .create = scoutfs_create, @@ -2030,12 +1982,6 @@ const struct inode_operations scoutfs_dir_iops = { .rmdir = scoutfs_unlink, .getattr = scoutfs_getattr, .setattr = scoutfs_setattr, -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - .rename = scoutfs_rename, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, -#endif .listxattr = scoutfs_listxattr, #ifdef KC_GET_INODE_ACL .get_inode_acl = scoutfs_get_acl, @@ -2047,13 +1993,6 @@ const struct inode_operations scoutfs_dir_iops = { #endif .symlink = scoutfs_symlink, .permission = scoutfs_permission, -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - }, -#endif .tmpfile = scoutfs_tmpfile, -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - .rename2 = scoutfs_rename2, -#else .rename = scoutfs_rename2, -#endif }; diff --git a/kmod/src/dir.h b/kmod/src/dir.h index 9985b7c3..1c65caf5 100644 --- a/kmod/src/dir.h +++ b/kmod/src/dir.h @@ -5,11 +5,7 @@ #include "lock.h" extern const struct file_operations scoutfs_dir_fops; -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER -extern const struct inode_operations_wrapper scoutfs_dir_iops; -#else extern const struct inode_operations scoutfs_dir_iops; -#endif extern const struct inode_operations scoutfs_symlink_iops; extern const struct dentry_operations scoutfs_dentry_ops; diff --git a/kmod/src/inode.c b/kmod/src/inode.c index 3c87353d..3c75fc98 100644 --- a/kmod/src/inode.c +++ b/kmod/src/inode.c @@ -144,11 +144,6 @@ void scoutfs_destroy_inode(struct inode *inode) static const struct inode_operations scoutfs_file_iops = { .getattr = scoutfs_getattr, .setattr = scoutfs_setattr, -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, -#endif .listxattr = scoutfs_listxattr, #ifdef KC_GET_INODE_ACL .get_inode_acl = scoutfs_get_acl, @@ -164,11 +159,6 @@ static const struct inode_operations scoutfs_file_iops = { static const struct inode_operations scoutfs_special_iops = { .getattr = scoutfs_getattr, .setattr = scoutfs_setattr, -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, -#endif .listxattr = scoutfs_listxattr, #ifdef KC_GET_INODE_ACL .get_inode_acl = scoutfs_get_acl, @@ -193,12 +183,7 @@ static void set_inode_ops(struct inode *inode) inode->i_fop = &scoutfs_file_fops; break; case S_IFDIR: -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER - inode->i_op = &scoutfs_dir_iops.ops; - inode->i_flags |= S_IOPS_WRAPPER; -#else inode->i_op = &scoutfs_dir_iops; -#endif inode->i_fop = &scoutfs_dir_fops; break; case S_IFLNK: @@ -382,18 +367,11 @@ int scoutfs_inode_refresh(struct inode *inode, struct scoutfs_lock *lock) return ret; } -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER -int scoutfs_getattr(struct vfsmount *mnt, struct dentry *dentry, - struct kstat *stat) -{ - struct inode *inode = dentry->d_inode; -#else int scoutfs_getattr(KC_VFS_NS_DEF const struct path *path, struct kstat *stat, u32 request_mask, unsigned int query_flags) { struct inode *inode = d_inode(path->dentry); -#endif struct super_block *sb = inode->i_sb; struct scoutfs_lock *lock = NULL; int ret; diff --git a/kmod/src/inode.h b/kmod/src/inode.h index b5d57802..2c390908 100644 --- a/kmod/src/inode.h +++ b/kmod/src/inode.h @@ -131,14 +131,9 @@ int scoutfs_complete_truncate(struct inode *inode, struct scoutfs_lock *lock); int scoutfs_inode_check_retention(struct inode *inode); int scoutfs_inode_refresh(struct inode *inode, struct scoutfs_lock *lock); -#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER -int scoutfs_getattr(struct vfsmount *mnt, struct dentry *dentry, - struct kstat *stat); -#else int scoutfs_getattr(KC_VFS_NS_DEF const struct path *path, struct kstat *stat, u32 request_mask, unsigned int query_flags); -#endif int scoutfs_setattr(KC_VFS_NS_DEF struct dentry *dentry, struct iattr *attr); diff --git a/kmod/src/ioctl.c b/kmod/src/ioctl.c index 5a9622f2..903033be 100644 --- a/kmod/src/ioctl.c +++ b/kmod/src/ioctl.c @@ -515,10 +515,6 @@ static long scoutfs_ioc_stage(struct file *file, unsigned long arg) /* the iocb is really only used for the file pointer :P */ init_sync_kiocb(&kiocb, file); kiocb.ki_pos = args.offset; -#ifdef KC_LINUX_AIO_KI_LEFT - kiocb.ki_left = args.length; - kiocb.ki_nbytes = args.length; -#endif iov.iov_base = (void __user *)(unsigned long)args.buf_ptr; iov.iov_len = args.length; From e7c8881ca4cff234a1f90e930e12140692756bc2 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 20 Nov 2025 11:07:03 -0800 Subject: [PATCH 25/35] Remove KC_XATTR_HANDLER_NAME compat for el7 Every kernel now supports .name instead of .prefix. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/xattr.c | 8 -------- 2 files changed, 18 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index ed215c1d..da99df8e 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,16 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.4-rc4-4-g98e9cb5711c6 -# -# Introduces a new xattr_handler .name member that can be used to match the -# entire field, instead of just a prefix. For these kernels, we must use -# the new .name field instead. -ifneq (,$(shell grep 'static inline const char .xattr_prefix' include/linux/xattr.h)) -ccflags-y += -DKC_XATTR_HANDLER_NAME=1 -endif - # # v5.19-rc4-96-g342a72a33407 # diff --git a/kmod/src/xattr.c b/kmod/src/xattr.c index f6197c82..4ac83cad 100644 --- a/kmod/src/xattr.c +++ b/kmod/src/xattr.c @@ -1045,22 +1045,14 @@ static const struct xattr_handler scoutfs_xattr_security_handler = { }; static const struct xattr_handler scoutfs_xattr_acl_access_handler = { -#ifdef KC_XATTR_HANDLER_NAME .name = XATTR_NAME_POSIX_ACL_ACCESS, -#else - .prefix = XATTR_NAME_POSIX_ACL_ACCESS, -#endif .flags = ACL_TYPE_ACCESS, .get = scoutfs_acl_get_xattr, .set = scoutfs_acl_set_xattr, }; static const struct xattr_handler scoutfs_xattr_acl_default_handler = { -#ifdef KC_XATTR_HANDLER_NAME .name = XATTR_NAME_POSIX_ACL_DEFAULT, -#else - .prefix = XATTR_NAME_POSIX_ACL_DEFAULT, -#endif .flags = ACL_TYPE_DEFAULT, .get = scoutfs_acl_get_xattr, .set = scoutfs_acl_set_xattr, From 2ce496167ce353a2518384f353b71559db0b3afd Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 20 Nov 2025 11:09:11 -0800 Subject: [PATCH 26/35] Remove __kernel_old_timeval compat for el7. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 8 -------- kmod/src/kernelcompat.h | 5 ----- 2 files changed, 13 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index da99df8e..6be7d359 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -109,14 +109,6 @@ ifneq (,$(shell grep 'int tcp_sock_set_keepintvl' include/linux/tcp.h)) ccflags-y += -DKC_HAVE_TCP_SET_SOCKFN endif -# -# v4.16-rc3-13-ga84d1169164b -# -# Fixes y2038 issues with struct timeval. -ifneq (,$(shell grep -s '^struct __kernel_old_timeval .' include/uapi/linux/time_types.h)) -ccflags-y += -DKC_KERNEL_OLD_TIMEVAL_STRUCT -endif - # # v5.19-rc4-52-ge33c267ab70d # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 9b9d710f..2c4ca6fb 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -88,11 +88,6 @@ static inline struct bio *kc_bio_alloc(struct block_device *bdev, unsigned short #define fiemap_prep(inode, fieinfo, start, len, flags) fiemap_check_flags(fieinfo, flags) #endif -#ifndef KC_KERNEL_OLD_TIMEVAL_STRUCT -#define __kernel_old_timeval timeval -#define ns_to_kernel_old_timeval(ktime) ns_to_timeval(ktime.tv64) -#endif - #ifdef KC_SOCK_SET_SNDTIMEO #include static inline int kc_sock_set_sndtimeo(struct socket *sock, s64 secs) From 99eb9c2c45ce44f95704179d557b19fcf78cc7f8 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 20 Nov 2025 11:11:23 -0800 Subject: [PATCH 27/35] Remove kc_inode_dio_end compat for el7. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 7 ------- kmod/src/data.c | 2 +- kmod/src/kernelcompat.h | 6 ------ 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 6be7d359..89de420c 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -178,13 +178,6 @@ ifneq (,$(shell grep 'struct file.*bdev_file_open_by_path.const char.*path' incl ccflags-y += -DKC_BDEV_FILE_OPEN_BY_PATH endif -# v4.0-rc7-1796-gfe0f07d08ee3 -# -# direct-io changes modify inode_dio_done to now be called inode_dio_end -ifneq (,$(shell grep 'void inode_dio_end.struct inode' include/linux/fs.h)) -ccflags-y += -DKC_INODE_DIO_END -endif - # # v5.0-6476-g3d3539018d2c # diff --git a/kmod/src/data.c b/kmod/src/data.c index c0cc6591..1d233222 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -2215,7 +2215,7 @@ retry: out: if (scoutfs_per_task_del(&si->pt_data_lock, &pt_ent)) - kc_inode_dio_end(inode); + inode_dio_end(inode); scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ); if (scoutfs_data_wait_found(&dw)) { err = scoutfs_data_wait(inode, &dw); diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 2c4ca6fb..c81e79b0 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -184,12 +184,6 @@ static inline int kc_tcp_sock_set_nodelay(struct socket *sock) } #endif -#ifdef KC_INODE_DIO_END -#define kc_inode_dio_end inode_dio_end -#else -#define kc_inode_dio_end inode_dio_done -#endif - #ifndef KC_MM_VM_FAULT_T typedef unsigned int vm_fault_t; static inline vm_fault_t vmf_error(int err) From 0b669980d0c850b49fa206f1b624df064b82ca30 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 20 Nov 2025 11:12:46 -0800 Subject: [PATCH 28/35] Remove .remap_pages method for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 7 ------- kmod/src/data.c | 3 --- 2 files changed, 10 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 89de420c..bc4e405d 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -187,13 +187,6 @@ ifneq (,$(shell grep 'typedef.*__bitwise unsigned.*int vm_fault_t' include/linux ccflags-y += -DKC_MM_VM_FAULT_T endif -# v3.19-499-gd83a08db5ba6 -# -# .remap pages becomes obsolete -ifneq (,$(shell grep 'int ..remap_pages..struct vm_area_struct' include/linux/mm.h)) -ccflags-y += -DKC_MM_REMAP_PAGES -endif - # # v3.19-4742-g503c358cf192 # diff --git a/kmod/src/data.c b/kmod/src/data.c index 1d233222..a137b667 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -2233,9 +2233,6 @@ out: static const struct vm_operations_struct scoutfs_data_file_vm_ops = { .fault = scoutfs_data_filemap_fault, .page_mkwrite = scoutfs_data_page_mkwrite, -#ifdef KC_MM_REMAP_PAGES - .remap_pages = generic_file_remap_pages, -#endif }; static int scoutfs_file_mmap(struct file *file, struct vm_area_struct *vma) From 9f6d46ab6635fb52b9b962eab6f9c560ecaec097 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 20 Nov 2025 11:16:24 -0800 Subject: [PATCH 29/35] Remove list_lru_shrink_count() and list_lru_shrink_walk() compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/kernelcompat.h | 15 --------------- 2 files changed, 24 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index bc4e405d..2ba4c986 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -187,15 +187,6 @@ ifneq (,$(shell grep 'typedef.*__bitwise unsigned.*int vm_fault_t' include/linux ccflags-y += -DKC_MM_VM_FAULT_T endif -# -# v3.19-4742-g503c358cf192 -# -# list_lru_shrink_count() and list_lru_shrink_walk() introduced -# -ifneq (,$(shell grep 'list_lru_shrink_count.*struct list_lru' include/linux/list_lru.h)) -ccflags-y += -DKC_LIST_LRU_SHRINK_COUNT_WALK -endif - # # v3.19-4757-g3f97b163207c # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index c81e79b0..55eb3d4c 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -196,21 +196,6 @@ static inline vm_fault_t vmf_error(int err) #include -#ifndef KC_LIST_LRU_SHRINK_COUNT_WALK -/* we don't bother with sc->{nid,memcg} (which doesn't exist in oldest kernels) */ -static inline unsigned long list_lru_shrink_count(struct list_lru *lru, - struct shrink_control *sc) -{ - return list_lru_count(lru); -} -static inline unsigned long -list_lru_shrink_walk(struct list_lru *lru, struct shrink_control *sc, - list_lru_walk_cb isolate, void *cb_arg) -{ - return list_lru_walk(lru, isolate, cb_arg, sc->nr_to_scan); -} -#endif - #ifndef KC_LIST_LRU_ADD_OBJ #define list_lru_add_obj list_lru_add #define list_lru_del_obj list_lru_del From 77156d695f0698914a3683e457c21b89a5225370 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 20 Nov 2025 11:20:16 -0800 Subject: [PATCH 30/35] Remove list_lru_walk_* el7 compat. The original patch added compat for both el7 and higher kernels, so this just drops the el7 parts. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/kernelcompat.c | 32 -------------------------------- kmod/src/kernelcompat.h | 11 +---------- 3 files changed, 1 insertion(+), 51 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 2ba4c986..0c6fd598 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -187,15 +187,6 @@ ifneq (,$(shell grep 'typedef.*__bitwise unsigned.*int vm_fault_t' include/linux ccflags-y += -DKC_MM_VM_FAULT_T endif -# -# v3.19-4757-g3f97b163207c -# -# lru_list_walk_cb lru arg added -# -ifneq (,$(shell grep 'struct list_head \*item, spinlock_t \*lock, void \*cb_arg' include/linux/list_lru.h)) -ccflags-y += -DKC_LIST_LRU_WALK_CB_ITEM_LOCK -endif - # # v6.7-rc4-153-g0a97c01cd20b # diff --git a/kmod/src/kernelcompat.c b/kmod/src/kernelcompat.c index 561dcad1..6457728f 100644 --- a/kmod/src/kernelcompat.c +++ b/kmod/src/kernelcompat.c @@ -5,38 +5,6 @@ #include -#ifdef KC_LIST_LRU_WALK_CB_ITEM_LOCK -static enum lru_status kc_isolate(struct list_head *item, spinlock_t *lock, void *cb_arg) -{ - struct kc_isolate_args *args = cb_arg; - - /* isolate doesn't use list, nr_items updated in caller */ - return args->isolate(item, NULL, args->cb_arg); -} - -unsigned long kc_list_lru_walk(struct list_lru *lru, kc_list_lru_walk_cb_t isolate, void *cb_arg, - unsigned long nr_to_walk) -{ - struct kc_isolate_args args = { - .isolate = isolate, - .cb_arg = cb_arg, - }; - - return list_lru_walk(lru, kc_isolate, &args, nr_to_walk); -} - -unsigned long kc_list_lru_shrink_walk(struct list_lru *lru, struct shrink_control *sc, - kc_list_lru_walk_cb_t isolate, void *cb_arg) -{ - struct kc_isolate_args args = { - .isolate = isolate, - .cb_arg = cb_arg, - }; - - return list_lru_shrink_walk(lru, sc, kc_isolate, &args); -} -#endif - #ifdef KC_LIST_LRU_WALK_CB_LIST_LOCK static enum lru_status kc_isolate(struct list_head *item, struct list_lru_one *list, spinlock_t *lock, void *cb_arg) diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 55eb3d4c..685f380f 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -201,7 +201,7 @@ static inline vm_fault_t vmf_error(int err) #define list_lru_del_obj list_lru_del #endif -#if defined(KC_LIST_LRU_WALK_CB_LIST_LOCK) || defined(KC_LIST_LRU_WALK_CB_ITEM_LOCK) +#if defined(KC_LIST_LRU_WALK_CB_LIST_LOCK) struct list_lru_one; typedef enum lru_status (*kc_list_lru_walk_cb_t)(struct list_head *item, struct list_lru_one *list, void *cb_arg); @@ -217,15 +217,6 @@ unsigned long kc_list_lru_shrink_walk(struct list_lru *lru, struct shrink_contro #define kc_list_lru_shrink_walk list_lru_shrink_walk #endif -#if defined(KC_LIST_LRU_WALK_CB_ITEM_LOCK) -/* isolate moved by hand, nr_items updated in walk as _REMOVE returned */ -static inline void list_lru_isolate_move(struct list_lru_one *list, struct list_head *item, - struct list_head *head) -{ - list_move(item, head); -} -#endif - #ifndef KC_STACK_TRACE_SAVE #include static inline unsigned int stack_trace_save(unsigned long *store, unsigned int size, From 77b8d3cb7e6b7b17cbff34084fadb026e704b43b Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 2 May 2026 17:10:16 -0400 Subject: [PATCH 31/35] Remove format-version 1 test. Only el7 was capable of testing this formatversion. And there no longer is el7 support. Remove the test. Signed-off-by: Auke Kok --- tests/golden/format-version-forward-back | 4 - tests/sequence | 1 - tests/tests/format-version-forward-back.sh | 184 --------------------- 3 files changed, 189 deletions(-) delete mode 100644 tests/golden/format-version-forward-back delete mode 100644 tests/tests/format-version-forward-back.sh diff --git a/tests/golden/format-version-forward-back b/tests/golden/format-version-forward-back deleted file mode 100644 index cc75bfcf..00000000 --- a/tests/golden/format-version-forward-back +++ /dev/null @@ -1,4 +0,0 @@ -== ensuring utils and module for old versions -== unmounting test fs and removing test module -== testing combinations of old and new format versions -== restoring test module and mount diff --git a/tests/sequence b/tests/sequence index 32a5cf4f..7e73df03 100644 --- a/tests/sequence +++ b/tests/sequence @@ -19,7 +19,6 @@ offline-extent-waiting.sh move-blocks.sh projects.sh large-fragmented-free.sh -format-version-forward-back.sh enospc.sh mmap.sh srch-safe-merge-pos.sh diff --git a/tests/tests/format-version-forward-back.sh b/tests/tests/format-version-forward-back.sh deleted file mode 100644 index d907ef49..00000000 --- a/tests/tests/format-version-forward-back.sh +++ /dev/null @@ -1,184 +0,0 @@ -# -# Test our basic ability to work with different format versions. -# -# The current code being tested has a range of supported format -# versions. For each of the older supported format versions we have a -# git hash of the commit before the next greater version was introduced. -# We build versions of the scoutfs utility and kernel module for the -# last commit in tree that had a lesser supported version as its max -# supported version. We use those binaries to test forward and back -# compat as new and old code works with a persistent volume with a given -# format version. -# - -# not supported on el8 or higher -if [ $(source /etc/os-release ; echo ${VERSION_ID:0:1}) -gt 7 ]; then - t_skip_permitted "Unsupported OS version" -fi - -mount_has_format_version() -{ - local mnt="$1" - local vers="$2" - local sysfs_fmt_vers="$(t_sysfs_path_from_mnt $SCR)/format_version" - - test "$(cat $sysfs_fmt_vers)" == "$vers" -} - -SCR="/mnt/scoutfs.scratch" - -MIN=$(modinfo $T_MODULE | awk '($1 == "scoutfs_format_version_min:"){print $2}') -MAX=$(modinfo $T_MODULE | awk '($1 == "scoutfs_format_version_max:"){print $2}') - -echo "min: $MIN max: $MAX" > "$T_TMP.log" - -test "$MIN" -gt 0 -a "$MAX" -gt 0 -a "$MIN" -le "$MAX" || \ - t_fail "parsed bad versions, min: $MIN max: $MAX" - -test "$MIN" == "$MAX" && \ - t_skip "only one supported format version: $MIN" - -# prepare dir and wipe any weird old partial state -builds="$T_RESULTS/format_version_builds" -mkdir -p "$builds" - -echo "== ensuring utils and module for old versions" -declare -A commits -commits[1]=c3c4b080 -for vers in $(seq $MIN $((MAX - 1))); do - dir="$builds/$vers" - platform=$(uname -rp) - buildmark="$dir/buildmark" - commit="${commits[$vers]}" - - test -n "$commit" || \ - t_fail "no commit for vers $vers" - - # have our files for this version - test "$(cat $buildmark 2>&1)" == "$platform" && \ - continue - - # build as one big sequence of commands that can return failure - ( - set -o pipefail - - rm -rf $dir && - mkdir -p $dir/building && - cd "$T_TESTS/.." && - git archive --format=tar "$commit" | tar -C "$dir/building" -xf - && - cd - && - find $dir && - make -C "$dir/building" && - mv $dir/building/utils/src/scoutfs $dir && - mv $dir/building/kmod/src/scoutfs.ko $dir && - rm -rf $dir/building && - echo "$platform" > $buildmark && - find $dir && - cat $buildmark - ) >> "$T_TMP.log" 2>&1 || t_fail "version $vers build failed" -done - -echo "== unmounting test fs and removing test module" -t_quiet t_umount_all -t_quiet rmmod scoutfs - -echo "== testing combinations of old and new format versions" -mkdir -p "$SCR" -for vers in $(seq $MIN $((MAX - 1))); do - old_scoutfs="$builds/$vers/scoutfs" - old_module="$builds/$vers/scoutfs.ko" - - echo "mkfs $vers" >> "$T_TMP.log" - t_quiet $old_scoutfs mkfs -f -Q 0,127.0.0.1,$T_SCRATCH_PORT "$T_EX_META_DEV" "$T_EX_DATA_DEV" \ - || t_fail "mkfs $vers failed" - - echo "mount $vers with $vers" >> "$T_TMP.log" - t_quiet insmod $old_module - t_quiet mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ - "$T_EX_DATA_DEV" "$SCR" - t_quiet mount_has_format_version "$SCR" "$vers" - - echo "creating files in $vers" >> "$T_TMP.log" - t_quiet touch "$SCR/file-"{1,2,3} - stat "$SCR"/file-* > "$T_TMP.stat" || \ - t_fail "stat in $vers failed" - - echo "remounting $vers fs with $MAX" >> "$T_TMP.log" - t_quiet umount "$SCR" - rmmod scoutfs - insmod "$T_MODULE" - t_quiet mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ - "$T_EX_DATA_DEV" "$SCR" - t_quiet mount_has_format_version "$SCR" "$vers" - - echo "verifying stat in $vers with $MAX" >> "$T_TMP.log" - diff -u "$T_TMP.stat" <(stat "$SCR"/file-*) - - echo "keep/update/del existing, create new in $vers" >> "$T_TMP.log" - t_quiet touch "$SCR/file-2" - t_quiet rm -f "$SCR/file-3" - t_quiet touch "$SCR/file-4" - stat "$SCR"/file-* > "$T_TMP.stat" || \ - t_fail "stat in $vers failed" - - echo "remounting $vers fs with $vers" >> "$T_TMP.log" - t_quiet umount "$SCR" - rmmod scoutfs - insmod "$old_module" - t_quiet mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ - "$T_EX_DATA_DEV" "$SCR" - t_quiet mount_has_format_version "$SCR" "$vers" - - echo "verifying stat in $vers with $vers" >> "$T_TMP.log" - diff -u "$T_TMP.stat" <(stat "$SCR"/file-*) - - echo "changing format vers to $MAX" >> "$T_TMP.log" - t_quiet umount "$SCR" - rmmod scoutfs - t_quiet scoutfs change-format-version -F -V $MAX $T_EX_META_DEV "$T_EX_DATA_DEV" - - echo "mount fs $MAX with old $vers should fail" >> "$T_TMP.log" - insmod "$old_module" - mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ - "$T_EX_DATA_DEV" "$SCR" >> "$T_TMP.log" 2>&1 - if [ "$?" == "0" ]; then - umount "$SCR" - t_fail "old code ver $vers able to mount new ver $MAX" - fi - - echo "remounting $MAX fs with $MAX" >> "$T_TMP.log" - rmmod scoutfs - insmod "$T_MODULE" - t_quiet mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ - "$T_EX_DATA_DEV" "$SCR" - t_quiet mount_has_format_version "$SCR" "$MAX" - - echo "verifying stat in $MAX with $MAX" >> "$T_TMP.log" - diff -u "$T_TMP.stat" <(stat "$SCR"/file-*) - - echo "keep/update/del existing, create new in $MAX" >> "$T_TMP.log" - t_quiet touch "$SCR/file-2" - t_quiet rm -f "$SCR/file-4" - t_quiet touch "$SCR/file-5" - stat "$SCR"/file-* > "$T_TMP.stat" || \ - t_fail "stat in $MAX failed" - - echo "remounting $MAX fs with $MAX again" >> "$T_TMP.log" - t_quiet umount "$SCR" - t_quiet mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ - "$T_EX_DATA_DEV" "$SCR" - t_quiet mount_has_format_version "$SCR" "$MAX" - - echo "verifying stat in $MAX with $MAX again" >> "$T_TMP.log" - diff -u "$T_TMP.stat" <(stat "$SCR"/file-*) - - echo "done with old vers $vers" >> "$T_TMP.log" - t_quiet umount "$SCR" - rmmod scoutfs -done - -echo "== restoring test module and mount" -insmod "$T_MODULE" -t_mount_all - -t_pass From 56526e617fa918179485fca76cb5ecba82837bdf Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 2 May 2026 17:17:38 -0400 Subject: [PATCH 32/35] Remove KC_MM_VM_FAULT_T compat for el7. el8 already provides vm_fault_t and vmf_error(), so the fallback typedef and inline are dead. Drop the detection stanza and the two function-signature ifdefs in data.c that switched between the pre-v4.11 and modern fault handler prototypes. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/data.c | 15 --------------- kmod/src/kernelcompat.h | 10 ---------- 3 files changed, 34 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 0c6fd598..45c42e9b 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -178,15 +178,6 @@ ifneq (,$(shell grep 'struct file.*bdev_file_open_by_path.const char.*path' incl ccflags-y += -DKC_BDEV_FILE_OPEN_BY_PATH endif -# -# v5.0-6476-g3d3539018d2c -# -# page fault handlers return a bitmask vm_fault_t instead -# Note: el8's header has a slightly modified prefix here -ifneq (,$(shell grep 'typedef.*__bitwise unsigned.*int vm_fault_t' include/linux/mm_types.h)) -ccflags-y += -DKC_MM_VM_FAULT_T -endif - # # v6.7-rc4-153-g0a97c01cd20b # diff --git a/kmod/src/data.c b/kmod/src/data.c index a137b667..1d3168f6 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -2015,15 +2015,9 @@ int scoutfs_data_waiting(struct super_block *sb, u64 ino, u64 iblock, return ret; } -#ifdef KC_MM_VM_FAULT_T static vm_fault_t scoutfs_data_page_mkwrite(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; -#else -static int scoutfs_data_page_mkwrite(struct vm_area_struct *vma, - struct vm_fault *vmf) -{ -#endif struct page *page = vmf->page; struct file *file = vma->vm_file; struct inode *inode = file_inode(file); @@ -2165,14 +2159,9 @@ out: return ret; } -#ifdef KC_MM_VM_FAULT_T static vm_fault_t scoutfs_data_filemap_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; -#else -static int scoutfs_data_filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) -{ -#endif struct file *file = vma->vm_file; struct inode *inode = file_inode(file); struct scoutfs_inode_info *si = SCOUTFS_I(inode); @@ -2207,11 +2196,7 @@ retry: } } -#ifdef KC_MM_VM_FAULT_T ret = filemap_fault(vmf); -#else - ret = filemap_fault(vma, vmf); -#endif out: if (scoutfs_per_task_del(&si->pt_data_lock, &pt_ent)) diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 685f380f..ea37a7fb 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -184,16 +184,6 @@ static inline int kc_tcp_sock_set_nodelay(struct socket *sock) } #endif -#ifndef KC_MM_VM_FAULT_T -typedef unsigned int vm_fault_t; -static inline vm_fault_t vmf_error(int err) -{ - if (err == -ENOMEM) - return VM_FAULT_OOM; - return VM_FAULT_SIGBUS; -} -#endif - #include #ifndef KC_LIST_LRU_ADD_OBJ From f4a28f1f04c3042f19dfff9619527b89164779db Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 2 May 2026 17:19:23 -0400 Subject: [PATCH 33/35] Remove KC_STACK_TRACE_SAVE compat for el7. el8 already provides stack_trace_save() and stack_trace_print() in linux/stacktrace.h, so the legacy save_stack_trace/print_stack_trace fallback inlines are dead. Drop the detection stanza and the inlines. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/kernelcompat.h | 26 -------------------------- 2 files changed, 35 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 45c42e9b..6d784f69 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -196,15 +196,6 @@ ifneq (,$(shell grep 'struct list_lru_one \*list, spinlock_t \*lock, void \*cb_a ccflags-y += -DKC_LIST_LRU_WALK_CB_LIST_LOCK endif -# -# v5.1-rc4-273-ge9b98e162aa5 -# -# introduce stack trace helpers -# -ifneq (,$(shell grep '^unsigned int stack_trace_save' include/linux/stacktrace.h)) -ccflags-y += -DKC_STACK_TRACE_SAVE -endif - # # v3.14-rc1-7-g4e34e719e457 # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index ea37a7fb..cfa78214 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -207,32 +207,6 @@ unsigned long kc_list_lru_shrink_walk(struct list_lru *lru, struct shrink_contro #define kc_list_lru_shrink_walk list_lru_shrink_walk #endif -#ifndef KC_STACK_TRACE_SAVE -#include -static inline unsigned int stack_trace_save(unsigned long *store, unsigned int size, - unsigned int skipnr) -{ - struct stack_trace trace = { - .entries = store, - .max_entries = size, - .skip = skipnr, - }; - - save_stack_trace(&trace); - return trace.nr_entries; -} - -static inline void stack_trace_print(unsigned long *entries, unsigned int nr_entries, int spaces) -{ - struct stack_trace trace = { - .entries = entries, - .nr_entries = nr_entries, - }; - - print_stack_trace(&trace, spaces); -} -#endif - #ifndef KC_TIMER_CONTAINER_OF #define timer_container_of(var, callback_timer, timer_fieldname) \ from_timer(var, callback_timer, timer_fieldname) From d929b06292a25c53ddf131780fea5a41e5a09ba3 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 2 May 2026 19:20:14 -0400 Subject: [PATCH 34/35] Collapse scoutfs_rename2 into scoutfs_rename_common. scoutfs_rename2 was a thin shim that validated flags and forwarded to scoutfs_rename_common. It existed because the old el7 RHEL_IOPS_WRAPPER path used a non-flag-taking .rename op alongside .rename2; with that path gone there is only one rename method, and the wrapper has no purpose. Move the RENAME_NOREPLACE flag validation into scoutfs_rename_common and point the directory inode_operations .rename slot at it directly. The symlink inode_operations already used scoutfs_rename_common, so this also makes symlink rename consistently reject unknown flags instead of silently accepting them. Signed-off-by: Auke Kok --- kmod/src/dir.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 6ac65f65..f416deaa 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -1618,6 +1618,9 @@ static int scoutfs_rename_common(KC_VFS_NS_DEF int ret; int err; + if (flags & ~RENAME_NOREPLACE) + return -EINVAL; + trace_scoutfs_rename(sb, old_dir, old_dentry, new_dir, new_dentry); old_hash = dirent_name_hash(old_dentry->d_name.name, @@ -1864,18 +1867,6 @@ out_unlock: } -static int scoutfs_rename2(KC_VFS_NS_DEF - struct inode *old_dir, - struct dentry *old_dentry, struct inode *new_dir, - struct dentry *new_dentry, unsigned int flags) -{ - if (flags & ~RENAME_NOREPLACE) - return -EINVAL; - - return scoutfs_rename_common(KC_VFS_NS - old_dir, old_dentry, new_dir, new_dentry, flags); -} - static int scoutfs_tmpfile(KC_VFS_NS_DEF struct inode *dir, @@ -1994,5 +1985,5 @@ const struct inode_operations scoutfs_dir_iops = { .symlink = scoutfs_symlink, .permission = scoutfs_permission, .tmpfile = scoutfs_tmpfile, - .rename = scoutfs_rename2, + .rename = scoutfs_rename_common, }; From 99b87371c648bd0b3beb27e42f0e05b69f3dbe5d Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 8 Jun 2026 11:53:16 -0700 Subject: [PATCH 35/35] Drop KC_HAS_SET_ACL RHEL7 was the only conditional user of this define, but since support for that is removed, these can be dropped. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ---------- kmod/src/dir.c | 2 -- kmod/src/inode.c | 4 ---- 3 files changed, 16 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 6d784f69..9c8bd9cb 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -196,16 +196,6 @@ ifneq (,$(shell grep 'struct list_lru_one \*list, spinlock_t \*lock, void \*cb_a ccflags-y += -DKC_LIST_LRU_WALK_CB_LIST_LOCK endif -# -# v3.14-rc1-7-g4e34e719e457 -# -# .set_acl callback added to struct inode_operations. Most kernels -# we target have it, but el7 (3.10 base) does not, so detect. -# -ifneq (,$(shell grep 'int ..set_acl..struct' include/linux/fs.h)) -ccflags-y += -DKC_HAS_SET_ACL -endif - # # v6.1-rc1-2-g138060ba92b3 # diff --git a/kmod/src/dir.c b/kmod/src/dir.c index f416deaa..622320c5 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -1979,9 +1979,7 @@ const struct inode_operations scoutfs_dir_iops = { #else .get_acl = scoutfs_get_acl, #endif -#ifdef KC_HAS_SET_ACL .set_acl = scoutfs_set_acl, -#endif .symlink = scoutfs_symlink, .permission = scoutfs_permission, .tmpfile = scoutfs_tmpfile, diff --git a/kmod/src/inode.c b/kmod/src/inode.c index 3c75fc98..9f6b55f7 100644 --- a/kmod/src/inode.c +++ b/kmod/src/inode.c @@ -150,9 +150,7 @@ static const struct inode_operations scoutfs_file_iops = { #else .get_acl = scoutfs_get_acl, #endif -#ifdef KC_HAS_SET_ACL .set_acl = scoutfs_set_acl, -#endif .fiemap = scoutfs_data_fiemap, }; @@ -165,9 +163,7 @@ static const struct inode_operations scoutfs_special_iops = { #else .get_acl = scoutfs_get_acl, #endif -#ifdef KC_HAS_SET_ACL .set_acl = scoutfs_set_acl, -#endif }; /*