2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test filesystem consistency after each FUA operation
9 # Will do log replay and check the filesystem.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
23 $KILLALL_PROG -KILL -q $FSSTRESS_PROG &> /dev/null
24 _log_writes_cleanup &> /dev/null
28 # get standard environment, filters and checks
31 . ./common/dmlogwrites
33 # remove previous $seqres.full before test
36 # real QA test starts here
38 # Modify as appropriate.
42 _require_command "$KILLALL_PROG" killall
43 # Use $SCRATCH_DEV as replay device
45 # and we need extra device as log device
49 nr_cpus=$("$here/src/feature" -o)
50 # cap nr_cpus to 8 to avoid spending too much time on hosts with many cpus
51 if [ $nr_cpus -gt 8 ]; then
54 fsstress_args=$(_scale_fsstress_args -w -d $SCRATCH_MNT -n 512 -p $nr_cpus \
59 _log_writes_mkfs >> $seqres.full 2>&1
63 run_check $FSSTRESS_PROG $fsstress_args > /dev/null 2>&1
67 prev=$(_log_writes_mark_to_entry_number mkfs)
68 [ -z "$prev" ] && _fail "failed to locate entry mark 'mkfs'"
69 cur=$(_log_writes_find_next_fua $prev)
70 [ -z "$cur" ] && _fail "failed to locate next FUA write"
72 while [ ! -z "$cur" ]; do
73 _log_writes_replay_log_range $cur >> $seqres.full
75 # Here we need extra mount to replay the log, mainly for journal based
76 # fs, as their fsck will report dirty log as error.
77 # We don't care to preserve any data on $SCRATCH_DEV, as we can replay
78 # back to the point we need, and in fact sometimes creating/deleting
79 # snapshots repeatedly can be slower than replaying the log.
85 cur=$(_log_writes_find_next_fua $(($cur + 1)))
86 [ -z "$cur" ] && break
89 echo "Silence is golden"