public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: XiaoLi Feng <xifeng@redhat.com>
To: fstests@vger.kernel.org
Cc: Xiaoli Feng <xifeng@redhat.com>
Subject: [PATCH v1] generic/275: use free block counts to check if fs is filled sufficiently.
Date: Wed,  2 Dec 2020 18:27:31 +0800	[thread overview]
Message-ID: <20201202102731.22350-1-xifeng@redhat.com> (raw)

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


             reply	other threads:[~2020-12-02 10:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 10:27 XiaoLi Feng [this message]
2020-12-06 13:54 ` [PATCH v1] generic/275: use free block counts to check if fs is filled sufficiently Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201202102731.22350-1-xifeng@redhat.com \
    --to=xifeng@redhat.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox