2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat Inc. All Rights Reserved.
7 # Dedup & random I/O race test, do multi-threads fsstress and dedupe on
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
36 # duperemove only supports btrfs and xfs (with reflink feature).
37 # Add other filesystems if it supports more later.
38 _supported_fs xfs btrfs
40 _require_scratch_dedupe
41 _require_command "$DUPEREMOVE_PROG" duperemove
42 _require_command "$KILLALL_PROG" killall
44 _scratch_mkfs > $seqres.full 2>&1
45 _scratch_mount >> $seqres.full 2>&1
51 # stop duperemove running
52 if [ -e $dupe_run ]; then
57 # Make sure all fsstress get killed
58 while [ $f -ne 0 ]; do
59 $KILLALL_PROG -q $FSSTRESS_PROG > /dev/null 2>&1
61 f=`ps -eLf | grep $FSSTRESS_PROG | grep -v "grep" | wc -l`
65 sleep_time=$((50 * TIME_FACTOR))
68 testdir="$SCRATCH_MNT/dir"
70 fsstress_opts="-r -n 1000 -p $((5 * LOAD_FACTOR))"
71 $FSSTRESS_PROG $fsstress_opts -d $testdir -l 0 >> $seqres.full 2>&1 &
73 dupe_run=$TEST_DIR/${seq}-running
74 # Start several dedupe processes on same directory
76 for ((i = 0; i < $((2 * LOAD_FACTOR)); i++)); do
77 while [ -e $dupe_run ]; do
78 $DUPEREMOVE_PROG -dr --dedupe-options=same $testdir \
81 dedup_pids="$! $dedup_pids"
84 # End the test after $sleep_time seconds
88 # umount and mount again, verify pagecache contents don't mutate and a fresh
89 # read from the disk also doesn't show mutations.
90 find $testdir -type f -exec md5sum {} \; > ${tmp}.md5sum
92 md5sum -c --quiet ${tmp}.md5sum
94 echo "Silence is golden"