From 9899144862af7b741eef9f36bc5666d49a7dd203 Mon Sep 17 00:00:00 2001 From: Elena Gryaznova Date: Mon, 11 Jul 2022 12:04:53 +0300 Subject: [PATCH] LU-15999 tests: format journal with correct block size Without "-b block-size" mke2fs calculates block size itself based upon device size. In result, filesystem and journal may be formatted with different block sizes. For example, 32M device gets formatted to journal with block size 1K and llmount.sh fails to create Lustre with external journal: mke2fs: Filesystem has unexpected block size while trying to open journal device /dev/vdb because the target device itself is created with default "Block size: 4096". Let's make sure that journal gets formatted with correct block size. Patch also adds the ability to create fs with different block sizes if BLCKSIZE or _BLOCKSIZE are set. Fixes: d01d4c697a ("LU-957 scrub: Proc interfaces and tests for OI scrub") Test-Parameters: trivial Signed-off-by: Elena Gryaznova HPE-bug-id: LUS-11008 Reviewed-by: Alexander Boyko Reviewed-by: Vladimir Saveliev Change-Id: I0a82e34efc23d318bbd52946916ae8f2b7cd94eb Reviewed-on: https://review.whamcloud.com/47930 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Vladimir Saveliev Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index b893ed6..05c53a0 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -436,6 +436,7 @@ init_test_env() { export KEEP_POOLS=${KEEP_POOLS:-false} export PARALLEL=${PARALLEL:-"no"} + export BLCKSIZE=${BLCKSIZE:-4096} export MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines} . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} get_lustre_env @@ -4830,6 +4831,7 @@ mkfs_opts() { local opts local fs_mkfs_opts local var + local varbs=${facet}_BLOCKSIZE if [ $type == MGS ] || ( [ $type == MDS ] && [ "$dev" == $(mgsdevname) ] && @@ -4894,6 +4896,7 @@ mkfs_opts() { [[ "$QUOTA_TYPE" =~ "p" ]] && fs_mkfs_opts+=" -O project" + [ $fstype == ldiskfs ] && fs_mkfs_opts+=" -b ${!varbs:-$BLCKSIZE}" [ $fstype == ldiskfs ] && fs_mkfs_opts=$(squash_opt $fs_mkfs_opts) if [ -n "${fs_mkfs_opts## }" ]; then @@ -8961,11 +8964,14 @@ reformat_external_journal() { local var var=${facet}_JRN + local varbs=${facet}_BLOCKSIZE if [ -n "${!var}" ]; then local rcmd="do_facet $facet" + local bs=${!varbs:-$BLCKSIZE} + bs="-b $bs" echo "reformat external journal on $facet:${!var}" - ${rcmd} mke2fs -O journal_dev ${!var} || return 1 + ${rcmd} mke2fs -O journal_dev $bs ${!var} || return 1 fi } -- 1.8.3.1