public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] generic/275: use free block counts to check if fs is filled sufficiently.
@ 2020-12-02 10:27 XiaoLi Feng
  2020-12-06 13:54 ` Eryu Guan
  0 siblings, 1 reply; 2+ messages in thread
From: XiaoLi Feng @ 2020-12-02 10:27 UTC (permalink / raw)
  To: fstests; +Cc: Xiaoli Feng

From: Xiaoli Feng <xifeng@redhat.com>

For large block size, such as 64k, there're maybe leave more than 768k
space when disk is full. I met one. When I test 64k for dax. It leaves
about 800k space when disk is full. So change to jude the free block
for >4k fs.
---
 tests/generic/275 | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/generic/275 b/tests/generic/275
index 3a016037..2c5a807f 100755
--- a/tests/generic/275
+++ b/tests/generic/275
@@ -62,9 +62,16 @@ rm -f $SCRATCH_MNT/tmp1
 sync
 echo "Post rm space:" >> $seqres.full
 $DF_PROG $SCRATCH_MNT >>$seqres.full 2>&1
-_freespace=`$DF_PROG -k $SCRATCH_MNT | tail -n 1 | awk '{print $5}'`
-[ $_freespace -gt 1024 ] && _fail "could not sufficiently fill filesystem"
-
+bsize=$(_get_file_block_size $SCRATCH_MNT)
+bsize=$((bsize / 1024))
+_freespace=`$DF_PROG -k  $SCRATCH_MNT | tail -n 1 | awk '{print $5}'`
+# When block size is >4k, use the free counts of block to judge
+if [ "$bsize" -gt 4 ]; then
+	_freeblock=$((_freespace / bsize))
+	[ "$_freeblock" -gt 256 ] && _fail "could not sufficiently fill filesystem"
+else
+	[ "$_freespace" -gt 1024 ] && _fail "could not sufficiently fill filesystem"
+fi
 # Try to write more than available space in chunks that will allow at least one
 # full write to succeed.
 dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=128k count=8 >>$seqres.full 2>&1
-- 
2.18.1


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

* Re: [PATCH v1] generic/275: use free block counts to check if fs is filled sufficiently.
  2020-12-02 10:27 [PATCH v1] generic/275: use free block counts to check if fs is filled sufficiently XiaoLi Feng
@ 2020-12-06 13:54 ` Eryu Guan
  0 siblings, 0 replies; 2+ messages in thread
From: Eryu Guan @ 2020-12-06 13:54 UTC (permalink / raw)
  To: XiaoLi Feng; +Cc: fstests

On Wed, Dec 02, 2020 at 06:27:31PM +0800, Xiaoli Feng wrote:
> From: Xiaoli Feng <xifeng@redhat.com>
> 
> For large block size, such as 64k, there're maybe leave more than 768k
> space when disk is full. I met one. When I test 64k for dax. It leaves
> about 800k space when disk is full. So change to jude the free block
> for >4k fs.

I'm not sure if that's a bug in the filesystem, and the test is designed
to find such bugs. Would you please make sure if that's a bug or not
first? Maybe by asking in proper mailing list.

Thanks,
Eryu

> ---
>  tests/generic/275 | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/generic/275 b/tests/generic/275
> index 3a016037..2c5a807f 100755
> --- a/tests/generic/275
> +++ b/tests/generic/275
> @@ -62,9 +62,16 @@ rm -f $SCRATCH_MNT/tmp1
>  sync
>  echo "Post rm space:" >> $seqres.full
>  $DF_PROG $SCRATCH_MNT >>$seqres.full 2>&1
> -_freespace=`$DF_PROG -k $SCRATCH_MNT | tail -n 1 | awk '{print $5}'`
> -[ $_freespace -gt 1024 ] && _fail "could not sufficiently fill filesystem"
> -
> +bsize=$(_get_file_block_size $SCRATCH_MNT)
> +bsize=$((bsize / 1024))
> +_freespace=`$DF_PROG -k  $SCRATCH_MNT | tail -n 1 | awk '{print $5}'`
> +# When block size is >4k, use the free counts of block to judge
> +if [ "$bsize" -gt 4 ]; then
> +	_freeblock=$((_freespace / bsize))
> +	[ "$_freeblock" -gt 256 ] && _fail "could not sufficiently fill filesystem"
> +else
> +	[ "$_freespace" -gt 1024 ] && _fail "could not sufficiently fill filesystem"
> +fi
>  # Try to write more than available space in chunks that will allow at least one
>  # full write to succeed.
>  dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=128k count=8 >>$seqres.full 2>&1
> -- 
> 2.18.1

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

end of thread, other threads:[~2020-12-06 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-02 10:27 [PATCH v1] generic/275: use free block counts to check if fs is filled sufficiently XiaoLi Feng
2020-12-06 13:54 ` Eryu Guan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox