2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Facebook. All Rights Reserved.
7 # Run fsx with log writes to verify power fail safeness.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
14 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
23 # get standard environment, filters and checks
27 . ./common/dmlogwrites
29 # real QA test starts here
33 _require_scratch_nocheck
35 _require_dm_target thin-pool
43 # Now look for our files
44 for i in $(find $SANITY_DIR -type f | grep $name | grep mark); do
45 local filename=$(basename $i)
46 local mark="${filename##*.}"
47 echo "checking $filename" >> $seqres.full
48 _log_writes_replay_log $filename $DMTHIN_VOL_DEV
50 local expected_md5=$(_md5_checksum $i)
51 local md5=$(_md5_checksum $SCRATCH_MNT/$name)
52 [ "${md5}" != "${expected_md5}" ] && _fail "$filename md5sum mismatched"
57 SANITY_DIR=$TEST_DIR/fsxtests
61 devsize=$((1024*1024*200 / 512)) # 200m phys/virt size
62 csize=$((1024*64 / 512)) # 64k cluster size
63 lowspace=$((1024*1024 / 512)) # 1m low space threshold
65 # Use a thin device to provide deterministic discard behavior. Discards are used
66 # by the log replay tool for fast zeroing to prevent out-of-order replay issues.
67 _dmthin_init $devsize $devsize $csize $lowspace
70 _log_writes_init $DMTHIN_VOL_DEV
72 _log_writes_mkfs >> $seqres.full 2>&1
74 # Log writes emulates discard support, turn it on for maximum crying.
75 _log_writes_mount -o discard
79 FSX_OPTS="-N $NUM_OPS -d -P $SANITY_DIR -i $LOGWRITES_DMDEV"
80 # Set random seeds for fsx runs (0 for timestamp + pid)
81 # When test failure is detected, check the seed values printed
82 # by fsx processes to $seqres.full and set them in this array
83 # to repeat the same fsx runs
86 for j in `seq 0 $((NUM_FILES-1))`; do
87 run_check $here/ltp/fsx $FSX_OPTS -S ${seeds[$j]} -j $j $SCRATCH_MNT/testfile$j &
92 for j in `seq 0 $((NUM_FILES-1))`; do
93 test_md5[$j]=$(_md5_checksum $SCRATCH_MNT/testfile$j)
96 # Unmount the scratch dir and tear down the log writes target
104 echo "checking pre umount" >> $seqres.full
105 _log_writes_replay_log last $DMTHIN_VOL_DEV
109 for j in `seq 0 $((NUM_FILES-1))`; do
110 check_files testfile$j
114 echo "checking post umount" >> $seqres.full
115 _log_writes_replay_log end $DMTHIN_VOL_DEV
117 for j in `seq 0 $((NUM_FILES-1))`; do
118 md5=$(_md5_checksum $SCRATCH_MNT/testfile$j)
119 [ "${md5}" != "${test_md5[$j]}" ] && _fail "testfile$j end md5sum mismatched"
123 echo "Silence is golden"