2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 Red Hat Inc. All rights reserved.
5 # FSQA Test No. btrfs/063
7 # Run btrfs balance and remount with different compress algorithms
8 # simultaneously, with fsstress running in background.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
29 # real QA test starts here
31 # we check scratch dev after each loop
32 _require_scratch_nocheck
33 _require_scratch_dev_pool 4
34 _btrfs_get_profile_configs
42 echo "Test $mkfs_opts" >>$seqres.full
44 _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
45 # make sure we created btrfs with desired options
47 echo "mkfs $mkfs_opts failed"
50 _scratch_mount >>$seqres.full 2>&1
52 args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
53 echo "Run fsstress $args" >>$seqres.full
54 $FSSTRESS_PROG $args >/dev/null 2>&1 &
57 echo -n "Start balance worker: " >>$seqres.full
58 _btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
60 echo "$balance_pid" >>$seqres.full
62 echo -n "Start remount worker: " >>$seqres.full
63 _btrfs_stress_remount_compress $SCRATCH_MNT >/dev/null 2>&1 &
65 echo "$remount_pid" >>$seqres.full
67 echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
69 kill $balance_pid $remount_pid
71 # wait for the balance and remount loop to finish
72 while ps aux | grep "balance start" | grep -qv grep; do
75 while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
79 echo "Scrub the filesystem" >>$seqres.full
80 $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
82 echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
86 # we called _require_scratch_nocheck instead of _require_scratch
87 # do check after test for each profile config
91 echo "Silence is golden"
92 for t in "${_btrfs_profile_configs[@]}"; do