Whamcloud - gitweb
LU-5463 osc: update kms in brw_interpret() properly
[fs/lustre-release.git] / lustre / tests / lfsck-performance.sh
index c30ab30..f3b9046 100644 (file)
@@ -13,10 +13,6 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
-#remove it when zfs-based backend iteration is enabled
-[ $(facet_fstype $SINGLEMDS) != ldiskfs ] &&
-       skip "lfsck performance only for ldiskfs" && exit 0
-
 require_dsh_mds || exit 0
 require_dsh_ost || exit 0
 
@@ -47,8 +43,6 @@ SHOW_NAMESPACE="${RLCTL} get_param -n mdd.${MDT_DEV}.lfsck_namespace"
 MNTOPTS_NOSCRUB="-o user_xattr,noscrub"
 remote_mds && ECHOCMD=${RCMD} || ECHOCMD="eval"
 
-LFSCKDIR="$MOUNT/lfsck/"
-
 if [ ${NTHREADS} -eq 0 ]; then
        CPUCORE=$(${RCMD} cat /proc/cpuinfo | grep "processor.*:" | wc -l)
        NTHREADS=$((CPUCORE * 2))
@@ -78,7 +72,7 @@ lfsck_create() {
                test_mkdir ${tdir}
        EOF"
 
-       for ((j=1; j<${threads}; j++)); do
+       for ((j = 1; j < ${threads}; j++)); do
                ${ECHOCMD} "${LCTL} <<-EOF
                        cfg_device ${echodev}
                        test_mkdir ${tdir}${j}
@@ -143,10 +137,10 @@ test_0() {
        do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules_local
        reformat_external_journal
        add ${SINGLEMDS} $(mkfs_opts ${SINGLEMDS} ${MDT_DEVNAME}) --backfstype \
-               ldiskfs --reformat ${MDT_DEVNAME} $(mdsvdevname 1) > /dev/null ||
-               error "Fail to reformat the MDS!"
+               $(facet_fstype ${SINGLEMDS}) --reformat ${MDT_DEVNAME} \
+               $(mdsvdevname 1) >/dev/null || error "Fail to reformat the MDS!"
 
-       for ((i=$MINCOUNT; i<=$MAXCOUNT; i=$((i * FACTOR)))); do
+       for ((i = $MINCOUNT; i <= $MAXCOUNT; i = $((i * FACTOR)))); do
                local nfiles=$((i - BCOUNT))
 
                echo "+++ start to create for ${i} files set at: $(date) +++"
@@ -178,6 +172,9 @@ test_0() {
 run_test 0 "lfsck namespace performance (routine case) without load"
 
 test_1() {
+       [ $(facet_fstype $SINGLEMDS) != ldiskfs ] &&
+               skip "not implemented for ZFS" && return
+
        local BCOUNT=0
        local i
 
@@ -185,10 +182,11 @@ test_1() {
        do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules_local
        reformat_external_journal
        add ${SINGLEMDS} $(mkfs_opts ${SINGLEMDS} ${MDT_DEVNAME}) --backfstype \
-               ldiskfs --reformat ${MDT_DEVNAME} $(mdsvdevname 1) > /dev/null ||
-               error "Fail to reformat the MDS!"
+               $(facet_fstype ${SINGLEMDS}) --reformat ${MDT_DEVNAME} \
+               $(mdsvdevname 1) > /dev/null || error "Fail to reformat the MDS"
 
-       for ((i=$MINCOUNT_REPAIR; i<=$MAXCOUNT_REPAIR; i=$((i * FACTOR)))); do
+       for ((i = $MINCOUNT_REPAIR; i <= $MAXCOUNT_REPAIR;
+             i = $((i * FACTOR)))); do
                local nfiles=$((i - BCOUNT))
 
                echo "+++ start to create for ${i} files set at: $(date) +++"
@@ -232,13 +230,14 @@ run_test 1 "lfsck namespace performance (backup/restore) without load"
 test_2() {
        local i
 
-       for ((i=$MINCOUNT_REPAIR; i<=$MAXCOUNT_REPAIR; i=$((i * FACTOR)))); do
+       for ((i = $MINCOUNT_REPAIR; i <= $MAXCOUNT_REPAIR;
+             i = $((i * FACTOR)))); do
                stopall
                do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules_local
                reformat_external_journal
                add ${SINGLEMDS} $(mkfs_opts ${SINGLEMDS} ${MDT_DEVNAME}) \
-                       --backfstype ldiskfs --reformat ${MDT_DEVNAME} \
-                       $(mdsvdevname 1) > /dev/null ||
+                       --backfstype $(facet_fstype ${SINGLEMDS}) --reformat \
+                       ${MDT_DEVNAME} $(mdsvdevname 1) > /dev/null ||
                        error "Fail to reformat the MDS!"
 
                echo "+++ start to create for ${i} files set at: $(date) +++"
@@ -279,10 +278,10 @@ test_3() {
        do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules_local
        reformat_external_journal
        add ${SINGLEMDS} $(mkfs_opts ${SINGLEMDS} ${MDT_DEVNAME}) --backfstype \
-               ldiskfs --reformat ${MDT_DEVNAME} $(mdsvdevname 1) > /dev/null ||
-               error "Fail to reformat the MDS!"
+               $(facet_fstype ${SINGLEMDS}) --reformat ${MDT_DEVNAME} \
+               $(mdsvdevname 1) > /dev/null || error "Fail to reformat the MDS"
 
-       for ((i=$inc_count; i<=$BASE_COUNT; i=$((i + inc_count)))); do
+       for ((i = $inc_count; i <= $BASE_COUNT; i = $((i + inc_count)))); do
                local nfiles=$((i - BCOUNT))
 
                echo "+++ start to create for ${i} files set at: $(date) +++"
@@ -313,7 +312,7 @@ test_3() {
        local inc_speed=$((FULL_SPEED * INCFACTOR / 100))
        local j
 
-       for ((j=$inc_speed; j<$FULL_SPEED; j=$((j + inc_speed)))); do
+       for ((j = $inc_speed; j < $FULL_SPEED; j = $((j + inc_speed)))); do
                start ${SINGLEMDS} $MDT_DEVNAME $MNTOPTS_NOSCRUB > /dev/null ||
                        error "Fail to start MDS!"
 
@@ -388,7 +387,7 @@ layout_gen_one()
        local idx1=$1
        local idx2=$2
        local mntpt="/mnt/lustre_lfsck_${idx1}_${idx2}"
-       local basedir="$mntpt/lfsck/$idx1/$idx2"
+       local basedir="$mntpt/$tdir/$idx1/$idx2"
 
        mkdir -p $mntpt || {
                error_noexit "(11) Fail to mkdir $mntpt"
@@ -422,10 +421,10 @@ layout_gen_set()
        local cnt=$1
 
        echo "##### Start generate test set for subdirs=$cnt at: $(date) #####"
-       for ((k=0; k<$MDSCOUNT; k++)); do
+       for ((k = 0; k < $MDSCOUNT; k++)); do
                $LFS mkdir -i ${k} $LFSCKDIR/${k} || return 10
 
-               for ((l=1; l<=$cnt; l++)); do
+               for ((l = 1; l <= $cnt; l++)); do
                        layout_gen_one ${k} ${l} &
                done
        done
@@ -442,14 +441,15 @@ t4_test()
        echo "stopall"
        stopall > /dev/null || error "(1) Fail to stopall"
 
+       LFSCKDIR="$DIR/$tdir"
        MDSCOUNT=1
-       for ((i=1; i<=$saved_ostcount; i=$((i * 2)))); do
+       for ((i = 1; i <= $saved_ostcount; i = $((i * 2)))); do
                OSTCOUNT=${i}
 
                echo "+++++ Start cycle ostcount=$OSTCOUNT at: $(date) +++++"
                echo
 
-               for ((j=$MINSUBDIR; j<=$MAXSUBDIR; j=$((j * FACTOR)))); do
+               for ((j = $MINSUBDIR; j <= $MAXSUBDIR; j = $((j * FACTOR)))); do
                        echo "formatall"
                        formatall > /dev/null ||
                                error "(2) Fail to formatall, subdirs=${j}"
@@ -459,15 +459,15 @@ t4_test()
                                error "(3) Fail to setupall, subdirs=${j}"
 
                        mkdir $LFSCKDIR ||
-                       error "(4) Fail to mkdir $LFSCKDIR, subdirs=${j}"
+                               error "(4) mkdir $LFSCKDIR, subdirs=${j}"
 
                        $LFS setstripe -c ${OSTCOUNT} -i 0 $LFSCKDIR ||
-                       error "(5) Fail to setstripe on $LFSCKDIR, subdirs=${j}"
+                               error "(5) setstripe on $LFSCKDIR, subdirs=${j}"
 
                        local RC=0
                        layout_gen_set ${j} || RC=$?
                        [ $RC -eq 0 ] ||
-                       error "(6) Fail to generate set $RC, subdirs=${j}"
+                               error "(6) generate set $RC, subdirs=${j}"
 
                        RC=0
                        layout_test_one || RC=$?
@@ -484,9 +484,6 @@ t4_test()
 
        MDSCOUNT=$saved_mdscount
        OSTCOUNT=$saved_ostcount
-
-       echo "formatall"
-       formatall > /dev/null || error "(9) Fail to stopall"
 }
 
 test_4a() {
@@ -497,15 +494,9 @@ run_test 4a "Single MDS lfsck layout performance (routine case) without load"
 test_4b() {
        echo "Inject failure stub to simulate dangling reference"
        #define OBD_FAIL_LFSCK_DANGLING 0x1610
-       for i in $(seq $OSTCOUNT); do
-               do_facet ost${i} $LCTL set_param fail_loc=0x1610
-       done
+       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0x1610
 
        t4_test
-
-       for i in $(seq $OSTCOUNT); do
-               do_facet ost${i} $LCTL set_param fail_loc=0
-       done
 }
 run_test 4b "Single MDS lfsck layout performance (repairing case) without load"
 
@@ -516,13 +507,14 @@ t5_test()
        echo "stopall"
        stopall > /dev/null || error "(1) Fail to stopall"
 
-       for ((i=1; i<=$saved_mdscount; i++)); do
+       LFSCKDIR="$DIR/$tdir"
+       for ((i = 1; i <= $saved_mdscount; i++)); do
                MDSCOUNT=${i}
 
                echo "+++++ Start cycle mdscount=$MDSCOUNT at: $(date) +++++"
                echo
 
-               for ((j=$MINSUBDIR; j<=$MAXSUBDIR; j=$((j * FACTOR)))); do
+               for ((j = $MINSUBDIR; j <= $MAXSUBDIR; j = $((j * FACTOR)))); do
                        echo "formatall"
                        formatall > /dev/null ||
                                error "(2) Fail to formatall, subdirs=${j}"
@@ -532,15 +524,15 @@ t5_test()
                                error "(3) Fail to setupall, subdirs=${j}"
 
                        mkdir $LFSCKDIR ||
-                       error "(4) Fail to mkdir $LFSCKDIR, subdirs=${j}"
+                               error "(4) mkdir $LFSCKDIR, subdirs=${j}"
 
                        $LFS setstripe -c ${OSTCOUNT} -i 0 $LFSCKDIR ||
-                       error "(5) Fail to setstripe on $LFSCKDIR, subdirs=${j}"
+                               error "(5) setstripe on $LFSCKDIR, subdirs=${j}"
 
                        local RC=0
                        layout_gen_set ${j} || RC=$?
                        [ $RC -eq 0 ] ||
-                       error "(6) Fail to generate set $RC, subdirs=${j}"
+                               error "(6) generate set $RC, subdirs=${j}"
 
                        RC=0
                        layout_test_one || RC=$?
@@ -556,9 +548,6 @@ t5_test()
        done
 
        MDSCOUNT=$saved_mdscount
-
-       echo "formatall"
-       formatall > /dev/null || error "(9) Fail to stopall"
 }
 
 test_5a() {
@@ -569,15 +558,9 @@ run_test 5a "lfsck layout performance (routine case) without load for DNE"
 test_5b() {
        echo "Inject failure stub to simulate dangling reference"
        #define OBD_FAIL_LFSCK_DANGLING 0x1610
-       for i in $(seq $OSTCOUNT); do
-               do_facet ost${i} $LCTL set_param fail_loc=0x1610
-       done
+       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0x1610
 
        t5_test
-
-       for i in $(seq $OSTCOUNT); do
-               do_facet ost${i} $LCTL set_param fail_loc=0
-       done
 }
 run_test 5b "lfsck layout performance (repairing case) without load for DNE"
 
@@ -621,6 +604,7 @@ test_6() {
 
        local saved_mdscount=$MDSCOUNT
 
+       LFSCKDIR="$DIR/$tdir"
        MDSCOUNT=1
        echo "formatall"
        formatall > /dev/null || error "(2) Fail to formatall"
@@ -659,8 +643,8 @@ test_6() {
        local nfiles=$((inc_count / 2))
 
        lfsck_attach
-       for ((m=0, n=$INCFACTOR; n<100;
-             m=$((m + inc_count)), n=$((n + INCFACTOR)))); do
+       for ((m = 0, n = $INCFACTOR; n < 100;
+             m = $((m + inc_count)), n = $((n + INCFACTOR)))); do
                local sl=$((SPEED * n / 100))
 
                $STOP_LFSCK > /dev/null 2>&1
@@ -703,9 +687,6 @@ test_6() {
        stopall > /dev/null || error "(14) Fail to stopall"
 
        MDSCOUNT=$saved_mdscount
-
-       echo "formatall"
-       formatall > /dev/null || error "(15) Fail to stopall"
 }
 run_test 6 "lfsck layout impact on create performance"