diff mbox series

[09/10] btrfs: remove stop file early at _btrfs_stress_subvolume

Message ID 5b91f615f28c14274d9ad96c69cd098c1a9a6f9b.1711558345.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series fstests/btrfs: fixes for tests btrfs/06[0-9] and btrfs/07[0-4] | expand

Commit Message

Filipe Manana March 27, 2024, 5:11 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Instead of having every test case that uses _btrfs_stress_subvolume()
removing the stop file before calling that function, do the file
remove at _btrfs_stress_subvolume(). There's no point in doing it in
every single test case.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 common/btrfs    | 1 +
 tests/btrfs/060 | 2 --
 tests/btrfs/065 | 2 --
 tests/btrfs/066 | 2 --
 tests/btrfs/067 | 2 --
 tests/btrfs/068 | 2 --
 6 files changed, 1 insertion(+), 10 deletions(-)

Comments

Anand Jain March 28, 2024, 9:38 a.m. UTC | #1
On 3/28/24 01:11, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Instead of having every test case that uses _btrfs_stress_subvolume()
> removing the stop file before calling that function, do the file
> remove at _btrfs_stress_subvolume(). There's no point in doing it in
> every single test case.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>


Thanks Anand

> ---
>   common/btrfs    | 1 +
>   tests/btrfs/060 | 2 --
>   tests/btrfs/065 | 2 --
>   tests/btrfs/066 | 2 --
>   tests/btrfs/067 | 2 --
>   tests/btrfs/068 | 2 --
>   6 files changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/common/btrfs b/common/btrfs
> index e19a6ad1..29061c23 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -331,6 +331,7 @@ _btrfs_stress_subvolume()
>   	local subvol_mnt=$4
>   	local stop_file=$5
>   
> +	rm -f $stop_file
>   	mkdir -p $subvol_mnt
>   	while [ ! -e $stop_file ]; do
>   		$BTRFS_UTIL_PROG subvolume create $btrfs_mnt/$subvol_name
> diff --git a/tests/btrfs/060 b/tests/btrfs/060
> index 87823aba..53cbd3a0 100755
> --- a/tests/btrfs/060
> +++ b/tests/btrfs/060
> @@ -46,8 +46,6 @@ run_test()
>   	balance_pid=$!
>   	echo "$balance_pid" >>$seqres.full
>   
> -	# make sure the stop sign is not there
> -	rm -f $stop_file
>   	echo -n "Start subvolume worker: " >>$seqres.full
>   	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
>   	subvol_pid=$!
> diff --git a/tests/btrfs/065 b/tests/btrfs/065
> index ddc28616..f9e43cdc 100755
> --- a/tests/btrfs/065
> +++ b/tests/btrfs/065
> @@ -49,8 +49,6 @@ run_test()
>   	$FSSTRESS_PROG $args >>$seqres.full &
>   	fsstress_pid=$!
>   
> -	# make sure the stop sign is not there
> -	rm -f $stop_file
>   	echo -n "Start subvolume worker: " >>$seqres.full
>   	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
>   	subvol_pid=$!
> diff --git a/tests/btrfs/066 b/tests/btrfs/066
> index c7488602..b6f904ac 100755
> --- a/tests/btrfs/066
> +++ b/tests/btrfs/066
> @@ -41,8 +41,6 @@ run_test()
>   	$FSSTRESS_PROG $args >>$seqres.full &
>   	fsstress_pid=$!
>   
> -	# make sure the stop sign is not there
> -	rm -f $stop_file
>   	echo -n "Start subvolume worker: " >>$seqres.full
>   	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
>   	subvol_pid=$!
> diff --git a/tests/btrfs/067 b/tests/btrfs/067
> index ebbec1be..7be09d52 100755
> --- a/tests/btrfs/067
> +++ b/tests/btrfs/067
> @@ -42,8 +42,6 @@ run_test()
>   	$FSSTRESS_PROG $args >>$seqres.full &
>   	fsstress_pid=$!
>   
> -	# make sure the stop sign is not there
> -	rm -f $stop_file
>   	echo -n "Start subvolume worker: " >>$seqres.full
>   	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
>   	subvol_pid=$!
> diff --git a/tests/btrfs/068 b/tests/btrfs/068
> index 5f41fb74..19e37010 100755
> --- a/tests/btrfs/068
> +++ b/tests/btrfs/068
> @@ -42,8 +42,6 @@ run_test()
>   	$FSSTRESS_PROG $args >>$seqres.full &
>   	fsstress_pid=$!
>   
> -	# make sure the stop sign is not there
> -	rm -f $stop_file
>   	echo -n "Start subvolume worker: " >>$seqres.full
>   	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
>   	subvol_pid=$!
diff mbox series

