done
}
+# Kill a background process running _btrfs_stress_replace()
+_btrfs_kill_stress_replace_pid()
+{
+ local replace_pid=$1
+
+ # Ignore if process already died.
+ kill $replace_pid &> /dev/null
+ wait $replace_pid &> /dev/null
+ # Wait for the replace operation to finish.
+ while ps aux | grep "replace start" | grep -qv grep; do
+ sleep 1
+ done
+}
+
# find the right option to force output in bytes, older versions of btrfs-progs
# print that by default, newer print human readable numbers with unit suffix
_btrfs_qgroup_units()
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
wait $fsstress_pid
_btrfs_kill_stress_balance_pid $balance_pid
- kill $replace_pid
- wait $replace_pid
- # wait for the replace operation to finish
- while ps aux | grep "replace start" | grep -qv grep; do
- sleep 1
- done
+ _btrfs_kill_stress_replace_pid $replace_pid
echo "Scrub the filesystem" >>$seqres.full
$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
wait $fsstress_pid
touch $stop_file
- kill $replace_pid
- wait
- # wait for the replace operation to finish
- while ps aux | grep "replace start" | grep -qv grep; do
- sleep 1
- done
+ wait $subvol_pid
+ _btrfs_kill_stress_replace_pid $replace_pid
echo "Scrub the filesystem" >>$seqres.full
$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
wait $fsstress_pid
- kill $replace_pid
- wait $replace_pid
-
- # wait for the replace operation to finish
- while ps aux | grep "replace start" | grep -qv grep; do
- sleep 1
- done
-
_btrfs_kill_stress_scrub_pid $scrub_pid
+ _btrfs_kill_stress_replace_pid $replace_pid
echo "Scrub the filesystem" >>$seqres.full
$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
wait $fsstress_pid
- kill $replace_pid
- wait $replace_pid
-
- # wait for the replace operation to finish
- while ps aux | grep "replace start" | grep -qv grep; do
- sleep 1
- done
-
+ _btrfs_kill_stress_replace_pid $replace_pid
_btrfs_kill_stress_defrag_pid $defrag_pid
echo "Scrub the filesystem" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
wait $fsstress_pid
- kill $replace_pid
- wait $replace_pid
-
- # wait for the replace operationss to finish
- while ps aux | grep "replace start" | grep -qv grep; do
- sleep 1
- done
-
+ _btrfs_kill_stress_replace_pid $replace_pid
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
echo "Scrub the filesystem" >>$seqres.full