diff mbox series

[v2,1/2] common/fuzzy: make _scratch_fuzz_modify work for non-xfs filesystems

Message ID 20240315171325.2885-2-luis.henriques@linux.dev (mailing list archive)
State New, archived
Headers show
Series Ensure _scratch_fuzz_modify() works for other filesystems | expand

Commit Message

Luis Henriques March 15, 2024, 5:13 p.m. UTC
Since commit 9bab148bb3c7 ("common/fuzzy: exercise the filesystem a little
harder after repairing") funtion _scratch_fuzz_modify() has become
xfs-specific due to the use of some functions that assume this filesytem,
namely _xfs_force_bdev() and _xfs_has_feature().

Ensure _scratch_fuzz_modify() works again with other filesystems by using
these functions only when testing xfs.

Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>
---
 common/fuzzy | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Darrick J. Wong March 20, 2024, 1:20 a.m. UTC | #1
On Fri, Mar 15, 2024 at 05:13:24PM +0000, Luis Henriques (SUSE) wrote:
> Since commit 9bab148bb3c7 ("common/fuzzy: exercise the filesystem a little
> harder after repairing") funtion _scratch_fuzz_modify() has become
> xfs-specific due to the use of some functions that assume this filesytem,
> namely _xfs_force_bdev() and _xfs_has_feature().
> 
> Ensure _scratch_fuzz_modify() works again with other filesystems by using
> these functions only when testing xfs.
> 
> Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>

Still looks ok,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  common/fuzzy | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/common/fuzzy b/common/fuzzy
> index f5d45cb28f07..218fe1654386 100644
> --- a/common/fuzzy
> +++ b/common/fuzzy
> @@ -8,15 +8,17 @@
>  _scratch_fuzz_modify() {
>  	echo "+++ stressing filesystem"
>  	mkdir -p $SCRATCH_MNT/data
> -	_xfs_force_bdev data $SCRATCH_MNT/data
> +	[ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT/data
>  	$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/data
>  
> -	if _xfs_has_feature "$SCRATCH_MNT" realtime; then
> -		mkdir -p $SCRATCH_MNT/rt
> -		_xfs_force_bdev realtime $SCRATCH_MNT/rt
> -		$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
> -	else
> -		echo "+++ xfs realtime not configured"
> +	if [ "$FSTYP" = "xfs" ]; then
> +		if _xfs_has_feature "$SCRATCH_MNT" realtime; then
> +			mkdir -p $SCRATCH_MNT/rt
> +			_xfs_force_bdev realtime $SCRATCH_MNT/rt
> +			$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
> +		else
> +			echo "+++ xfs realtime not configured"
> +		fi
>  	fi
>  }
>  
>
diff mbox series

Patch

diff --git a/common/fuzzy b/common/fuzzy
index f5d45cb28f07..218fe1654386 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -8,15 +8,17 @@ 
 _scratch_fuzz_modify() {
 	echo "+++ stressing filesystem"
 	mkdir -p $SCRATCH_MNT/data
-	_xfs_force_bdev data $SCRATCH_MNT/data
+	[ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT/data
 	$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/data
 
-	if _xfs_has_feature "$SCRATCH_MNT" realtime; then
-		mkdir -p $SCRATCH_MNT/rt
-		_xfs_force_bdev realtime $SCRATCH_MNT/rt
-		$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
-	else
-		echo "+++ xfs realtime not configured"
+	if [ "$FSTYP" = "xfs" ]; then
+		if _xfs_has_feature "$SCRATCH_MNT" realtime; then
+			mkdir -p $SCRATCH_MNT/rt
+			_xfs_force_bdev realtime $SCRATCH_MNT/rt
+			$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
+		else
+			echo "+++ xfs realtime not configured"
+		fi
 	fi
 }