From 1aec91ac64039330dc2325cf3f2527b140fd60f4 Mon Sep 17 00:00:00 2001 From: Xinliang Liu Date: Tue, 18 Jul 2023 03:42:19 +0000 Subject: [PATCH] LU-16976 ldiskfs: add support for openEuler 22.03 SP2 Add ldiskfs server support for oe2203sp2. Sync with ldiskfs-5.14-rhel9.2.series adding missing patches. Also refine openEuler lbuild scripts. Change-Id: I91841a7140a9f8f3182a4a329b9f04639a85e94d Test-Parameters: trivial Signed-off-by: Xinliang Liu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51753 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- config/lustre-build-ldiskfs.m4 | 2 +- contrib/lbuild/funcs.sh | 5 +- contrib/lbuild/lbuild | 5 +- contrib/lbuild/lbuild-oe2203 | 40 +--------- contrib/lbuild/lbuild-oe2203sp1 | 40 ---------- contrib/lbuild/lbuild-openeuler | 42 ++++++++++ .../ext4-add-periodic-superblock-update.patch | 93 ++++++++++++++++++++++ .../patches/oe2203/ext4-dquot-commit-speedup.patch | 26 ++++++ .../series/ldiskfs-5.10.0-oe2203.series | 1 - .../series/ldiskfs-5.10.0-oe2203sp1.series | 10 ++- lustre/ChangeLog | 1 + lustre/autoconf/lustre-core.m4 | 1 + .../targets/5.10-oe2203sp2.target.in | 21 +++++ 13 files changed, 196 insertions(+), 91 deletions(-) mode change 100644 => 120000 contrib/lbuild/lbuild-oe2203 delete mode 100644 contrib/lbuild/lbuild-oe2203sp1 create mode 100644 contrib/lbuild/lbuild-openeuler create mode 100644 ldiskfs/kernel_patches/patches/oe2203/ext4-add-periodic-superblock-update.patch create mode 100644 ldiskfs/kernel_patches/patches/oe2203/ext4-dquot-commit-speedup.patch create mode 100644 lustre/kernel_patches/targets/5.10-oe2203sp2.target.in diff --git a/config/lustre-build-ldiskfs.m4 b/config/lustre-build-ldiskfs.m4 index f71ee0d..0b1cde8 100644 --- a/config/lustre-build-ldiskfs.m4 +++ b/config/lustre-build-ldiskfs.m4 @@ -156,7 +156,7 @@ AS_IF([test x$RHEL_KERNEL = xyes], [ ], [test x$OPENEULER_KERNEL = xyes], [ case $OPENEULER_VERSION_NO in 2203.0) LDISKFS_SERIES="5.10.0-oe2203.series" ;; - 2203.1) LDISKFS_SERIES="5.10.0-oe2203sp1.series" ;; + 2203.*) LDISKFS_SERIES="5.10.0-oe2203sp1.series" ;; esac ]) ]) diff --git a/contrib/lbuild/funcs.sh b/contrib/lbuild/funcs.sh index 8db9532..78389a5 100644 --- a/contrib/lbuild/funcs.sh +++ b/contrib/lbuild/funcs.sh @@ -165,7 +165,7 @@ autodetect_distro() { if [[ "$lts_sp" != "n/a" ]]; then lts_sp=${lts_sp##*-} lts_sp=${lts_sp,,} - version="${version}${lts_sp}" + version="${version}.${lts_sp}" fi ;; *) @@ -222,7 +222,8 @@ autodetect_target() { sles15.4) target="$(uname -r | cut -d . -f 1,2)-sles15sp4";; fc18) target="3.x-fc18";; oe2203) target="5.10-oe2203";; - oe2203sp1) target="5.10-oe2203sp1";; + oe2203.sp1) target="5.10-oe2203sp1";; + oe2203.sp2) target="5.10-oe2203sp2";; *) fatal 1 "I don't know what distro $distro is.\nEither update autodetect_target() or use the --target argument.";; esac diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index 70ef15b..49303f3 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -329,12 +329,9 @@ check_options() { 3.0-sles11) CANONICAL_TARGET="sles11" ;; - 5.10-oe2203) + 5.10-oe2203*) CANONICAL_TARGET="oe2203" ;; - 5.10-oe2203sp1) - CANONICAL_TARGET="oe2203sp1" - ;; esac local timestampnodig=$(echo $TIMESTAMP | sed -e s/[0-9]*//g) diff --git a/contrib/lbuild/lbuild-oe2203 b/contrib/lbuild/lbuild-oe2203 deleted file mode 100644 index 1f4dc54..0000000 --- a/contrib/lbuild/lbuild-oe2203 +++ /dev/null @@ -1,39 +0,0 @@ -source ${LBUILD_DIR}/lbuild-rhel - -# increment this if you have made a change that should force a new kernel -# to build built -BUILD_GEN+=".0" - -SPEC_NAME="kernel.spec" -DEVEL_PATH_ARCH_DELIMETER="." -USE_KABI=false -RPM_HELPERS_DIR="/usr/lib/rpm/openEuler" -# Pkg which contains ext4 source code -KERNEL_DEBUGINFO="kernel-debugsource-${lnxmaj}-${lnxrel}.${TARGET_ARCH}.rpm" - -# force local definition of %dist into ~/.rpmmacros -# to avoid verbose extended strings like ".el9.centos" -# in kernel version and rpm names -# -RMAC=$HOME/.rpmmacros -grep '^%dist' $RMAC &> /dev/null || echo '%dist .oe2203' >> $RMAC - -unpack_linux_devel_rpm-oe2203() { - local callers_rpm="$1" - - unpack_linux_devel_rpm-rhel "$callers_rpm" -} - -find_linux_rpm-oe2203() { - local prefix="$1" - local wanted_kernel="$2" - local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} - - find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" -} - -kernel_debuginfo_location() { - local base_os="https://repo.openeuler.org/openEuler-22.03-LTS" - - echo "$base_os/update/$TARGET_ARCH/Packages/" -} diff --git a/contrib/lbuild/lbuild-oe2203 b/contrib/lbuild/lbuild-oe2203 new file mode 120000 index 0000000..4f83bd2 --- /dev/null +++ b/contrib/lbuild/lbuild-oe2203 @@ -0,0 +1 @@ +lbuild-openeuler \ No newline at end of file diff --git a/contrib/lbuild/lbuild-oe2203sp1 b/contrib/lbuild/lbuild-oe2203sp1 deleted file mode 100644 index b115a34..0000000 --- a/contrib/lbuild/lbuild-oe2203sp1 +++ /dev/null @@ -1,40 +0,0 @@ -source ${LBUILD_DIR}/lbuild-rhel - -# increment this if you have made a change that should force a new kernel -# to build built -BUILD_GEN+=".0" - -SPEC_NAME="kernel.spec" -DEVEL_PATH_ARCH_DELIMETER="." -USE_KABI=false -RPM_HELPERS_DIR="/usr/lib/rpm/openEuler" -# Pkg which contains ext4 source code -KERNEL_DEBUGINFO="kernel-debugsource-${lnxmaj}-${lnxrel}.${TARGET_ARCH}.rpm" -DISTRO_REPO_MIRROR=${DISTRO_REPO_MIRROR:-"https://repo.openeuler.org"} - -# force local definition of %dist into ~/.rpmmacros -# to avoid verbose extended strings like ".el9.centos" -# in kernel version and rpm names -# -RMAC=$HOME/.rpmmacros -grep '^%dist' $RMAC &> /dev/null || echo '%dist .oe2203sp1' >> $RMAC - -unpack_linux_devel_rpm-oe2203sp1() { - local callers_rpm="$1" - - unpack_linux_devel_rpm-rhel "$callers_rpm" -} - -find_linux_rpm-oe2203sp1() { - local prefix="$1" - local wanted_kernel="$2" - local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} - - find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" -} - -kernel_debuginfo_location() { - local base_os="$DISTRO_REPO_MIRROR/openEuler-22.03-LTS-SP1" - - echo "$base_os/update/$TARGET_ARCH/Packages/" -} diff --git a/contrib/lbuild/lbuild-openeuler b/contrib/lbuild/lbuild-openeuler new file mode 100644 index 0000000..35845f3 --- /dev/null +++ b/contrib/lbuild/lbuild-openeuler @@ -0,0 +1,42 @@ +# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4: +source ${LBUILD_DIR}/lbuild-rhel + +DEVEL_PATH_ARCH_DELIMETER="." +RPM_HELPERS_DIR="/usr/lib/rpm/openEuler" +# Pkg which contains ext4 source code +KERNEL_DEBUGINFO="kernel-debugsource-${lnxmaj}-${lnxrel}.${TARGET_ARCH}.rpm" + +# force local definition of %dist into ~/.rpmmacros +# to avoid verbose extended strings like ".el9.centos" +# in kernel version and rpm names +RMAC=$HOME/.rpmmacros +grep '^%dist' $RMAC &> /dev/null || echo "%dist .${DISTRO/./}" >> $RMAC + +kernel_debuginfo_location() { + local base_url="https://repo.openeuler.org" + local distro=${DISTRO^^} + # convert OEYYMM.SPx to openEuler-YY.MM-LTS-SPx + distro=$(echo $distro | sed -E -e 's/OE/openEuler-/' \ + -e 's/([0-9]{2})([0-9]{2})/\1.\2-/' \ + -e 's/.(SP[0-9]+)/LTS-\1/') + + echo "${base_url}/${distro}/update/$TARGET_ARCH/Packages" +} + + +eval "$(cat < +Date: Fri, 1 Sep 2023 08:30:38 +0000 +Subject: [PATCH] ext4: Add periodic superblock update check + +This patch introduces a mechanism to periodically check and update +the superblock within the ext4 file system. The main purpose of this +patch is to keep the disk superblock up to date. The update will be +performed if more than one hour has passed since the last update, and +if more than 16MB of data have been written to disk. + +This check and update is performed within the ext4_journal_commit_callback +function, ensuring that the superblock is written while the disk is +active, rather than based on a timer that may trigger during disk idle +periods. + +Signed-off-by: Vitaliy Kuznetsov +Signed-off-by: Xinliang Liu +--- + fs/ext4/super.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 50 insertions(+) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index af00b96..23d9158 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -439,6 +439,55 @@ static int block_device_ejected(struct super_block *sb) + return bdi->dev == NULL; + } + ++#define EXT4_SB_REFRESH_INTERVAL_SEC (3600) /* seconds (1 hour) */ ++#define EXT4_SB_REFRESH_INTERVAL_KB (16384) /* kilobytes (16MB) */ ++ ++/* ++ * The ext4_maybe_update_superblock() function checks and updates the ++ * superblock if needed. ++ * ++ * This function is designed to update the on-disk superblock only under ++ * certain conditions to prevent excessive disk writes and unnecessary ++ * waking of the disk from sleep. The superblock will be updated if: ++ * 1. More than an hour has passed since the last superblock update, and ++ * 2. More than 16MB have been written since the last superblock update. ++ * ++ * @sb: The superblock ++ */ ++static void ext4_maybe_update_superblock(struct super_block *sb) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(sb); ++ struct ext4_super_block *es = sbi->s_es; ++ time64_t now; ++ __u64 last_update; ++ __u64 lifetime_write_kbytes; ++ __u64 diff_size; ++ ++ if (sb_rdonly(sb)) ++ return; ++ ++ now = ktime_get_real_seconds(); ++ last_update = ext4_get_tstamp(es, s_wtime); ++ ++ if (likely(now - last_update < EXT4_SB_REFRESH_INTERVAL_SEC)) ++ return; ++ ++ lifetime_write_kbytes = sbi->s_kbytes_written + ++ ((part_stat_read(sb->s_bdev->bd_part, sectors[STAT_WRITE]) - ++ sbi->s_sectors_written_start) >> 1); ++ ++ /* Get the number of kilobytes not written to disk to account ++ * for statistics and compare with a multiple of 16 MB. This ++ * is used to determine when the next superblock commit should ++ * occur (i.e. not more often than once per 16MB if there was ++ * less written in an hour). ++ */ ++ diff_size = lifetime_write_kbytes - le64_to_cpu(es->s_kbytes_written); ++ ++ if (diff_size > EXT4_SB_REFRESH_INTERVAL_KB) ++ schedule_work(&EXT4_SB(sb)->s_error_work); ++} ++ + static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn) + { + struct super_block *sb = journal->j_private; +@@ -449,6 +498,7 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn) + BUG_ON(txn->t_state == T_FINISHED); + + ext4_process_freed_data(sb, txn->t_tid); ++ ext4_maybe_update_superblock(sb); + + spin_lock(&sbi->s_md_lock); + while (!list_empty(&txn->t_private_list)) { +-- +2.33.0 + diff --git a/ldiskfs/kernel_patches/patches/oe2203/ext4-dquot-commit-speedup.patch b/ldiskfs/kernel_patches/patches/oe2203/ext4-dquot-commit-speedup.patch new file mode 100644 index 0000000..7c843c7 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/oe2203/ext4-dquot-commit-speedup.patch @@ -0,0 +1,26 @@ +From 2f0c38b500b76273f2674276b3af721702210d9a Mon Sep 17 00:00:00 2001 +From: Xinliang Liu +Date: Fri, 1 Sep 2023 04:40:23 +0000 +Subject: [PATCH] ext4: dquot commit speedup + +Signed-off-by: Xinliang Liu +--- + fs/ext4/super.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 59d219a..4af616e 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -6409,6 +6409,8 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot) + /* Are we journaling quotas? */ + if (ext4_has_feature_quota(sb) || + sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { ++ if (test_bit(DQ_MOD_B, &dquot->dq_flags)) ++ return 0; + dquot_mark_dquot_dirty(dquot); + return ext4_write_dquot(dquot); + } else { +-- +2.33.0 + diff --git a/ldiskfs/kernel_patches/series/ldiskfs-5.10.0-oe2203.series b/ldiskfs/kernel_patches/series/ldiskfs-5.10.0-oe2203.series index d5b0e8f..fdf44ca 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-5.10.0-oe2203.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-5.10.0-oe2203.series @@ -32,4 +32,3 @@ linux-5.8/ext4-enc-flag.patch oe2203/ext4-delayed-iput.patch linux-5.10/ext4-fiemap-kernel-data.patch rhel8/ext4-old_ea_inodes_handling_fix.patch -rhel8/ext4-encdata.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-5.10.0-oe2203sp1.series b/ldiskfs/kernel_patches/series/ldiskfs-5.10.0-oe2203sp1.series index ab90afa..25418dc 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-5.10.0-oe2203sp1.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-5.10.0-oe2203sp1.series @@ -23,13 +23,15 @@ rhel7.6/ext4-export-orphan-add.patch linux-5.8/ext4-export-mb-stream-allocator-variables.patch ubuntu19/ext4-iget-with-flags.patch linux-5.4/export-ext4fs-dirhash-helper.patch -ubuntu20.04.3/ext4-simple-blockalloc.patch -linux-5.14/ext4-xattr-disable-credits-check.patch linux-5.8/ext4-no-max-dir-size-limit-for-iam-objects.patch +oe2203/ext4-dquot-commit-speedup.patch rhel8/ext4-ialloc-uid-gid-and-pass-owner-down.patch base/ext4-projid-xattrs.patch -linux-5.8/ext4-enc-flag.patch oe2203/ext4-delayed-iput.patch +rhel8/ext4-ext-merge.patch +linux-5.14/ext4-xattr-disable-credits-check.patch linux-5.10/ext4-fiemap-kernel-data.patch rhel8/ext4-old_ea_inodes_handling_fix.patch -rhel8/ext4-encdata.patch +linux-5.8/ext4-enc-flag.patch +ubuntu20.04.3/ext4-simple-blockalloc.patch +oe2203/ext4-add-periodic-superblock-update.patch diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 875373c..006fe47 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -30,6 +30,7 @@ TBD Whamcloud vanilla linux 5.4.136 (ZFS + ldiskfs) 5.10.0-60.94.0.118.oe2203 (openEuler 22.03 LTS) 5.10.0-136.32.0.108.oe2203sp1 (openEuler 22.03 LTS SP1) + 5.10.0-153.19.0.95.oe2203sp2 (openEuler 22.03 LTS SP2) * ldiskfs needs an ldiskfs patch series for that kernel, ZFS does not * Client primary kernels built and tested during release cycle: 5.14.0-284.25.1.el9 (RHEL9.2) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 558c503..d72b428 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -4890,6 +4890,7 @@ lustre/kernel_patches/targets/5.14-sles15sp4.target lustre/kernel_patches/targets/3.x-fc18.target lustre/kernel_patches/targets/5.10-oe2203.target lustre/kernel_patches/targets/5.10-oe2203sp1.target +lustre/kernel_patches/targets/5.10-oe2203sp2.target lustre/ldlm/Makefile lustre/ldlm/autoMakefile lustre/ec/autoMakefile diff --git a/lustre/kernel_patches/targets/5.10-oe2203sp2.target.in b/lustre/kernel_patches/targets/5.10-oe2203sp2.target.in new file mode 100644 index 0000000..805f11c --- /dev/null +++ b/lustre/kernel_patches/targets/5.10-oe2203sp2.target.in @@ -0,0 +1,21 @@ +lnxmaj="5.10.0" +lnxrel="153.19.0.95.oe2203sp2" + +KERNEL_SRPM=kernel-${lnxmaj}-${lnxrel}.src.rpm +SERIES="" +EXTRA_VERSION=${lnxrel}_lustre.@VERSION@ +LUSTRE_VERSION=@VERSION@ + +DEVEL_PATH_ARCH_DELIMETER="." +OFED_VERSION=inkernel + +#SMP_ARCHS="i686 x86_64 ia64 ppc64" +# openEuler doesn't use smp specific kernels +SMP_ARCHS="" + +for cc in gcc ; do + if which $cc >/dev/null 2>/dev/null ; then + export CC=$cc + break + fi +done -- 1.8.3.1