Skip to contentSkip to conversation

xfstests: improvements for generic/204

PATCH In review Dave Chinner 3 participants 8 messages Sep 3, 2013 – Oct 14, 2013

lore
Share & tools
lore
#0 lore raw

cover xfstests: improvements for generic/204

Hi folks,

These patches are fixes and improvements for generic/204.

Firstly, it doesn't check the filesystem it works on, and so corruptions can go undetected. Secondly, _scratch_mkfs_sized doesn't handle different block sizes passed in on the command line via MKFS_OPTIONS at all well (i.e they get ignored) and so it has never run on small block size filesystems of any type.

Finally, make it run on filesystems with different block sizes and inode sizes by scaling the file count appropriately. It detects block and inode size from the output of mkfs, so scaling only occurs if the underlying filesystem emits them.

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

PATCH 1/3 xfstests: generic/204 should call _check_scratch_fs

From: Dave Chinner <[email protected]>

Because if it corrupts the filesystem it currently goes undetected.

---
 tests/generic/204 | 2 ++
 1 file changed, 2 insertions(+)
tests/generic/204 +2 -0
index 62bd248..98cb176 100755
@@ -52,6 +52,8 @@ for i in `seq 1 22500`; do
     echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i
 done
 
+_check_scratch_fs
+
 # success, all done
 echo "*** done"
 rm -f $seqres.full
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#3 lore raw

PATCH 2/3 xfstests: Obey mkfs options for sized filesystems on XFS

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The XFS implementation of _scratch_mkfs_sized ignores MKFS_OPTIONS when a custom block size is set and so isn't testing things like CRCs on such sized filesytsems. Fix this by ensuring we don't try to override the block size is it is set in MKFS_OPTIONS. xfs/204 shows this problem.

---
 common/rc         | 8 +++++++-
 tests/generic/204 | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)
common/rc +7 -1
index 358f24b..8a239c5 100644
@@ -578,7 +578,13 @@ _scratch_mkfs_sized()
 
     case $FSTYP in
     xfs)
-	_scratch_mkfs_xfs -d size=$fssize -b size=$blocksize
+	# don't override MKFS_OPTIONS that set a block size.
+	echo $MKFS_OPTIONS |egrep -q "b?size="
+	if [ $? -eq 0 ]; then
+		_scratch_mkfs_xfs -d size=$fssize
+	else
+		_scratch_mkfs_xfs -d size=$fssize -b size=$blocksize
+	fi
 	;;
     ext2|ext3|ext4|ext4dev)
 	yes | ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
tests/generic/204 +3 -1
index 98cb176..a054c8f 100755
@@ -39,13 +39,15 @@ _supported_os Linux
 
 _require_scratch
 
+rm -f $seqres.full
+
 SIZE=`expr 104 \* 1024 \* 1024`
 _scratch_mkfs_sized $SIZE  &> /dev/null
 _scratch_mount
 
 # fix the reserve block pool to a known size so that the enospc calculations
 # work out correctly.
-_scratch_resvblks 1024 > $seqres.full 2>&1
+_scratch_resvblks 1024 >> $seqres.full 2>&1
 
 for i in `seq 1 22500`; do
     echo -n > $SCRATCH_MNT/$i
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] xfstests: Obey mkfs options for sized filesystems on XFS

Quoted 9 lines · Dave Chinner

From: Dave Chinner <[email protected]>

The XFS implementation of _scratch_mkfs_sized ignores MKFS_OPTIONS when a custom block size is set and so isn't testing things like CRCs on such sized filesytsems. Fix this by ensuring we don't try to override the block size is it is set in MKFS_OPTIONS. xfs/204 shows this problem.

Looks good.

Maybe someone more familar with the other mkfs tools should cross-check those as well.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw

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

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

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

---
 common/filter     | 10 +++++++++-
 tests/generic/204 | 34 ++++++++++++++++++++++++++++++----
 2 files changed, 39 insertions(+), 5 deletions(-)
common/filter +9 -1
index ee738ca..dc9e197 100644
@@ -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/) {
tests/generic/204 +30 -4
index a054c8f..598b805 100755
@@ -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
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#7 lore raw
In reply to Dave Chinner
Quoted 15 lines · Dave Chinner

Hi folks,

These patches are fixes and improvements for generic/204.

Firstly, it doesn't check the filesystem it works on, and so corruptions can go undetected. Secondly, _scratch_mkfs_sized doesn't handle different block sizes passed in on the command line via MKFS_OPTIONS at all well (i.e they get ignored) and so it has never run on small block size filesystems of any type.

Finally, make it run on filesystems with different block sizes and inode sizes by scaling the file count appropriately. It detects block and inode size from the output of mkfs, so scaling only occurs if the underlying filesystem emits them.

Quoted 9 lines

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

This series has been commited.

Thanks
--Rich

commit a4d5b247b565307c7da05d7bf784f093ba3f5dad

Author: Dave Chinner <[email protected]>
Date:   Tue Sep 3 00:14:55 2013 +0000

xfstests: Make 204 work with different block and inode sizes.

commit f7433693f4198153900081dca01ab5cd940986b8

Author: Dave Chinner <[email protected]>
Date:   Tue Sep 3 00:14:54 2013 +0000

xfstests: Obey mkfs options for sized filesystems on XFS

commit f33d180335f13407df92c0dd642974a808d6b87f

Author: Dave Chinner <[email protected]>
Date:   Tue Sep 3 00:14:53 2013 +0000

xfstests: generic/204 should call _check_scratch_fs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs