Skip to contentSkip to conversation

generic/275: use free block counts to check if fs is filled sufficiently.

PATCH In review XiaoLi Feng 2 participants 2 messages Dec 2, 2020 – Dec 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/275: use free block counts to check if fs is filled sufficiently.

From: Xiaoli Feng <[email protected]>

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(-)
tests/generic/275 +10 -3
index 3a016037..2c5a807f 100755
@@ -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
Signature · 1 line
2.18.1
#1 lore raw
Quoted 6 lines · Xiaoli Feng

From: Xiaoli Feng <[email protected]>

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

Quoted 30 lines
---
 tests/generic/275 | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
tests/generic/275 +10 -3
index 3a016037..2c5a807f 100755
@@ -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
Signature · 1 line
2.18.1