xfs
[Top] [All Lists]

[PATCH 3/3] xfstests: Make 204 work with different block and inode sizes

To: xfs@xxxxxxxxxxx
Subject: [PATCH 3/3] xfstests: Make 204 work with different block and inode sizes.
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 3 Sep 2013 10:14:55 +1000
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1378167295-7566-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1378167295-7566-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

Otherwise it fails with ENOSPC on CRC enabled filesystems because
ofhte larger inode size.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 common/filter     | 10 +++++++++-
 tests/generic/204 | 34 ++++++++++++++++++++++++++++++----
 2 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/common/filter b/common/filter
index ee738ca..dc9e197 100644
--- a/common/filter
+++ b/common/filter
@@ -131,9 +131,17 @@ _filter_date()
 }
 
 # prints filtered output on stdout, values (use eval) on stderr
-# 
+# Non XFS filesystems always return a 4k block size and a 256 byte inode.
 _filter_mkfs()
 {
+    case $FSTYP in
+    xfs)
+       ;;
+    *)
+       perl -e 'print STDERR "dbsize=4096\nisize=256\n"'
+       return ;;
+    esac
+
     set -
     perl -ne '
     if (/^meta-data=([\w,|\/.-]+)\s+isize=(\d+)\s+agcount=(\d+), agsize=(\d+) 
blks/) {
diff --git a/tests/generic/204 b/tests/generic/204
index a054c8f..598b805 100755
--- a/tests/generic/204
+++ b/tests/generic/204
@@ -28,6 +28,12 @@ echo "QA output created by $seq"
 here=`pwd`
 tmp=/tmp/$$
 status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+       rm -f $tmp.*
+}
 
 # get standard environment, filters and checks
 . ./common/rc
@@ -41,15 +47,35 @@ _require_scratch
 
 rm -f $seqres.full
 
+# get the block size first
+_scratch_mkfs 2> /dev/null | _filter_mkfs 2> $tmp.mkfs > /dev/null
+. $tmp.mkfs
+
 SIZE=`expr 104 \* 1024 \* 1024`
-_scratch_mkfs_sized $SIZE  &> /dev/null
+_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null \
+               | _filter_mkfs 2> $tmp.mkfs > /dev/null
 _scratch_mount
 
+. $tmp.mkfs
+
 # fix the reserve block pool to a known size so that the enospc calculations
-# work out correctly.
-_scratch_resvblks 1024 >> $seqres.full 2>&1
+# work out correctly. Space usages is based 22500 files and 1024 reserved 
blocks
+# on a 4k block size 256 byte inode size filesystem.
+resv_blks=1024
+space=97920000
+
+# decrease files for inode size.
+#      22500 * (256 + 4k) = ~97MB
+#      files * (isize + bsize) = 97MB
+#      files = (97920000 / (isize + bsize))
+
+files=$((space / (isize + dbsize)))
+resv_blks=$((resv_blks * (4096 / dbsize)))
+
+echo files $files, resvblks $resv_blks >> $seqres.full
+_scratch_resvblks $resv_blks >> $seqres.full 2>&1
 
-for i in `seq 1 22500`; do
+for i in `seq 1 $files`; do
     echo -n > $SCRATCH_MNT/$i
     echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i
 done
-- 
1.8.3.2

<Prev in Thread] Current Thread [Next in Thread>