All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15 v2] xfstests: new btrfs stress test cases
@ 2014-08-28 13:47 Eryu Guan
  2014-08-28 13:47 ` [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously Eryu Guan
                   ` (15 more replies)
  0 siblings, 16 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

This patchset add new stress test cases for btrfs by running two
different btrfs operations simultaneously under fsstress to ensure
btrfs doesn't hang or oops in such situations. btrfs scrub and
btrfs check will be run after each test.

The test matrix is the combination of 6 btrfs operations:

	balance
	create/mount/umount/delete subvolume
	replace device
	scrub
	defrag
	remount with different compress algorithms
	
Short descriptions:

	059: balance-subvolume
	060: balance-scrub
	061: balance-defrag
	062: balance-remount
	063: balance-replace
	064: subvolume-replace
	065: subvolume-scrub
	066: subvolume-defrag
	067: subvolume-remount
	068: replace-scrub
	069: replace-defrag
	070: replace-remount
	071: scrub-defrag
	072: scrub-remount
	073: defrag-remount

Some issues I've seen:

1. subvolume cannot be mounted with selinux context, so you may see
   such logs in dmesg

   SELinux: mount invalid.  Same superblock, different security settings for (dev dm-8, type btrfs)

   I've reported the bug to btrfs list, see
   [BUG] cannot mount subvolume with selinux context

2. btrfs replace operation always returns ENOENT if balance is running
   So in 063.full you'll see

   ERROR: ioctl(DEV_REPLACE_START) failed on "/mnt/testarea/scratch": No such file or directory, no error

   Not sure if it's btrfs bug, at least I think the error code is misleading

3. replace operation hangs the kernel(3.16-rc4+) with fsstress running
   So case 064/068/069/070 will hang


Changes since v1:
- put common operations in common/rc as functions and share them across these tests
- append mkfs options to _scratch_mkfs and _scratch_pool_mkfs instead of updating $MKFS_OPTIONS
- rebase on top of master and re-number starting from btrfs/059

Thanks,
Eryu Guan

Eryu Guan (15):
  btrfs: new test to run btrfs balance and subvolume test simultaneously
  btrfs: new test to run btrfs balance and scrub simltaneously
  btrfs: new test to run btrfs balance and defrag operations simultaneously
  btrfs: new case to run btrfs balance and remount with different compress algorithms
  btrfs: new case to run btrfs balance and device replace simultaneously
  btrfs: new case to run btrfs subvolume create/delete operations and device replace simultaneously
  btrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously
  btrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously
  btrfs: new case to run subvolume create/delete and remount with different compress algorithms
  btrfs: new case to run device replace and scrub operations simultaneously
  btrfs: new case to run device replace and defrag operations simultaneously
  btrfs: new case to run device replace and remount with different compress algorithms simultaneously
  btrfs: new case to run btrfs scrub and defrag operations simultaneously
  btrfs: new case to run btrfs scrub and remount with different compress algorithms simultaneously
  btrfs: new case to run defrag and remount with different compress algorithms simultaneously

 common/rc           | 115 +++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/059     | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/059.out |   2 +
 tests/btrfs/060     | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/060.out |   2 +
 tests/btrfs/061     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/061.out |   2 +
 tests/btrfs/062     | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/062.out |   2 +
 tests/btrfs/063     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/063.out |   2 +
 tests/btrfs/064     | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/064.out |   2 +
 tests/btrfs/065     | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/065.out |   2 +
 tests/btrfs/066     | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/066.out |   2 +
 tests/btrfs/067     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/067.out |   2 +
 tests/btrfs/068     | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/068.out |   2 +
 tests/btrfs/069     | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/069.out |   2 +
 tests/btrfs/070     | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/070.out |   2 +
 tests/btrfs/071     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/071.out |   2 +
 tests/btrfs/072     | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/072.out |   2 +
 tests/btrfs/073     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/073.out |   2 +
 tests/btrfs/group   |  15 ++++++
 32 files changed, 2109 insertions(+)
 create mode 100755 tests/btrfs/059
 create mode 100644 tests/btrfs/059.out
 create mode 100755 tests/btrfs/060
 create mode 100644 tests/btrfs/060.out
 create mode 100755 tests/btrfs/061
 create mode 100644 tests/btrfs/061.out
 create mode 100755 tests/btrfs/062
 create mode 100644 tests/btrfs/062.out
 create mode 100755 tests/btrfs/063
 create mode 100644 tests/btrfs/063.out
 create mode 100755 tests/btrfs/064
 create mode 100644 tests/btrfs/064.out
 create mode 100755 tests/btrfs/065
 create mode 100644 tests/btrfs/065.out
 create mode 100755 tests/btrfs/066
 create mode 100644 tests/btrfs/066.out
 create mode 100755 tests/btrfs/067
 create mode 100644 tests/btrfs/067.out
 create mode 100755 tests/btrfs/068
 create mode 100644 tests/btrfs/068.out
 create mode 100755 tests/btrfs/069
 create mode 100644 tests/btrfs/069.out
 create mode 100755 tests/btrfs/070
 create mode 100644 tests/btrfs/070.out
 create mode 100755 tests/btrfs/071
 create mode 100644 tests/btrfs/071.out
 create mode 100755 tests/btrfs/072
 create mode 100644 tests/btrfs/072.out
 create mode 100755 tests/btrfs/073
 create mode 100644 tests/btrfs/073.out

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-09-08 10:01   ` Dave Chinner
  2014-08-28 13:47 ` [PATCH 02/15 v2] btrfs: new test to run btrfs balance and scrub simultaneously Eryu Guan
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs balance and subvolume create/mount/umount/delete simultaneously,
with fsstress running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common/rc           |  24 ++++++++++
 tests/btrfs/059     | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/059.out |   2 +
 tests/btrfs/group   |   1 +
 4 files changed, 156 insertions(+)
 create mode 100755 tests/btrfs/059
 create mode 100644 tests/btrfs/059.out

diff --git a/common/rc b/common/rc
index 16da898..c1a7b9e 100644
--- a/common/rc
+++ b/common/rc
@@ -2375,6 +2375,30 @@ _get_free_inode()
 	echo $nr_inode
 }
 
+_btrfs_stress_balance()
+{
+	local btrfs_mnt=$1
+	while true; do
+		$BTRFS_UTIL_PROG balance start $btrfs_mnt
+	done
+}
+
+_btrfs_stress_subvolume()
+{
+	local btrfs_dev=$1
+	local btrfs_mnt=$2
+	local subvol_name=$3
+	local subvol_mnt=$4
+
+	mkdir -p $subvol_mnt
+	while true; do
+		$BTRFS_UTIL_PROG subvolume create $btrfs_mnt/$subvol_name
+		$MOUNT_PROG -o subvol=$subvol_name $btrfs_dev $subvol_mnt
+		$UMOUNT_PROG $subvol_mnt
+		$BTRFS_UTIL_PROG subvolume delete $btrfs_mnt/$subvol_name
+	done
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
diff --git a/tests/btrfs/059 b/tests/btrfs/059
new file mode 100755
index 0000000..817facb
--- /dev/null
+++ b/tests/btrfs/059
@@ -0,0 +1,129 @@
+#! /bin/bash
+# FSQA Test No. btrfs/059
+#
+# Run btrfs balance and subvolume create/mount/umount/delete simultaneously,
+# with fsstress running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local subvol_mnt=$tmp.mnt
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed" | tee -a $seqres.full
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start balance worker: " >>$seqres.full
+	_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
+	balance_pid=$!
+	echo "$balance_pid" >>$seqres.full
+
+	echo -n "Start subvolume worker: " >>$seqres.full
+	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt >/dev/null 2>&1 &
+	subvol_pid=$!
+	echo "$subvol_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+
+	kill $balance_pid $subvol_pid
+	wait
+	# wait for the balance operation to finish
+	while ps aux | grep "balance start" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	# in case the subvolume is still mounted
+	$UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/059.out b/tests/btrfs/059.out
new file mode 100644
index 0000000..36ebeea
--- /dev/null
+++ b/tests/btrfs/059.out
@@ -0,0 +1,2 @@
+QA output created by 059
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 3fa9778..c66c42c 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -61,3 +61,4 @@
 056 auto quick
 057 auto quick
 058 auto quick
+059 auto balance subvol
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 02/15 v2] btrfs: new test to run btrfs balance and scrub simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
  2014-08-28 13:47 ` [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-09-08 10:04   ` Dave Chinner
  2014-08-28 13:47 ` [PATCH 03/15 v2] btrfs: new test to run btrfs balance and defrag operations simultaneously Eryu Guan
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs balance and scrub operations simultaneously with fsstress
running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common/rc           |   8 ++++
 tests/btrfs/060     | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/060.out |   2 +
 tests/btrfs/group   |   1 +
 4 files changed, 139 insertions(+)
 create mode 100755 tests/btrfs/060
 create mode 100644 tests/btrfs/060.out

diff --git a/common/rc b/common/rc
index f55aa0d..9df331d 100644
--- a/common/rc
+++ b/common/rc
@@ -2398,6 +2398,14 @@ _btrfs_stress_subvolume()
 	done
 }
 
+_btrfs_stress_scrub()
+{
+	local btrfs_mnt=$1
+	while true; do
+		$BTRFS_UTIL_PROG scrub start -B $btrfs_mnt
+	done
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
diff --git a/tests/btrfs/060 b/tests/btrfs/060
new file mode 100755
index 0000000..a2365fa
--- /dev/null
+++ b/tests/btrfs/060
@@ -0,0 +1,128 @@
+#! /bin/bash
+# FSQA Test No. btrfs/060
+#
+# Run btrfs balance and scrub operations simultaneously with fsstress
+# running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start balance worker: " >>$seqres.full
+	_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
+	balance_pid=$!
+	echo "$balance_pid" >>$seqres.full
+
+	echo -n "Start scrub worker: " >>$seqres.full
+	_btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
+	scrub_pid=$!
+	echo "$scrub_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $balance_pid $scrub_pid
+	wait
+	# wait for the balance and scrub operations to finish
+	while ps aux | grep "balance start" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "scrub start" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/060.out b/tests/btrfs/060.out
new file mode 100644
index 0000000..8ffce4d
--- /dev/null
+++ b/tests/btrfs/060.out
@@ -0,0 +1,2 @@
+QA output created by 060
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index c66c42c..1c60c8f 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -62,3 +62,4 @@
 057 auto quick
 058 auto quick
 059 auto balance subvol
+060 auto balance scrub
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/15 v2] btrfs: new test to run btrfs balance and defrag operations simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
  2014-08-28 13:47 ` [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously Eryu Guan
  2014-08-28 13:47 ` [PATCH 02/15 v2] btrfs: new test to run btrfs balance and scrub simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 04/15 v2] btrfs: new case to run btrfs balance and remount with different compress algorithms Eryu Guan
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs balance and defrag operations simultaneously with fsstress
running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common/rc           |  18 ++++++++
 tests/btrfs/061     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/061.out |   2 +
 tests/btrfs/group   |   1 +
 4 files changed, 151 insertions(+)
 create mode 100755 tests/btrfs/061
 create mode 100644 tests/btrfs/061.out

diff --git a/common/rc b/common/rc
index 9df331d..b0f5064 100644
--- a/common/rc
+++ b/common/rc
@@ -2406,6 +2406,24 @@ _btrfs_stress_scrub()
 	done
 }
 
+_btrfs_stress_defrag()
+{
+	local btrfs_mnt=$1
+	local compress=$2
+
+	while true; do
+		if [ "$compress" == "nocompress" ]; then
+			find $btrfs_mnt \( -type f -o -type d \) -exec \
+			$BTRFS_UTIL_PROG filesystem defrag {} \;
+		else
+			find $btrfs_mnt \( -type f -o -type d \) -exec \
+			$BTRFS_UTIL_PROG filesystem defrag -clzo {} \;
+			find $btrfs_mnt \( -type f -o -type d \) -exec \
+			$BTRFS_UTIL_PROG filesystem defrag -czlib {} \;
+		fi
+	done
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
diff --git a/tests/btrfs/061 b/tests/btrfs/061
new file mode 100755
index 0000000..965feed
--- /dev/null
+++ b/tests/btrfs/061
@@ -0,0 +1,130 @@
+#! /bin/bash
+# FSQA Test No. btrfs/061
+#
+# Run btrfs balance and defrag operations simultaneously with fsstress
+# running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local with_compress=$2
+
+	echo "Test $mkfs_opts with $with_compress" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start balance worker: " >>$seqres.full
+	_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
+	balance_pid=$!
+	echo "$balance_pid" >>$seqres.full
+
+	echo -n "Start defrag worker: " >>$seqres.full
+	_btrfs_stress_defrag $SCRATCH_MNT $with_compress >/dev/null 2>&1 &
+	defrag_pid=$!
+	echo "$defrag_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $balance_pid $defrag_pid
+	wait
+	# wait for the balance and defrag operations to finish
+	while ps aux | grep "balance start" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t" nocompress
+	run_test "$t" compress
+done
+
+status=0
+exit
diff --git a/tests/btrfs/061.out b/tests/btrfs/061.out
new file mode 100644
index 0000000..273be9e
--- /dev/null
+++ b/tests/btrfs/061.out
@@ -0,0 +1,2 @@
+QA output created by 061
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 1c60c8f..85d30b3 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -63,3 +63,4 @@
 058 auto quick
 059 auto balance subvol
 060 auto balance scrub
+061 auto balance defrag compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 04/15 v2] btrfs: new case to run btrfs balance and remount with different compress algorithms
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (2 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 03/15 v2] btrfs: new test to run btrfs balance and defrag operations simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-09-08 10:08   ` Dave Chinner
  2014-08-28 13:47 ` [PATCH 05/15 v2] btrfs: new case to run btrfs balance and device replace operations simultaneously Eryu Guan
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs balance and remount with different compress algorithms
simultaneously, with fsstress running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common/rc           |  10 ++++
 tests/btrfs/062     | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/062.out |   2 +
 tests/btrfs/group   |   1 +
 4 files changed, 141 insertions(+)
 create mode 100755 tests/btrfs/062
 create mode 100644 tests/btrfs/062.out

diff --git a/common/rc b/common/rc
index b0f5064..b5fc1c8 100644
--- a/common/rc
+++ b/common/rc
@@ -2424,6 +2424,16 @@ _btrfs_stress_defrag()
 	done
 }
 
+_btrfs_stress_remount()
+{
+	local btrfs_mnt=$1
+	while true; do
+		for algo in no zlib lzo; do
+			$MOUNT_PROG -o remount,compress=$algo $btrfs_mnt
+		done
+	done
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
diff --git a/tests/btrfs/062 b/tests/btrfs/062
new file mode 100755
index 0000000..fbf6d8f
--- /dev/null
+++ b/tests/btrfs/062
@@ -0,0 +1,128 @@
+#! /bin/bash
+# FSQA Test No. btrfs/062
+#
+# Run btrfs balance and remount with different compress algorithms
+# simultaneously, with fsstress running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start balance worker: " >>$seqres.full
+	_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
+	balance_pid=$!
+	echo "$balance_pid" >>$seqres.full
+
+	echo -n "Start remount worker: " >>$seqres.full
+	_btrfs_stress_remount $SCRATCH_MNT >/dev/null 2>&1 &
+	remount_pid=$!
+	echo "$remount_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $balance_pid $remount_pid
+	wait
+	# wait for the balance and remount loop to finish
+	while ps aux | grep "balance start" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/062.out b/tests/btrfs/062.out
new file mode 100644
index 0000000..a1578f4
--- /dev/null
+++ b/tests/btrfs/062.out
@@ -0,0 +1,2 @@
+QA output created by 062
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 85d30b3..7aa9bf3 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -64,3 +64,4 @@
 059 auto balance subvol
 060 auto balance scrub
 061 auto balance defrag compress
+062 auto balance remount compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/15 v2] btrfs: new case to run btrfs balance and device replace operations simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (3 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 04/15 v2] btrfs: new case to run btrfs balance and remount with different compress algorithms Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 06/15 v2] btrfs: new case to run btrfs subvolume create/delete operations and device replace simultaneously Eryu Guan
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs balance and replace operations simultaneously with fsstress
running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common/rc           |  56 ++++++++++++++++++++++
 tests/btrfs/063     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/063.out |   2 +
 tests/btrfs/group   |   1 +
 4 files changed, 189 insertions(+)
 create mode 100755 tests/btrfs/063
 create mode 100644 tests/btrfs/063.out

diff --git a/common/rc b/common/rc
index b5fc1c8..bd86045 100644
--- a/common/rc
+++ b/common/rc
@@ -2066,6 +2066,24 @@ _require_scratch_dev_pool()
 	done
 }
 
+# ensure devices in SCRATCH_DEV_POOL are of the same size
+# must be called after _require_scratch_dev_pool
+_require_scratch_dev_pool_equal_size()
+{
+	local _size
+	local _newsize
+	local _dev
+
+	# SCRATCH_DEV has been set to the first device in SCRATCH_DEV_POOL
+	_size=`_get_device_size $SCRATCH_DEV`
+	for _dev in $SCRATCH_DEV_POOL; do
+		_newsize=`_get_device_size $_dev`
+		if [ $_size -ne $_newsize ]; then
+			_notrun "This test requires devices in SCRATCH_DEV_POOL have the same size"
+		fi
+	done
+}
+
 # We will check if the device is deletable
 _require_deletable_scratch_dev_pool()
 {
@@ -2434,6 +2452,44 @@ _btrfs_stress_remount()
 	done
 }
 
+_btrfs_stress_replace()
+{
+	local btrfs_mnt=$1
+
+	# take the last device as the first free_dev
+	local free_dev="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $NF}'`"
+
+	# dev_pool is devices are currently used by btrfs, except $SCRATCH_DEV
+	# do not replace $SCRATCH_DEV which will be used in _scratch_mount
+	# and _check_scratch_fs etc.
+	local dev_pool=`echo $SCRATCH_DEV_POOL | sed -e "s# *$SCRATCH_DEV *##" \
+			-e "s# *$free_dev *##"`
+
+	# set the first device in dev_pool as the first src_dev to be replaced
+	local src_dev=`echo $dev_pool | $AWK_PROG '{print $1}'`
+
+	echo "dev_pool=$dev_pool"
+	echo "free_dev=$free_dev, src_dev=$src_dev"
+	while true; do
+		echo "Replacing $src_dev with $free_dev"
+		$BTRFS_UTIL_PROG replace start -fB $src_dev $free_dev $btrfs_mnt
+		if [ $? -ne 0 ]; then
+			# don't update src_dev and free_dev if replace failed
+			continue
+		fi
+		dev_pool="$dev_pool $free_dev"
+		dev_pool=`echo $dev_pool | sed -e "s# *$src_dev *##"`
+		free_dev=$src_dev
+		src_dev=`echo $dev_pool | $AWK_PROG '{print $1}'`
+	done
+}
+
+# return device size in kb
+_get_device_size()
+{
+	grep `_short_dev $1` /proc/partitions | awk '{print $3}'
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
diff --git a/tests/btrfs/063 b/tests/btrfs/063
new file mode 100755
index 0000000..e707002
--- /dev/null
+++ b/tests/btrfs/063
@@ -0,0 +1,130 @@
+#! /bin/bash
+# FSQA Test No. btrfs/063
+#
+# Run btrfs balance and replace operations simultaneously with fsstress
+# running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 5
+_require_scratch_dev_pool_equal_size
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+#	"-m raid5 -d raid5"	# raid5 does not support replace operation yet
+#	"-m raid6 -d raid6"	# raid6 does not support replace operation yet
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local saved_scratch_dev_pool=$SCRATCH_DEV_POOL
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# remove the last device from the SCRATCH_DEV_POOL list so
+	# _scratch_pool_mkfs won't use all devices in pool
+	local last_dev="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $NF}'`"
+	SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | sed -e "s# *$last_dev *##"`
+	_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+	SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start balance worker: " >>$seqres.full
+	_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
+	balance_pid=$!
+	echo "$balance_pid" >>$seqres.full
+
+	echo -n "Start replace worker: " >>$seqres.full
+	_btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
+	replace_pid=$!
+	echo "$replace_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $balance_pid $replace_pid
+	wait
+	# wait for the balance and replace operations to finish
+	while ps aux | grep "balance start" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "replace start" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/063.out b/tests/btrfs/063.out
new file mode 100644
index 0000000..de35fc5
--- /dev/null
+++ b/tests/btrfs/063.out
@@ -0,0 +1,2 @@
+QA output created by 063
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 7aa9bf3..e234bc2 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -65,3 +65,4 @@
 060 auto balance scrub
 061 auto balance defrag compress
 062 auto balance remount compress
+063 auto balance replace
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/15 v2] btrfs: new case to run btrfs subvolume create/delete operations and device replace simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (4 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 05/15 v2] btrfs: new case to run btrfs balance and device replace operations simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 07/15 v2] btrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously Eryu Guan
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs subvolume create/mount/umount/delete and device replace
operation simultaneously, with fsstress running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/064     | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/064.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 134 insertions(+)
 create mode 100755 tests/btrfs/064
 create mode 100644 tests/btrfs/064.out

diff --git a/tests/btrfs/064 b/tests/btrfs/064
new file mode 100755
index 0000000..f73a1ea
--- /dev/null
+++ b/tests/btrfs/064
@@ -0,0 +1,131 @@
+#! /bin/bash
+# FSQA Test No. btrfs/064
+#
+# Run btrfs subvolume create/mount/umount/delete and device replace
+# operation simultaneously, with fsstress running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 5
+_require_scratch_dev_pool_equal_size
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+#	"-m raid5 -d raid5"	# raid5 does not support replace operation yet
+#	"-m raid6 -d raid6"	# raid6 does not support replace operation yet
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local saved_scratch_dev_pool=$SCRATCH_DEV_POOL
+	local subvol_mnt=$tmp.mnt
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# remove the last device from the SCRATCH_DEV_POOL list so
+	# _scratch_pool_mkfs won't use all devices in pool
+	local last_dev="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $NF}'`"
+	SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | sed -e "s# *$last_dev *##"`
+	_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+	SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start subvolume worker: " >>$seqres.full
+	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt >/dev/null 2>&1 &
+	subvol_pid=$!
+	echo "$subvol_pid" >>$seqres.full
+
+	echo -n "Start replace worker: " >>$seqres.full
+	_btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
+	replace_pid=$!
+	echo "$replace_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+
+	kill $subvol_pid $replace_pid
+	wait
+	# wait for the replace operation to finish
+	while ps aux | grep "replace start" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	# in case the subvolume is still mounted
+	$UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/064.out b/tests/btrfs/064.out
new file mode 100644
index 0000000..d907654
--- /dev/null
+++ b/tests/btrfs/064.out
@@ -0,0 +1,2 @@
+QA output created by 064
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index e234bc2..a214920 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -66,3 +66,4 @@
 061 auto balance defrag compress
 062 auto balance remount compress
 063 auto balance replace
+064 auto subvol replace
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/15 v2] btrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (5 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 06/15 v2] btrfs: new case to run btrfs subvolume create/delete operations and device replace simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 08/15 v2] btrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously Eryu Guan
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs subvolume create/mount/umount/delete and btrfs scrub
operation simultaneously, with fsstress running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/065     | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/065.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 132 insertions(+)
 create mode 100755 tests/btrfs/065
 create mode 100644 tests/btrfs/065.out

diff --git a/tests/btrfs/065 b/tests/btrfs/065
new file mode 100755
index 0000000..0135510
--- /dev/null
+++ b/tests/btrfs/065
@@ -0,0 +1,129 @@
+#! /bin/bash
+# FSQA Test No. btrfs/065
+#
+# Run btrfs subvolume create/mount/umount/delete and btrfs scrub
+# operation simultaneously, with fsstress running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local subvol_mnt=$tmp.mnt
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start subvolume worker: " >>$seqres.full
+	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt >/dev/null 2>&1 &
+	subvol_pid=$!
+	echo "$subvol_pid" >>$seqres.full
+
+	echo -n "Start scrub worker: " >>$seqres.full
+	_btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
+	scrub_pid=$!
+	echo "$scrub_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+
+	kill $subvol_pid $scrub_pid
+	wait
+	# wait for the scrub operation to finish
+	while ps aux | grep "scrub start" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	# in case the subvolume is still mounted
+	$UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/065.out b/tests/btrfs/065.out
new file mode 100644
index 0000000..94476cd
--- /dev/null
+++ b/tests/btrfs/065.out
@@ -0,0 +1,2 @@
+QA output created by 065
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index a214920..4685970 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -67,3 +67,4 @@
 062 auto balance remount compress
 063 auto balance replace
 064 auto subvol replace
+065 auto subvol scrub
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/15 v2] btrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (6 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 07/15 v2] btrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 09/15 v2] btrfs: new case to run subvolume create/delete and remount with defferent compress algorithms Eryu Guan
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs subvolume create/mount/umount/delete and btrfs defrag
operations simultaneously, with fsstress running in backgound.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/066     | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/066.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 134 insertions(+)
 create mode 100755 tests/btrfs/066
 create mode 100644 tests/btrfs/066.out

diff --git a/tests/btrfs/066 b/tests/btrfs/066
new file mode 100755
index 0000000..847ba4a
--- /dev/null
+++ b/tests/btrfs/066
@@ -0,0 +1,131 @@
+#! /bin/bash
+# FSQA Test No. btrfs/066
+#
+# Run btrfs subvolume create/mount/umount/delete and btrfs defrag
+# operation simultaneously, with fsstress running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local with_compress=$2
+	local subvol_mnt=$tmp.mnt
+
+	echo "Test $mkfs_opts with $with_compress" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start subvolume worker: " >>$seqres.full
+	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt >/dev/null 2>&1 &
+	subvol_pid=$!
+	echo "$subvol_pid" >>$seqres.full
+
+	echo -n "Start defrag worker: " >>$seqres.full
+	_btrfs_stress_defrag $SCRATCH_MNT $with_compress >/dev/null 2>&1 &
+	defrag_pid=$!
+	echo "$defrag_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+
+	kill $subvol_pid $defrag_pid
+	wait
+	# wait for btrfs defrag process to exit, otherwise it will block umount
+	while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	# in case the subvolume is still mounted
+	$UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t" nocompress
+	run_test "$t" compress
+done
+
+status=0
+exit
diff --git a/tests/btrfs/066.out b/tests/btrfs/066.out
new file mode 100644
index 0000000..b60cc24
--- /dev/null
+++ b/tests/btrfs/066.out
@@ -0,0 +1,2 @@
+QA output created by 066
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 4685970..bbfbb6a 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -68,3 +68,4 @@
 063 auto balance replace
 064 auto subvol replace
 065 auto subvol scrub
+066 auto subvol defrag compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/15 v2] btrfs: new case to run subvolume create/delete and remount with defferent compress algorithms
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (7 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 08/15 v2] btrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 10/15 v2] btrfs: new case to run device replace and scrub operations simultaneously Eryu Guan
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs subvolume create/mount/umount/delete and remount with
different compress algorithms simultaneously, with fsstress running in
background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/067     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/067.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 133 insertions(+)
 create mode 100755 tests/btrfs/067
 create mode 100644 tests/btrfs/067.out

diff --git a/tests/btrfs/067 b/tests/btrfs/067
new file mode 100755
index 0000000..2adff7b
--- /dev/null
+++ b/tests/btrfs/067
@@ -0,0 +1,130 @@
+#! /bin/bash
+# FSQA Test No. btrfs/067
+#
+# Run btrfs subvolume create/mount/umount/delete and remount with
+# different compress algorithms simultaneously, with fsstress running
+# in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local subvol_mnt=$tmp.mnt
+
+	echo "Test $mkfs_opts with $with_compress" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start subvolume worker: " >>$seqres.full
+	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt >/dev/null 2>&1 &
+	subvol_pid=$!
+	echo "$subvol_pid" >>$seqres.full
+
+	echo -n "Start remount worker: " >>$seqres.full
+	_btrfs_stress_remount $SCRATCH_MNT >/dev/null 2>&1 &
+	remount_pid=$!
+	echo "$remount_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+
+	kill $subvol_pid $remount_pid
+	wait
+	# wait for the remount loop process to finish
+	while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	# in case the subvolume is still mounted
+	$UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/067.out b/tests/btrfs/067.out
new file mode 100644
index 0000000..daa1545
--- /dev/null
+++ b/tests/btrfs/067.out
@@ -0,0 +1,2 @@
+QA output created by 067
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index bbfbb6a..d515ff5 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -69,3 +69,4 @@
 064 auto subvol replace
 065 auto subvol scrub
 066 auto subvol defrag compress
+067 auto subvol remount compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/15 v2] btrfs: new case to run device replace and scrub operations simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (8 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 09/15 v2] btrfs: new case to run subvolume create/delete and remount with defferent compress algorithms Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 11/15 v2] btrfs: new case to run device replace and defrag " Eryu Guan
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs replace operations and scrub simultaneously with fsstress
running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/068     | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/068.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 134 insertions(+)
 create mode 100755 tests/btrfs/068
 create mode 100644 tests/btrfs/068.out

diff --git a/tests/btrfs/068 b/tests/btrfs/068
new file mode 100755
index 0000000..651af5d
--- /dev/null
+++ b/tests/btrfs/068
@@ -0,0 +1,131 @@
+#! /bin/bash
+# FSQA Test No. btrfs/068
+#
+# Run btrfs replace operations and scrub simultaneously with fsstress
+# running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 5
+_require_scratch_dev_pool_equal_size
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+#	"-m raid5 -d raid5"	# raid5 does not support replace operation yet
+#	"-m raid6 -d raid6"	# raid6 does not support replace operation yet
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local saved_scratch_dev_pool=$SCRATCH_DEV_POOL
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# remove the last device from the SCRATCH_DEV_POOL list so
+	# _scratch_pool_mkfs won't use all devices in pool
+	local last_dev="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $NF}'`"
+	SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | sed -e "s# *$last_dev *##"`
+	_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+	SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start replace worker: " >>$seqres.full
+	_btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
+	replace_pid=$!
+	echo "$replace_pid" >>$seqres.full
+
+	echo -n "Start scrub worker: " >>$seqres.full
+	_btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
+	scrub_pid=$!
+	echo "$scrub_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $replace_pid $scrub_pid
+	wait
+
+	# wait for the scrub and replace operations to finish
+	while ps aux | grep "scrub start" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "replace start" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/068.out b/tests/btrfs/068.out
new file mode 100644
index 0000000..d10c9bd
--- /dev/null
+++ b/tests/btrfs/068.out
@@ -0,0 +1,2 @@
+QA output created by 068
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index d515ff5..1e83505 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -70,3 +70,4 @@
 065 auto subvol scrub
 066 auto subvol defrag compress
 067 auto subvol remount compress
+068 auto replace scrub
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 11/15 v2] btrfs: new case to run device replace and defrag operations simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (9 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 10/15 v2] btrfs: new case to run device replace and scrub operations simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 12/15 v2] btrfs: new case to run device replace and remount with different compress algorithms simultaneously Eryu Guan
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs replace operations and defrag simultaneously with fsstress
running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/069     | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/069.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 136 insertions(+)
 create mode 100755 tests/btrfs/069
 create mode 100644 tests/btrfs/069.out

diff --git a/tests/btrfs/069 b/tests/btrfs/069
new file mode 100755
index 0000000..daaf062
--- /dev/null
+++ b/tests/btrfs/069
@@ -0,0 +1,133 @@
+#! /bin/bash
+# FSQA Test No. btrfs/069
+#
+# Run btrfs replace operations and defrag simultaneously with fsstress
+# running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 5
+_require_scratch_dev_pool_equal_size
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+#	"-m raid5 -d raid5"	# raid5 does not support replace operation yet
+#	"-m raid6 -d raid6"	# raid6 does not support replace operation yet
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local with_compress=$2
+	local saved_scratch_dev_pool=$SCRATCH_DEV_POOL
+
+	echo "Test $mkfs_opts with $with_compress" >>$seqres.full
+
+	# remove the last device from the SCRATCH_DEV_POOL list so
+	# _scratch_pool_mkfs won't use all devices in pool
+	local last_dev="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $NF}'`"
+	SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | sed -e "s# *$last_dev *##"`
+	_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+	SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start replace worker: " >>$seqres.full
+	_btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
+	replace_pid=$!
+	echo "$replace_pid" >>$seqres.full
+
+	echo -n "Start defrag worker: " >>$seqres.full
+	_btrfs_stress_defrag $SCRATCH_MNT $with_compress >/dev/null 2>&1 &
+	defrag_pid=$!
+	echo "$defrag_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $replace_pid $defrag_pid
+	wait
+
+	# wait for the defrag and replace operations to finish
+	while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "replace start" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t" nocompress
+	run_test "$t" compress
+done
+
+status=0
+exit
diff --git a/tests/btrfs/069.out b/tests/btrfs/069.out
new file mode 100644
index 0000000..532a929
--- /dev/null
+++ b/tests/btrfs/069.out
@@ -0,0 +1,2 @@
+QA output created by 069
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 1e83505..53f5f4b 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -71,3 +71,4 @@
 066 auto subvol defrag compress
 067 auto subvol remount compress
 068 auto replace scrub
+069 auto replace defrag compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 12/15 v2] btrfs: new case to run device replace and remount with different compress algorithms simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (10 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 11/15 v2] btrfs: new case to run device replace and defrag " Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 13/15 v2] btrfs: new case to run btrfs scrub and defrag operations simultaneously Eryu Guan
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs replace operations and remount with different compress
algorithms simultaneously with fsstress running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/070     | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/070.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 134 insertions(+)
 create mode 100755 tests/btrfs/070
 create mode 100644 tests/btrfs/070.out

diff --git a/tests/btrfs/070 b/tests/btrfs/070
new file mode 100755
index 0000000..315d84f
--- /dev/null
+++ b/tests/btrfs/070
@@ -0,0 +1,131 @@
+#! /bin/bash
+# FSQA Test No. btrfs/070
+#
+# Run btrfs replace operations and remount with different compress
+# algorithms simultaneously with fsstress running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 5
+_require_scratch_dev_pool_equal_size
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+#	"-m raid5 -d raid5"	# raid5 does not support replace operation yet
+#	"-m raid6 -d raid6"	# raid6 does not support replace operation yet
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local saved_scratch_dev_pool=$SCRATCH_DEV_POOL
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# remove the last device from the SCRATCH_DEV_POOL list so
+	# _scratch_pool_mkfs won't use all devices in pool
+	local last_dev="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $NF}'`"
+	SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | sed -e "s# *$last_dev *##"`
+	_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+	SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start replace worker: " >>$seqres.full
+	_btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
+	replace_pid=$!
+	echo "$replace_pid" >>$seqres.full
+
+	echo -n "Start remount worker: " >>$seqres.full
+	_btrfs_stress_remount $SCRATCH_MNT >/dev/null 2>&1 &
+	remount_pid=$!
+	echo "$remount_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $replace_pid $remount_pid
+	wait
+
+	# wait for the remount and replace operations to finish
+	while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/070.out b/tests/btrfs/070.out
new file mode 100644
index 0000000..8940c5d
--- /dev/null
+++ b/tests/btrfs/070.out
@@ -0,0 +1,2 @@
+QA output created by 070
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 53f5f4b..f68370d 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -72,3 +72,4 @@
 067 auto subvol remount compress
 068 auto replace scrub
 069 auto replace defrag compress
+070 auto replace remount compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 13/15 v2] btrfs: new case to run btrfs scrub and defrag operations simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (11 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 12/15 v2] btrfs: new case to run device replace and remount with different compress algorithms simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 14/15 v2] btrfs: new case to run btrfs scrub and remount with different compress algorithms simultaneously Eryu Guan
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs scrub and defrag operations simultaneously with fsstress
running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/071     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/071.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 133 insertions(+)
 create mode 100755 tests/btrfs/071
 create mode 100644 tests/btrfs/071.out

diff --git a/tests/btrfs/071 b/tests/btrfs/071
new file mode 100755
index 0000000..c09c1cc
--- /dev/null
+++ b/tests/btrfs/071
@@ -0,0 +1,130 @@
+#! /bin/bash
+# FSQA Test No. btrfs/071
+#
+# Run btrfs scrub and defrag operations simultaneously with fsstress
+# running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local with_compress=$2
+
+	echo "Test $mkfs_opts with $with_compress" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start scrub worker: " >>$seqres.full
+	_btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
+	scrub_pid=$!
+	echo "$scrub_pid" >>$seqres.full
+
+	echo -n "Start defrag worker: " >>$seqres.full
+	_btrfs_stress_defrag $SCRATCH_MNT $with_compress >/dev/null 2>&1 &
+	defrag_pid=$!
+	echo "$defrag_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $scrub_pid $defrag_pid
+	wait
+	# wait for the scrub and defrag operations to finish
+	while ps aux | grep "scrub start" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t" nocompress
+	run_test "$t" compress
+done
+
+status=0
+exit
diff --git a/tests/btrfs/071.out b/tests/btrfs/071.out
new file mode 100644
index 0000000..9a9ef40
--- /dev/null
+++ b/tests/btrfs/071.out
@@ -0,0 +1,2 @@
+QA output created by 071
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index f68370d..5377acf 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -73,3 +73,4 @@
 068 auto replace scrub
 069 auto replace defrag compress
 070 auto replace remount compress
+071 auto scrub defrag compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 14/15 v2] btrfs: new case to run btrfs scrub and remount with different compress algorithms simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (12 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 13/15 v2] btrfs: new case to run btrfs scrub and defrag operations simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-08-28 13:47 ` [PATCH 15/15 v2] btrfs: new case to run defrag " Eryu Guan
  2014-09-08  9:54 ` [PATCH 00/15 v2] xfstests: new btrfs stress test cases Dave Chinner
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs scrub and remount with different compress algorithms
simultaneously with fsstress running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/072     | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/072.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 131 insertions(+)
 create mode 100755 tests/btrfs/072
 create mode 100644 tests/btrfs/072.out

diff --git a/tests/btrfs/072 b/tests/btrfs/072
new file mode 100755
index 0000000..7f86aa1
--- /dev/null
+++ b/tests/btrfs/072
@@ -0,0 +1,128 @@
+#! /bin/bash
+# FSQA Test No. btrfs/072
+#
+# Run btrfs scrub and remount with different compress algorithms
+# simultaneously with fsstress running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+
+	echo "Test $mkfs_opts" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start scrub worker: " >>$seqres.full
+	_btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
+	scrub_pid=$!
+	echo "$scrub_pid" >>$seqres.full
+
+	echo -n "Start remount worker: " >>$seqres.full
+	_btrfs_stress_remount $SCRATCH_MNT >/dev/null 2>&1 &
+	remount_pid=$!
+	echo "$remount_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $scrub_pid $remount_pid
+	wait
+	# wait for the scrub and remount operations to finish
+	while ps aux | grep "scrub start" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t"
+done
+
+status=0
+exit
diff --git a/tests/btrfs/072.out b/tests/btrfs/072.out
new file mode 100644
index 0000000..590bbc6
--- /dev/null
+++ b/tests/btrfs/072.out
@@ -0,0 +1,2 @@
+QA output created by 072
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 5377acf..e631d5b 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -74,3 +74,4 @@
 069 auto replace defrag compress
 070 auto replace remount compress
 071 auto scrub defrag compress
+072 auto scrub remount compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 15/15 v2] btrfs: new case to run defrag and remount with different compress algorithms simultaneously
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (13 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 14/15 v2] btrfs: new case to run btrfs scrub and remount with different compress algorithms simultaneously Eryu Guan
@ 2014-08-28 13:47 ` Eryu Guan
  2014-09-08  9:54 ` [PATCH 00/15 v2] xfstests: new btrfs stress test cases Dave Chinner
  15 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-08-28 13:47 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Eryu Guan

Run btrfs defrag operations and remount with different compress
algorithms simultaneously with fsstress running in background.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/btrfs/073     | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/073.out |   2 +
 tests/btrfs/group   |   1 +
 3 files changed, 133 insertions(+)
 create mode 100755 tests/btrfs/073
 create mode 100644 tests/btrfs/073.out

diff --git a/tests/btrfs/073 b/tests/btrfs/073
new file mode 100755
index 0000000..c0d464a
--- /dev/null
+++ b/tests/btrfs/073
@@ -0,0 +1,130 @@
+#! /bin/bash
+# FSQA Test No. btrfs/073
+#
+# Run btrfs defrag operations and remount with different compress algorithms
+# simultaneously with fsstress running in background.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_scratch_dev_pool 4
+
+rm -f $seqres.full
+
+# test case array
+tcs=(
+	"-m single -d single"
+	"-m dup -d single"
+	"-m raid0 -d raid0"
+	"-m raid1 -d raid0"
+	"-m raid1 -d raid1"
+	"-m raid10 -d raid10"
+	"-m raid5 -d raid5"
+	"-m raid6 -d raid6"
+)
+
+run_test()
+{
+	local mkfs_opts=$1
+	local with_compress=$2
+
+	echo "Test $mkfs_opts with $with_compress" >>$seqres.full
+
+	# dup only works on single device
+	if [[ "$mkfs_opts" =~ dup ]]; then
+		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
+	else
+		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+	fi
+	# make sure we created btrfs with desired options
+	if [ $? -ne 0 ]; then
+		echo "mkfs $mkfs_opts failed"
+		return
+	fi
+	_scratch_mount >>$seqres.full 2>&1
+
+	args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+	echo "Run fsstress $args" >>$seqres.full
+	$FSSTRESS_PROG $args >/dev/null 2>&1 &
+	fsstress_pid=$!
+
+	echo -n "Start defrag worker: " >>$seqres.full
+	_btrfs_stress_defrag $SCRATCH_MNT $with_compress >/dev/null 2>&1 &
+	defrag_pid=$!
+	echo "$defrag_pid" >>$seqres.full
+
+	echo -n "Start remount worker: " >>$seqres.full
+	_btrfs_stress_remount $SCRATCH_MNT >/dev/null 2>&1 &
+	remount_pid=$!
+	echo "$remount_pid" >>$seqres.full
+
+	echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
+	wait $fsstress_pid
+	kill $defrag_pid $remount_pid
+	wait
+	# wait for the defrag and remount operations to finish
+	while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
+		sleep 1
+	done
+	while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
+		sleep 1
+	done
+
+	echo "Scrub the filesystem" >>$seqres.full
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	if [ $? -ne 0 ]; then
+		echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
+	fi
+
+	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+echo "Silence is golden"
+for t in "${tcs[@]}"; do
+	run_test "$t" nocompress
+	run_test "$t" compress
+done
+
+status=0
+exit
diff --git a/tests/btrfs/073.out b/tests/btrfs/073.out
new file mode 100644
index 0000000..d107704
--- /dev/null
+++ b/tests/btrfs/073.out
@@ -0,0 +1,2 @@
+QA output created by 073
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index e631d5b..2e3fb6a 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -75,3 +75,4 @@
 070 auto replace remount compress
 071 auto scrub defrag compress
 072 auto scrub remount compress
+073 auto defrag remount compress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 00/15 v2] xfstests: new btrfs stress test cases
  2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
                   ` (14 preceding siblings ...)
  2014-08-28 13:47 ` [PATCH 15/15 v2] btrfs: new case to run defrag " Eryu Guan
@ 2014-09-08  9:54 ` Dave Chinner
  15 siblings, 0 replies; 25+ messages in thread
From: Dave Chinner @ 2014-09-08  9:54 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs

On Thu, Aug 28, 2014 at 09:47:41PM +0800, Eryu Guan wrote:
> This patchset add new stress test cases for btrfs by running two
> different btrfs operations simultaneously under fsstress to ensure
> btrfs doesn't hang or oops in such situations. btrfs scrub and
> btrfs check will be run after each test.
> 
> The test matrix is the combination of 6 btrfs operations:
> 
> 	balance
> 	create/mount/umount/delete subvolume
> 	replace device
> 	scrub
> 	defrag
> 	remount with different compress algorithms
> 	
> Short descriptions:
> 
> 	059: balance-subvolume
> 	060: balance-scrub
> 	061: balance-defrag
> 	062: balance-remount
> 	063: balance-replace
> 	064: subvolume-replace
> 	065: subvolume-scrub
> 	066: subvolume-defrag
> 	067: subvolume-remount
> 	068: replace-scrub
> 	069: replace-defrag
> 	070: replace-remount
> 	071: scrub-defrag
> 	072: scrub-remount
> 	073: defrag-remount

Can I get some reviews for btrfs people for this series, please?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously
  2014-08-28 13:47 ` [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously Eryu Guan
@ 2014-09-08 10:01   ` Dave Chinner
  2014-09-09 11:53     ` Eryu Guan
  2014-09-09 15:41     ` Eric Sandeen
  0 siblings, 2 replies; 25+ messages in thread
From: Dave Chinner @ 2014-09-08 10:01 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs

On Thu, Aug 28, 2014 at 09:47:42PM +0800, Eryu Guan wrote:
> Run btrfs balance and subvolume create/mount/umount/delete simultaneously,
> with fsstress running in background.
> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
>  common/rc           |  24 ++++++++++
>  tests/btrfs/059     | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/059.out |   2 +
>  tests/btrfs/group   |   1 +
>  4 files changed, 156 insertions(+)
>  create mode 100755 tests/btrfs/059
>  create mode 100644 tests/btrfs/059.out
> 
> diff --git a/common/rc b/common/rc
> index 16da898..c1a7b9e 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2375,6 +2375,30 @@ _get_free_inode()
>  	echo $nr_inode
>  }
>  
> +_btrfs_stress_balance()
> +{
> +	local btrfs_mnt=$1
> +	while true; do
> +		$BTRFS_UTIL_PROG balance start $btrfs_mnt
> +	done
> +}
> +
> +_btrfs_stress_subvolume()
> +{
> +	local btrfs_dev=$1
> +	local btrfs_mnt=$2
> +	local subvol_name=$3
> +	local subvol_mnt=$4
> +
> +	mkdir -p $subvol_mnt
> +	while true; do
> +		$BTRFS_UTIL_PROG subvolume create $btrfs_mnt/$subvol_name
> +		$MOUNT_PROG -o subvol=$subvol_name $btrfs_dev $subvol_mnt
> +		$UMOUNT_PROG $subvol_mnt
> +		$BTRFS_UTIL_PROG subvolume delete $btrfs_mnt/$subvol_name
> +	done
> +}
> +

I'm thinking that we need to start separating common/rc in
filesystem specific include files. Not necessary for this series,
but we really need to so using this file as a dumping ground for
shared code rather than for init and config stuff.

> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -fr $tmp.*
> +}

Really dangerous, that. if $tmp is empty, then that will remove
everything under / (i.e. 'cd /; rm -rf .*'). You shouldn't be using
subdirs under $tmp - if you need lots of temporary data for the
test, it should be under $TESTDIR, not on the root filesystem.

> +run_test()
> +{
> +	local mkfs_opts=$1
> +	local subvol_mnt=$tmp.mnt

IOWs, don't do this. Mount stuff under $TESTDIR/$seq.mnt. That's
what the testdir is there for...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 02/15 v2] btrfs: new test to run btrfs balance and scrub simultaneously
  2014-08-28 13:47 ` [PATCH 02/15 v2] btrfs: new test to run btrfs balance and scrub simultaneously Eryu Guan
@ 2014-09-08 10:04   ` Dave Chinner
  2014-09-09 11:55     ` Eryu Guan
  0 siblings, 1 reply; 25+ messages in thread
From: Dave Chinner @ 2014-09-08 10:04 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs

On Thu, Aug 28, 2014 at 09:47:43PM +0800, Eryu Guan wrote:
> Run btrfs balance and scrub operations simultaneously with fsstress
> running in background.
> +run_test()
> +{
> +	local mkfs_opts=$1
> +
> +	echo "Test $mkfs_opts" >>$seqres.full
> +
> +	# dup only works on single device
> +	if [[ "$mkfs_opts" =~ dup ]]; then
> +		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
> +	else
> +		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
> +	fi
> +	# make sure we created btrfs with desired options
> +	if [ $? -ne 0 ]; then
> +		echo "mkfs $mkfs_opts failed"
> +		return
> +	fi
> +	_scratch_mount >>$seqres.full 2>&1

This mkfs/mount code is repeated in all of the first three tests.
Factor, please.

> +	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
> +	_scratch_unmount
> +	_check_scratch_fs

And why, exactly do we need a special btrfs "sync" before unmount?
THose three lines should be just one: _check_scratch_fs

If the test actually requires a special btrfs hack before unmount,
add a comment explaining why that hack is necessary....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 04/15 v2] btrfs: new case to run btrfs balance and remount with different compress algorithms
  2014-08-28 13:47 ` [PATCH 04/15 v2] btrfs: new case to run btrfs balance and remount with different compress algorithms Eryu Guan
@ 2014-09-08 10:08   ` Dave Chinner
  2014-09-09 13:06     ` Eryu Guan
  0 siblings, 1 reply; 25+ messages in thread
From: Dave Chinner @ 2014-09-08 10:08 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs

On Thu, Aug 28, 2014 at 09:47:45PM +0800, Eryu Guan wrote:
> Run btrfs balance and remount with different compress algorithms
> simultaneously, with fsstress running in background.
> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
>  common/rc           |  10 ++++
>  tests/btrfs/062     | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/062.out |   2 +
>  tests/btrfs/group   |   1 +
>  4 files changed, 141 insertions(+)
>  create mode 100755 tests/btrfs/062
>  create mode 100644 tests/btrfs/062.out
> 
> diff --git a/common/rc b/common/rc
> index b0f5064..b5fc1c8 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2424,6 +2424,16 @@ _btrfs_stress_defrag()
>  	done
>  }
>  
> +_btrfs_stress_remount()
> +{
> +	local btrfs_mnt=$1
> +	while true; do
> +		for algo in no zlib lzo; do
> +			$MOUNT_PROG -o remount,compress=$algo $btrfs_mnt
> +		done
> +	done
> +}

This has nothing to do with "stress" - it tries 3
different compression algorithms. What is the purpose of
this (comments, please!), and can you us a more descriptive name?

> +# test case array
> +tcs=(
> +	"-m single -d single"
> +	"-m dup -d single"
> +	"-m raid0 -d raid0"
> +	"-m raid1 -d raid0"
> +	"-m raid1 -d raid1"
> +	"-m raid10 -d raid10"
> +	"-m raid5 -d raid5"
> +	"-m raid6 -d raid6"
> +)

This is pretty common, right? Perhaps this should be a config
variable that can be overridden by the config file configuration?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously
  2014-09-08 10:01   ` Dave Chinner
@ 2014-09-09 11:53     ` Eryu Guan
  2014-09-09 23:53       ` Dave Chinner
  2014-09-09 15:41     ` Eric Sandeen
  1 sibling, 1 reply; 25+ messages in thread
From: Eryu Guan @ 2014-09-09 11:53 UTC (permalink / raw)
  To: Dave Chinner; +Cc: fstests, linux-btrfs

On Mon, Sep 08, 2014 at 08:01:27PM +1000, Dave Chinner wrote:
> On Thu, Aug 28, 2014 at 09:47:42PM +0800, Eryu Guan wrote:
> > Run btrfs balance and subvolume create/mount/umount/delete simultaneously,
> > with fsstress running in background.
> > 
> > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > ---
> >  common/rc           |  24 ++++++++++
> >  tests/btrfs/059     | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/btrfs/059.out |   2 +
> >  tests/btrfs/group   |   1 +
> >  4 files changed, 156 insertions(+)
> >  create mode 100755 tests/btrfs/059
> >  create mode 100644 tests/btrfs/059.out
> > 
> > diff --git a/common/rc b/common/rc
> > index 16da898..c1a7b9e 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -2375,6 +2375,30 @@ _get_free_inode()
> >  	echo $nr_inode
> >  }
> >  
> > +_btrfs_stress_balance()
> > +{
> > +	local btrfs_mnt=$1
> > +	while true; do
> > +		$BTRFS_UTIL_PROG balance start $btrfs_mnt
> > +	done
> > +}
> > +
> > +_btrfs_stress_subvolume()
> > +{
> > +	local btrfs_dev=$1
> > +	local btrfs_mnt=$2
> > +	local subvol_name=$3
> > +	local subvol_mnt=$4
> > +
> > +	mkdir -p $subvol_mnt
> > +	while true; do
> > +		$BTRFS_UTIL_PROG subvolume create $btrfs_mnt/$subvol_name
> > +		$MOUNT_PROG -o subvol=$subvol_name $btrfs_dev $subvol_mnt
> > +		$UMOUNT_PROG $subvol_mnt
> > +		$BTRFS_UTIL_PROG subvolume delete $btrfs_mnt/$subvol_name
> > +	done
> > +}
> > +
> 
> I'm thinking that we need to start separating common/rc in
> filesystem specific include files. Not necessary for this series,
> but we really need to so using this file as a dumping ground for
> shared code rather than for init and config stuff.

Agreed, maybe I can add one more patch as a last patch to sort out all
btrfs shared code to common/btrfs

> 
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -fr $tmp.*
> > +}
> 
> Really dangerous, that. if $tmp is empty, then that will remove
> everything under / (i.e. 'cd /; rm -rf .*'). You shouldn't be using
> subdirs under $tmp - if you need lots of temporary data for the
> test, it should be under $TESTDIR, not on the root filesystem.

Makes much sense! Will change it.

Thanks,
Eryu
> 
> > +run_test()
> > +{
> > +	local mkfs_opts=$1
> > +	local subvol_mnt=$tmp.mnt
> 
> IOWs, don't do this. Mount stuff under $TESTDIR/$seq.mnt. That's
> what the testdir is there for...
> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 02/15 v2] btrfs: new test to run btrfs balance and scrub simultaneously
  2014-09-08 10:04   ` Dave Chinner
@ 2014-09-09 11:55     ` Eryu Guan
  0 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-09-09 11:55 UTC (permalink / raw)
  To: Dave Chinner; +Cc: fstests, linux-btrfs

On Mon, Sep 08, 2014 at 08:04:41PM +1000, Dave Chinner wrote:
> On Thu, Aug 28, 2014 at 09:47:43PM +0800, Eryu Guan wrote:
> > Run btrfs balance and scrub operations simultaneously with fsstress
> > running in background.
> > +run_test()
> > +{
> > +	local mkfs_opts=$1
> > +
> > +	echo "Test $mkfs_opts" >>$seqres.full
> > +
> > +	# dup only works on single device
> > +	if [[ "$mkfs_opts" =~ dup ]]; then
> > +		_scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
> > +	else
> > +		_scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
> > +	fi
> > +	# make sure we created btrfs with desired options
> > +	if [ $? -ne 0 ]; then
> > +		echo "mkfs $mkfs_opts failed"
> > +		return
> > +	fi
> > +	_scratch_mount >>$seqres.full 2>&1
> 
> This mkfs/mount code is repeated in all of the first three tests.
> Factor, please.

OK.

> 
> > +	$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null 2>&1
> > +	_scratch_unmount
> > +	_check_scratch_fs
> 
> And why, exactly do we need a special btrfs "sync" before unmount?
> THose three lines should be just one: _check_scratch_fs
> 
> If the test actually requires a special btrfs hack before unmount,
> add a comment explaining why that hack is necessary....

No special reason here, just want to make sure nothing blocks the
umount, will remove it.

Thanks,
Eryu
> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 04/15 v2] btrfs: new case to run btrfs balance and remount with different compress algorithms
  2014-09-08 10:08   ` Dave Chinner
@ 2014-09-09 13:06     ` Eryu Guan
  0 siblings, 0 replies; 25+ messages in thread
From: Eryu Guan @ 2014-09-09 13:06 UTC (permalink / raw)
  To: Dave Chinner; +Cc: fstests, linux-btrfs

On Mon, Sep 08, 2014 at 08:08:59PM +1000, Dave Chinner wrote:
> On Thu, Aug 28, 2014 at 09:47:45PM +0800, Eryu Guan wrote:
> > Run btrfs balance and remount with different compress algorithms
> > simultaneously, with fsstress running in background.
> > 
> > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > ---
> >  common/rc           |  10 ++++
> >  tests/btrfs/062     | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/btrfs/062.out |   2 +
> >  tests/btrfs/group   |   1 +
> >  4 files changed, 141 insertions(+)
> >  create mode 100755 tests/btrfs/062
> >  create mode 100644 tests/btrfs/062.out
> > 
> > diff --git a/common/rc b/common/rc
> > index b0f5064..b5fc1c8 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -2424,6 +2424,16 @@ _btrfs_stress_defrag()
> >  	done
> >  }
> >  
> > +_btrfs_stress_remount()
> > +{
> > +	local btrfs_mnt=$1
> > +	while true; do
> > +		for algo in no zlib lzo; do
> > +			$MOUNT_PROG -o remount,compress=$algo $btrfs_mnt
> > +		done
> > +	done
> > +}
> 
> This has nothing to do with "stress" - it tries 3
> different compression algorithms. What is the purpose of

Yes, it remount with 3 different compression algorithms, and it keeps
doing this in a loop. With fsstress running at background it may
exercise the compression path and to ensure no deadlock when switching
compression algorithm with constant I/O activity.

> this (comments, please!), and can you us a more descriptive name?

Will try, but I don't think I'm good at this :)

> 
> > +# test case array
> > +tcs=(
> > +	"-m single -d single"
> > +	"-m dup -d single"
> > +	"-m raid0 -d raid0"
> > +	"-m raid1 -d raid0"
> > +	"-m raid1 -d raid1"
> > +	"-m raid10 -d raid10"
> > +	"-m raid5 -d raid5"
> > +	"-m raid6 -d raid6"
> > +)
> 
> This is pretty common, right? Perhaps this should be a config
> variable that can be overridden by the config file configuration?

I'm thinking about adding something like this to common/rc or common/btrfs

_btrfs_get_profile_configs()
{
	# need one argument to tell if device-replace is one of the operations
	# if so, export configs without raid5/raid6, and without "-m dup -d single")

	# export tcs array according to some config variable
	# e.g. BTRFS_PROFILE_CONFIG
	# if the var is set, just export it(and _notrun if the configs are not suitable for the test)
	# if the var is not set, export the default configs
}

And call "_btrfs_get_profile_configs replace" or
"_btrfs_get_profile_configs noreplace" in each test to get the test
array setup.

Any thoughts?

Thanks,
Eryu
> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously
  2014-09-08 10:01   ` Dave Chinner
  2014-09-09 11:53     ` Eryu Guan
@ 2014-09-09 15:41     ` Eric Sandeen
  1 sibling, 0 replies; 25+ messages in thread
From: Eric Sandeen @ 2014-09-09 15:41 UTC (permalink / raw)
  To: Dave Chinner, Eryu Guan; +Cc: fstests, linux-btrfs

On 9/8/14 5:01 AM, Dave Chinner wrote:
> On Thu, Aug 28, 2014 at 09:47:42PM +0800, Eryu Guan wrote:
>> Run btrfs balance and subvolume create/mount/umount/delete simultaneously,
>> with fsstress running in background.
>>
>> Signed-off-by: Eryu Guan <eguan@redhat.com>
>> ---
>>   common/rc           |  24 ++++++++++
>>   tests/btrfs/059     | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   tests/btrfs/059.out |   2 +
>>   tests/btrfs/group   |   1 +
>>   4 files changed, 156 insertions(+)
>>   create mode 100755 tests/btrfs/059
>>   create mode 100644 tests/btrfs/059.out
>>
>> diff --git a/common/rc b/common/rc
>> index 16da898..c1a7b9e 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -2375,6 +2375,30 @@ _get_free_inode()
>>   	echo $nr_inode
>>   }
>>
>> +_btrfs_stress_balance()
>> +{
>> +	local btrfs_mnt=$1
>> +	while true; do
>> +		$BTRFS_UTIL_PROG balance start $btrfs_mnt
>> +	done
>> +}
>> +
>> +_btrfs_stress_subvolume()
>> +{
>> +	local btrfs_dev=$1
>> +	local btrfs_mnt=$2
>> +	local subvol_name=$3
>> +	local subvol_mnt=$4
>> +
>> +	mkdir -p $subvol_mnt
>> +	while true; do
>> +		$BTRFS_UTIL_PROG subvolume create $btrfs_mnt/$subvol_name
>> +		$MOUNT_PROG -o subvol=$subvol_name $btrfs_dev $subvol_mnt
>> +		$UMOUNT_PROG $subvol_mnt
>> +		$BTRFS_UTIL_PROG subvolume delete $btrfs_mnt/$subvol_name
>> +	done
>> +}
>> +
>
> I'm thinking that we need to start separating common/rc in
> filesystem specific include files. Not necessary for this series,
> but we really need to so using this file as a dumping ground for
> shared code rather than for init and config stuff.
>
>> +echo "QA output created by $seq"
>> +
>> +here=`pwd`
>> +tmp=/tmp/$$
>> +status=1
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> +	cd /
>> +	rm -fr $tmp.*
>> +}
>
> Really dangerous, that. if $tmp is empty, then that will remove
> everything under / (i.e. 'cd /; rm -rf .*'). You shouldn't be using
> subdirs under $tmp - if you need lots of temporary data for the
> test, it should be under $TESTDIR, not on the root filesystem.

FWIW, there are a several other tests which do this, at least:

tests/generic/003-1356-    cd /
tests/generic/003:1365:    rm -rf $tmp.*

tests/generic/273-1120-	cd /
tests/generic/273:1126:	rm -rf $tmp.*

tests/generic/320-1280-	cd /
tests/generic/320:1286:	rm -rf $tmp.*

tests/xfs/287-1248-	cd /
tests/xfs/287-1254-	umount $SCRATCH_MNT 2>/dev/null
tests/xfs/287:1287:	rm -rf $tmp.*

Should probably clean those up for safety and to avoid further cut and paste ...

-Eric

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously
  2014-09-09 11:53     ` Eryu Guan
@ 2014-09-09 23:53       ` Dave Chinner
  0 siblings, 0 replies; 25+ messages in thread
From: Dave Chinner @ 2014-09-09 23:53 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs

On Tue, Sep 09, 2014 at 07:53:24PM +0800, Eryu Guan wrote:
> On Mon, Sep 08, 2014 at 08:01:27PM +1000, Dave Chinner wrote:
> > I'm thinking that we need to start separating common/rc in
> > filesystem specific include files. Not necessary for this series,
> > but we really need to so using this file as a dumping ground for
> > shared code rather than for init and config stuff.
> 
> Agreed, maybe I can add one more patch as a last patch to sort out all
> btrfs shared code to common/btrfs

Better to do a separate series where all the different
per-filesystem functionality is moved about rather than do it on an
ad hoc, one filesystem at a time basis. If I find some time in the
next few days, I'll look at doing this.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2014-09-09 23:53 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28 13:47 [PATCH 00/15 v2] xfstests: new btrfs stress test cases Eryu Guan
2014-08-28 13:47 ` [PATCH 01/15 v2] btrfs: new test to run btrfs balance and subvolume test simultaneously Eryu Guan
2014-09-08 10:01   ` Dave Chinner
2014-09-09 11:53     ` Eryu Guan
2014-09-09 23:53       ` Dave Chinner
2014-09-09 15:41     ` Eric Sandeen
2014-08-28 13:47 ` [PATCH 02/15 v2] btrfs: new test to run btrfs balance and scrub simultaneously Eryu Guan
2014-09-08 10:04   ` Dave Chinner
2014-09-09 11:55     ` Eryu Guan
2014-08-28 13:47 ` [PATCH 03/15 v2] btrfs: new test to run btrfs balance and defrag operations simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 04/15 v2] btrfs: new case to run btrfs balance and remount with different compress algorithms Eryu Guan
2014-09-08 10:08   ` Dave Chinner
2014-09-09 13:06     ` Eryu Guan
2014-08-28 13:47 ` [PATCH 05/15 v2] btrfs: new case to run btrfs balance and device replace operations simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 06/15 v2] btrfs: new case to run btrfs subvolume create/delete operations and device replace simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 07/15 v2] btrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 08/15 v2] btrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 09/15 v2] btrfs: new case to run subvolume create/delete and remount with defferent compress algorithms Eryu Guan
2014-08-28 13:47 ` [PATCH 10/15 v2] btrfs: new case to run device replace and scrub operations simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 11/15 v2] btrfs: new case to run device replace and defrag " Eryu Guan
2014-08-28 13:47 ` [PATCH 12/15 v2] btrfs: new case to run device replace and remount with different compress algorithms simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 13/15 v2] btrfs: new case to run btrfs scrub and defrag operations simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 14/15 v2] btrfs: new case to run btrfs scrub and remount with different compress algorithms simultaneously Eryu Guan
2014-08-28 13:47 ` [PATCH 15/15 v2] btrfs: new case to run defrag " Eryu Guan
2014-09-08  9:54 ` [PATCH 00/15 v2] xfstests: new btrfs stress test cases Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.