From 74faf91f448bca86367ca08bfaa6e922f8e1b16b Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Tue, 11 Feb 2025 20:35:30 -0500 Subject: [PATCH] LU-18687 compat: move xarray to lustre_compat Migrate the backported xarray code to lustre_compat. Along the way, create the needed build infrastructure for lustre_compat. Currently, lustre_compat is built into libcfs.ko. Eventually, all of the Lustre/LNet compatability code will live in lustre_compat - maintaining a clear separation from the functional code in Lustre and LNet. Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: I74249d0b5714bee3549bf42a8fede3f279bc37ee Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58114 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- autoMakefile.am | 2 ++ config/lustre-build.m4 | 18 ++++++++++++++++++ config/lustre-toolchain.m4 | 2 +- libcfs/include/libcfs/linux/Makefile.am | 2 +- libcfs/libcfs/Makefile.in | 10 ++++++++-- libcfs/libcfs/linux/Makefile.am | 3 +-- libcfs/libcfs/linux/linux-prim.c | 4 +--- lustre/include/lustre_compat.h | 6 +----- lustre/include/lustre_nrs_orr.h | 6 +----- lustre/include/obd.h | 2 +- lustre/mdc/mdc_request.c | 2 +- lustre_compat/Makefile.in | 9 +++++++++ lustre_compat/autoMakefile.am | 7 +++++++ lustre_compat/include/.gitignore | 1 + lustre_compat/include/Makefile.am | 8 ++++++++ lustre_compat/include/lustre_compat/.gitignore | 1 + lustre_compat/include/lustre_compat/Makefile.am | 8 ++++++++ lustre_compat/include/lustre_compat/linux/.gitignore | 1 + lustre_compat/include/lustre_compat/linux/Makefile.am | 7 +++++++ .../include/lustre_compat}/linux/xarray.h | 0 lustre_compat/lib/Makefile.in | 13 +++++++++++++ lustre_compat/lib/autoMakefile.am | 7 +++++++ {libcfs/libcfs/linux => lustre_compat/lib}/xarray.c | 2 +- 23 files changed, 99 insertions(+), 22 deletions(-) create mode 100644 lustre_compat/Makefile.in create mode 100644 lustre_compat/autoMakefile.am create mode 100644 lustre_compat/include/.gitignore create mode 100644 lustre_compat/include/Makefile.am create mode 100644 lustre_compat/include/lustre_compat/.gitignore create mode 100644 lustre_compat/include/lustre_compat/Makefile.am create mode 100644 lustre_compat/include/lustre_compat/linux/.gitignore create mode 100644 lustre_compat/include/lustre_compat/linux/Makefile.am rename {libcfs/include/libcfs => lustre_compat/include/lustre_compat}/linux/xarray.h (100%) create mode 100644 lustre_compat/lib/Makefile.in create mode 100644 lustre_compat/lib/autoMakefile.am rename {libcfs/libcfs/linux => lustre_compat/lib}/xarray.c (99%) diff --git a/autoMakefile.am b/autoMakefile.am index 21aeec2..687a017 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -13,12 +13,14 @@ SUBDIRS := @LDISKFS_SUBDIR@ \ . \ @LUSTREIOKIT_SUBDIR@ \ + lustre_compat \ libcfs \ lnet \ lustre DIST_SUBDIRS := ldiskfs \ lustre-iokit \ + lustre_compat \ libcfs \ lnet \ lustre \ diff --git a/config/lustre-build.m4 b/config/lustre-build.m4 index 93f2164..7b2653a 100644 --- a/config/lustre-build.m4 +++ b/config/lustre-build.m4 @@ -433,6 +433,23 @@ AC_DEFUN([LB_CONFIG_FILES], [ ]) # +# LB_COMPAT_CONFIG_FILES +# +# build-specific config files (lustre_compat) +# +AC_DEFUN([LB_COMPAT_CONFIG_FILES], [ + AC_CONFIG_FILES( + lustre_compat/Makefile + lustre_compat/lib/Makefile + lustre_compat/autoMakefile + lustre_compat/lib/autoMakefile + lustre_compat/include/Makefile + lustre_compat/include/lustre_compat/Makefile + lustre_compat/include/lustre_compat/linux/Makefile + ) +]) + +# # LB_CONFIG_SERVERS # AC_DEFUN([LB_CONFIG_SERVERS], [ @@ -692,6 +709,7 @@ LB_CONFIG_HEADERS LPLUG_CONFIGURE LIBCFS_CONFIG_FILES LB_CONFIG_FILES +LB_COMPAT_CONFIG_FILES LN_CONFIG_FILES LC_CONFIG_FILES LPLUG_CONFIG_FILES diff --git a/config/lustre-toolchain.m4 b/config/lustre-toolchain.m4 index 571df1d..1e9f710 100644 --- a/config/lustre-toolchain.m4 +++ b/config/lustre-toolchain.m4 @@ -97,7 +97,7 @@ CCASFLAGS="-Wall -fPIC -D_GNU_SOURCE" AC_SUBST(CCASFLAGS) # everyone builds against lnet and lustre kernel headers -EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/libcfs/include -I$PWD/libcfs/include/libcfs -I$PWD/lnet/include/uapi -I$PWD/lnet/include -I$PWD/lustre/include/uapi -I$PWD/lustre/include" +EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/libcfs/include -I$PWD/libcfs/include/libcfs -I$PWD/lnet/include/uapi -I$PWD/lnet/include -I$PWD/lustre/include/uapi -I$PWD/lustre/include -I$PWD/lustre_compat/include" AC_SUBST(EXTRA_KCFLAGS) ]) # LTC_PROG_CC diff --git a/libcfs/include/libcfs/linux/Makefile.am b/libcfs/include/libcfs/linux/Makefile.am index 6d1ee9a..63043d1 100644 --- a/libcfs/include/libcfs/linux/Makefile.am +++ b/libcfs/include/libcfs/linux/Makefile.am @@ -6,5 +6,5 @@ EXTRA_DIST = linux-misc.h linux-fs.h linux-mem.h linux-time.h linux-cpu.h \ linux-list.h linux-hash.h linux-wait.h linux-net.h \ - generic-radix-tree.h glob.h refcount.h processor.h xarray.h \ + generic-radix-tree.h glob.h refcount.h processor.h \ linux-fortify-string.h diff --git a/libcfs/libcfs/Makefile.in b/libcfs/libcfs/Makefile.in index 62cba0b..112db33 100644 --- a/libcfs/libcfs/Makefile.in +++ b/libcfs/libcfs/Makefile.in @@ -6,12 +6,18 @@ MODULES = libcfs +COMPAT := @top_srcdir@/lustre_compat/lib/ + +libcfs_dir := $(dir $(lastword $(MAKEFILE_LIST))) +-include $(libcfs_dir)/../../lustre_compat/lib/Makefile + libcfs-linux-objs := linux-prim.o libcfs-linux-objs += linux-hash.o libcfs-linux-objs += linux-wait.o libcfs-linux-objs += generic-radix-tree.o libcfs-linux-objs += glob.o -libcfs-linux-objs += xarray.o + +libcfs-compat-objs += $(patsubst %,$(COMPAT)%,$(compat_objs)) libcfs-crypto-objs := crypto.o fname.o hkdf.o hooks.o keyring.o libcfs-crypto-objs += keysetup.o keysetup_v1.o policy.o @@ -23,7 +29,7 @@ libcfs-crypto-objs := $(addprefix crypto/,$(libcfs-crypto-objs)) libcfs-all-objs := debug.o fail.o module.o tracefile.o -libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs) +libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs) $(libcfs-compat-objs) @LLCRYPT_TRUE@libcfs-objs += $(libcfs-crypto-objs) EXTRA_PRE_CFLAGS := -I@LUSTRE@/../libcfs/libcfs diff --git a/libcfs/libcfs/linux/Makefile.am b/libcfs/libcfs/linux/Makefile.am index c58e879..e4027de 100644 --- a/libcfs/libcfs/linux/Makefile.am +++ b/libcfs/libcfs/linux/Makefile.am @@ -8,5 +8,4 @@ EXTRA_DIST = linux-prim.c \ linux-hash.c \ linux-wait.c \ generic-radix-tree.c \ - glob.c \ - xarray.c + glob.c diff --git a/libcfs/libcfs/linux/linux-prim.c b/libcfs/libcfs/linux/linux-prim.c index a3b4c5a..ee2c0ba 100644 --- a/libcfs/libcfs/linux/linux-prim.c +++ b/libcfs/libcfs/linux/linux-prim.c @@ -33,9 +33,7 @@ #include #include #include -#ifndef HAVE_XARRAY_SUPPORT -#include -#endif +#include #include #ifndef HAVE_KTIME_GET_TS64 diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index a0ba4c2..7123a90 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -29,11 +29,7 @@ #include #include #include -#ifdef HAVE_XARRAY_SUPPORT -#include -#else -#include -#endif +#include #include #ifdef HAVE_4ARGS_VFS_SYMLINK diff --git a/lustre/include/lustre_nrs_orr.h b/lustre/include/lustre_nrs_orr.h index d297c59..6fbc73a 100644 --- a/lustre/include/lustre_nrs_orr.h +++ b/lustre/include/lustre_nrs_orr.h @@ -16,11 +16,7 @@ #ifndef _LUSTRE_NRS_ORR_H #define _LUSTRE_NRS_ORR_H -#ifdef HAVE_XARRAY_SUPPORT -#include -#else -#include -#endif +#include /** * ORR policy operations diff --git a/lustre/include/obd.h b/lustre/include/obd.h index fc397e0..d030273 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 80a8e4a..6aba39e 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include diff --git a/lustre_compat/Makefile.in b/lustre_compat/Makefile.in new file mode 100644 index 0000000..dadff32 --- /dev/null +++ b/lustre_compat/Makefile.in @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0 + +# +# This file is part of Lustre, http://www.lustre.org/ +# + +obj-m += lib/ + +@INCLUDE_RULES@ diff --git a/lustre_compat/autoMakefile.am b/lustre_compat/autoMakefile.am new file mode 100644 index 0000000..5d9eb34 --- /dev/null +++ b/lustre_compat/autoMakefile.am @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +# +# This file is part of Lustre, http://www.lustre.org/ +# + +SUBDIRS = lib include diff --git a/lustre_compat/include/.gitignore b/lustre_compat/include/.gitignore new file mode 100644 index 0000000..10a7e8d --- /dev/null +++ b/lustre_compat/include/.gitignore @@ -0,0 +1 @@ +/Makefile.in diff --git a/lustre_compat/include/Makefile.am b/lustre_compat/include/Makefile.am new file mode 100644 index 0000000..8303353 --- /dev/null +++ b/lustre_compat/include/Makefile.am @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 + +# +# This file is part of Lustre, http://www.lustre.org/ +# + +SUBDIRS = lustre_compat +DIST_SUBDIRS = lustre_compat diff --git a/lustre_compat/include/lustre_compat/.gitignore b/lustre_compat/include/lustre_compat/.gitignore new file mode 100644 index 0000000..10a7e8d --- /dev/null +++ b/lustre_compat/include/lustre_compat/.gitignore @@ -0,0 +1 @@ +/Makefile.in diff --git a/lustre_compat/include/lustre_compat/Makefile.am b/lustre_compat/include/lustre_compat/Makefile.am new file mode 100644 index 0000000..d21ce25 --- /dev/null +++ b/lustre_compat/include/lustre_compat/Makefile.am @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 + +# +# This file is part of Lustre, http://www.lustre.org/ +# + +SUBDIRS = linux +DIST_SUBDIRS = linux diff --git a/lustre_compat/include/lustre_compat/linux/.gitignore b/lustre_compat/include/lustre_compat/linux/.gitignore new file mode 100644 index 0000000..10a7e8d --- /dev/null +++ b/lustre_compat/include/lustre_compat/linux/.gitignore @@ -0,0 +1 @@ +/Makefile.in diff --git a/lustre_compat/include/lustre_compat/linux/Makefile.am b/lustre_compat/include/lustre_compat/linux/Makefile.am new file mode 100644 index 0000000..303749c --- /dev/null +++ b/lustre_compat/include/lustre_compat/linux/Makefile.am @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +# +# This file is part of Lustre, http://www.lustre.org/ +# + +EXTRA_DIST = xarray.h diff --git a/libcfs/include/libcfs/linux/xarray.h b/lustre_compat/include/lustre_compat/linux/xarray.h similarity index 100% rename from libcfs/include/libcfs/linux/xarray.h rename to lustre_compat/include/lustre_compat/linux/xarray.h diff --git a/lustre_compat/lib/Makefile.in b/lustre_compat/lib/Makefile.in new file mode 100644 index 0000000..944a5f5 --- /dev/null +++ b/lustre_compat/lib/Makefile.in @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 + +# +# This file is part of Lustre, http://www.lustre.org/ +# + +compat_objs := xarray.o + +EXTRA_DIST = $(compat_objs:.o=.c) + +ifneq "$(MODULES)" "libcfs" +@INCLUDE_RULES@ +endif diff --git a/lustre_compat/lib/autoMakefile.am b/lustre_compat/lib/autoMakefile.am new file mode 100644 index 0000000..3b1a5dc --- /dev/null +++ b/lustre_compat/lib/autoMakefile.am @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +# +# This file is part of Lustre, http://www.lustre.org/ +# + +MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ diff --git a/libcfs/libcfs/linux/xarray.c b/lustre_compat/lib/xarray.c similarity index 99% rename from libcfs/libcfs/linux/xarray.c rename to lustre_compat/lib/xarray.c index 5bc9d76..833b024 100644 --- a/libcfs/libcfs/linux/xarray.c +++ b/lustre_compat/lib/xarray.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include /* * Coding conventions in this file: -- 1.8.3.1