Whamcloud - gitweb
LU-15999 tests: format journal with correct block size 30/47930/5
authorElena Gryaznova <elena.gryaznova@hpe.com>
Mon, 11 Jul 2022 09:04:53 +0000 (12:04 +0300)
committerOleg Drokin <green@whamcloud.com>
Thu, 1 Sep 2022 05:54:12 +0000 (05:54 +0000)
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 <facet>_BLOCKSIZE are set.

Fixes: d01d4c697a ("LU-957 scrub: Proc interfaces and tests for OI scrub")
Test-Parameters: trivial
Signed-off-by: Elena Gryaznova <elena.gryaznova@hpe.com>
HPE-bug-id: LUS-11008
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Vladimir Saveliev <vlaidimir.saveliev@hpe.com>
Change-Id: I0a82e34efc23d318bbd52946916ae8f2b7cd94eb
Reviewed-on: https://review.whamcloud.com/47930
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Vladimir Saveliev <vladimir.saveliev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/test-framework.sh

index b893ed6..05c53a0 100755 (executable)
@@ -436,6 +436,7 @@ init_test_env() {
        export KEEP_POOLS=${KEEP_POOLS:-false}
        export PARALLEL=${PARALLEL:-"no"}
 
        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
        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 opts
        local fs_mkfs_opts
        local var
+       local varbs=${facet}_BLOCKSIZE
 
        if [ $type == MGS ] || ( [ $type == MDS ] &&
                                  [ "$dev" == $(mgsdevname) ] &&
 
        if [ $type == MGS ] || ( [ $type == MDS ] &&
                                  [ "$dev" == $(mgsdevname) ] &&
@@ -4894,6 +4896,7 @@ mkfs_opts() {
 
        [[ "$QUOTA_TYPE" =~ "p" ]] && fs_mkfs_opts+=" -O project"
 
 
        [[ "$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
        [ $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 var
 
        var=${facet}_JRN
+       local varbs=${facet}_BLOCKSIZE
        if [ -n "${!var}" ]; then
                local rcmd="do_facet $facet"
        if [ -n "${!var}" ]; then
                local rcmd="do_facet $facet"
+               local bs=${!varbs:-$BLCKSIZE}
 
 
+               bs="-b $bs"
                echo "reformat external journal on $facet:${!var}"
                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
 }
 
        fi
 }