Patch

diff --git a/common/btrfs b/common/btrfs
index e19a6ad1..29061c23 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -331,6 +331,7 @@  _btrfs_stress_subvolume()
 	local subvol_mnt=$4
 	local stop_file=$5
 
+	rm -f $stop_file
 	mkdir -p $subvol_mnt
 	while [ ! -e $stop_file ]; do
 		$BTRFS_UTIL_PROG subvolume create $btrfs_mnt/$subvol_name
diff --git a/tests/btrfs/060 b/tests/btrfs/060
index 87823aba..53cbd3a0 100755
--- a/tests/btrfs/060
+++ b/tests/btrfs/060
@@ -46,8 +46,6 @@  run_test()
 	balance_pid=$!
 	echo "$balance_pid" >>$seqres.full
 
-	# make sure the stop sign is not there
-	rm -f $stop_file
 	echo -n "Start subvolume worker: " >>$seqres.full
 	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
 	subvol_pid=$!
diff --git a/tests/btrfs/065 b/tests/btrfs/065
index ddc28616..f9e43cdc 100755
--- a/tests/btrfs/065
+++ b/tests/btrfs/065
@@ -49,8 +49,6 @@  run_test()
 	$FSSTRESS_PROG $args >>$seqres.full &
 	fsstress_pid=$!
 
-	# make sure the stop sign is not there
-	rm -f $stop_file
 	echo -n "Start subvolume worker: " >>$seqres.full
 	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
 	subvol_pid=$!
diff --git a/tests/btrfs/066 b/tests/btrfs/066
index c7488602..b6f904ac 100755
--- a/tests/btrfs/066
+++ b/tests/btrfs/066
@@ -41,8 +41,6 @@  run_test()
 	$FSSTRESS_PROG $args >>$seqres.full &
 	fsstress_pid=$!
 
-	# make sure the stop sign is not there
-	rm -f $stop_file
 	echo -n "Start subvolume worker: " >>$seqres.full
 	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
 	subvol_pid=$!
diff --git a/tests/btrfs/067 b/tests/btrfs/067
index ebbec1be..7be09d52 100755
--- a/tests/btrfs/067
+++ b/tests/btrfs/067
@@ -42,8 +42,6 @@  run_test()
 	$FSSTRESS_PROG $args >>$seqres.full &
 	fsstress_pid=$!
 
-	# make sure the stop sign is not there
-	rm -f $stop_file
 	echo -n "Start subvolume worker: " >>$seqres.full
 	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
 	subvol_pid=$!
diff --git a/tests/btrfs/068 b/tests/btrfs/068
index 5f41fb74..19e37010 100755
--- a/tests/btrfs/068
+++ b/tests/btrfs/068
@@ -42,8 +42,6 @@  run_test()
 	$FSSTRESS_PROG $args >>$seqres.full &
 	fsstress_pid=$!
 
-	# make sure the stop sign is not there
-	rm -f $stop_file
 	echo -n "Start subvolume worker: " >>$seqres.full
 	_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
 	subvol_pid=$!