[LTP] [PATCH] kernel/device-drivers/zram/zram01.sh : add a sync

Cyril Hrubis chrubis@suse.cz
Thu Aug 3 12:52:22 CEST 2023


Hi!
> diff --git a/testcases/kernel/device-drivers/zram/zram01.sh b/testcases/kernel/device-drivers/zram/zram01.sh
> index 58d233f91..5f3964f6c 100755
> --- a/testcases/kernel/device-drivers/zram/zram01.sh
> +++ b/testcases/kernel/device-drivers/zram/zram01.sh
> @@ -119,6 +119,9 @@ zram_fill_fs()
>  				>/dev/null 2>err.txt || break
>  			b=$(($b + 1))
>  		done
> +                # Give the system time to catch up, otherwise the mm_stat
> +                # checking below can give a false negative
> +		sync

I guess that the files written by the dd above end up in page cache and
are not written out until much later. Does it fix the problem if you add
fdatasync to the dd commandline? That should be faster than using the
big hammer and sysncing the whole system.

>  		if [ $b -eq 0 ]; then
>  			[ -s err.txt ] && tst_res TWARN "dd error: $(cat err.txt)"
>  			tst_brk TBROK "cannot fill zram $i"
> @@ -134,6 +137,9 @@ zram_fill_fs()
>  		fi
>  
>  		mem_used_total=`awk '{print $3}' "/sys/block/zram$i/mm_stat"`
> +		if [ $mem_used_total -eq 0 ]; then
> +			test_res FAIL "/sys/block/zram$i/mm_stat reports 0 size : $(cat /sys/block/zram$i/mm_stat)"
> +		fi
>  		v=$((100 * 1024 * $b / $mem_used_total))
>  		r=`echo "scale=2; $v / 100 " | bc`
>  
> -- 
> 2.41.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list