diff mbox series

ext4/053: Add support for testing mb_optimize_scan

Message ID 5b0d252484cbe973c2df0c677cb47b30012b0db1.1647253313.git.ojaswin@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series ext4/053: Add support for testing mb_optimize_scan | expand

Commit Message

Ojaswin Mujoo March 14, 2022, 10:32 a.m. UTC
Add support to test the mb_optimize_scan mount option.
Since its value is not reflected in the "options" file in proc,
use "mb_structs_summary" to verify its value.

Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
---
 tests/ext4/053 | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

Comments

Ritesh Harjani March 14, 2022, 2:20 p.m. UTC | #1
On 22/03/14 04:02PM, Ojaswin Mujoo wrote:
> Add support to test the mb_optimize_scan mount option.
> Since its value is not reflected in the "options" file in proc,
> use "mb_structs_summary" to verify its value.

Yes, I think we can do this. Thanks for identifying it.

>
> Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>

Overall the patch looks good to me. Feel free to add
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>

> ---
>  tests/ext4/053 | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)

<Some stats>

I ran this test of yours with and w/o your kernel fix for this mount option,
which is now sitting in ext4 dev tree [1].

<with kernel fix>
ext4/053 173s ...  147s
Ran: ext4/053
Passed all 1 tests

<w/o kernel fix>
ext4/053 173s ... [failed, exit status 2]- output mismatch (see /home/qemu/work/tools/xfstests-dev/results//ext4_4k/ext4/053.out.bad)
    --- tests/ext4/053.out      2022-01-03 11:50:08.671463501 +0530
    +++ /home/qemu/work/tools/xfstests-dev/results//ext4_4k/ext4/053.out.bad    2022-03-14 18:26:12.290610687 +0530
    @@ -1,2 +1,4 @@
     QA output created by 053
     Silence is golden.
    +mounting ext3 "mb_optimize_scan=1" checking "mb_optimize_scan=1" (not found) FAILED
    +mounting ext4 "mb_optimize_scan=1" checking "mb_optimize_scan=1" (not found) FAILED
    ...
    (Run 'diff -u /home/qemu/work/tools/xfstests-dev/tests/ext4/053.out /home/qemu/work/tools/xfstests-dev/results//ext4_4k/ext4/053.out.bad'  to see the entire diff)
Ran: ext4/053
Failures: ext4/053
Failed 1 of 1 tests

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?h=dev&id=27b38686a3bb601db48901dbc4e2fc5d77ffa2c1
Eryu Guan April 10, 2022, 12:48 p.m. UTC | #2
On Mon, Mar 14, 2022 at 04:02:07PM +0530, Ojaswin Mujoo wrote:
> Add support to test the mb_optimize_scan mount option.
> Since its value is not reflected in the "options" file in proc,
> use "mb_structs_summary" to verify its value.
> 
> Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>

mb_optimize_scan option was added in v5.13 by commit 196e402adf2e ("ext4:
improve cr 0 / cr 1 group scanning"), and ext4/053 will run on v5.12
kernel (and newer kernels), so test will fail when testing v5.12 kernel.

> ---
>  tests/ext4/053 | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/ext4/053 b/tests/ext4/053
> index e1e79592..bd92002f 100755
> --- a/tests/ext4/053
> +++ b/tests/ext4/053
> @@ -100,6 +100,7 @@ test_mnt() {
>  	(
>  	ret=0
>  	IFS=','
> +	proc_path="/proc/fs/ext4/$(_short_dev $SCRATCH_DEV)"
>  	for option in $OPTS; do
>  		if echo $IGNORED | grep -w $option; then
>  			continue
> @@ -114,11 +115,16 @@ test_mnt() {
>  		fi
>  		option=${option#^}
>  
> -		if echo $CHECK_MINFO | grep -w $option; then
> +		if [[ $option =~ ^mb_optimize_scan=.*$ ]]; then
> +			# mb_optimize_scan needs special handling
> +			expected=${option#*=}
> +			ret=$(cat $proc_path/mb_structs_summary | grep "optimize_scan" \
> +				| awk '{ print $2 }')
> +		elif echo $CHECK_MINFO | grep -w $option; then
>  			findmnt -n -o OPTIONS $SCRATCH_DEV | grep $option
>  			ret=$?
>  		else
> -			grep $option /proc/fs/ext4/$(_short_dev $SCRATCH_DEV)/options
> +			grep $option $proc_path/options
>  			ret=$?
>  		fi
>  
> @@ -526,13 +532,10 @@ for fstype in ext2 ext3 ext4; do
>  
>  	mnt prefetch_block_bitmaps removed
>  	mnt no_prefetch_block_bitmaps
> -	# We don't currently have a way to know that the option has been
> -	# applied, so comment it out for now. This should be fixed in the
> -	# future.

As the comment said, we need a way to know if mb_optimize_scan option is
supported by current kernel.

Thanks,
Eryu

> -	#mnt mb_optimize_scan=0
> -	#mnt mb_optimize_scan=1
> -	#not_mnt mb_optimize_scan=9
> -	#not_mnt mb_optimize_scan=
> +	mnt mb_optimize_scan=0
> +	mnt mb_optimize_scan=1
> +	not_mnt mb_optimize_scan=9
> +	not_mnt mb_optimize_scan=
>  	mnt nombcache
>  	mnt no_mbcache nombcache
>  	mnt check=none removed
> -- 
> 2.27.0
diff mbox series

Patch

diff --git a/tests/ext4/053 b/tests/ext4/053
index e1e79592..bd92002f 100755
--- a/tests/ext4/053
+++ b/tests/ext4/053
@@ -100,6 +100,7 @@  test_mnt() {
 	(
 	ret=0
 	IFS=','
+	proc_path="/proc/fs/ext4/$(_short_dev $SCRATCH_DEV)"
 	for option in $OPTS; do
 		if echo $IGNORED | grep -w $option; then
 			continue
@@ -114,11 +115,16 @@  test_mnt() {
 		fi
 		option=${option#^}
 
-		if echo $CHECK_MINFO | grep -w $option; then
+		if [[ $option =~ ^mb_optimize_scan=.*$ ]]; then
+			# mb_optimize_scan needs special handling
+			expected=${option#*=}
+			ret=$(cat $proc_path/mb_structs_summary | grep "optimize_scan" \
+				| awk '{ print $2 }')
+		elif echo $CHECK_MINFO | grep -w $option; then
 			findmnt -n -o OPTIONS $SCRATCH_DEV | grep $option
 			ret=$?
 		else
-			grep $option /proc/fs/ext4/$(_short_dev $SCRATCH_DEV)/options
+			grep $option $proc_path/options
 			ret=$?
 		fi
 
@@ -526,13 +532,10 @@  for fstype in ext2 ext3 ext4; do
 
 	mnt prefetch_block_bitmaps removed
 	mnt no_prefetch_block_bitmaps
-	# We don't currently have a way to know that the option has been
-	# applied, so comment it out for now. This should be fixed in the
-	# future.
-	#mnt mb_optimize_scan=0
-	#mnt mb_optimize_scan=1
-	#not_mnt mb_optimize_scan=9
-	#not_mnt mb_optimize_scan=
+	mnt mb_optimize_scan=0
+	mnt mb_optimize_scan=1
+	not_mnt mb_optimize_scan=9
+	not_mnt mb_optimize_scan=
 	mnt nombcache
 	mnt no_mbcache nombcache
 	mnt check=none removed