Skip to contentSkip to conversation

Two improvements for xfstests

PATCH In review Jan Kara 3 participants 7 messages Jul 21, 2010

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

cover Two improvements for xfstests

Hi,

these two patches didn't seem to make it in the xfstests repository.
Could someone please include them? The first patch makes quota tests work fine for XFS and the second one is just a minor generic improvement. Thanks.

Honza

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

author
#1 lore raw

PATCH 1/2 Provide generic function for checking quota usage

Provide generic function _check_quota_usage for checking whether quota usage matches the space used and use it in proper tests.

---
 231          |   18 +++---------------
 231.out      |    6 ++++++
 232          |   14 +-------------
 232.out      |    2 ++
 233          |   14 +-------------
 233.out      |    2 ++
 common.quota |   36 ++++++++++++++++++++++++++++++++++++
 7 files changed, 51 insertions(+), 41 deletions(-)
231 +3 -15
index ebbe11e..e499c9a 100755
@@ -49,18 +49,6 @@ s,$SCRATCH_DEV,[SCR_DEV],;
         print;"
 }
 
-check_usage()
-{
-	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
-		>$tmp.orig
-	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
-		>$tmp.checked
-	quotaon -u -g $SCRATCH_MNT 2>/dev/null
-	diff $tmp.orig $tmp.checked
-}
-
 _fsx()
 {
 	tasks=$1
@@ -104,7 +92,7 @@ if ! _fsx 1; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
@@ -116,7 +104,7 @@ if ! _fsx 4; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
@@ -130,7 +118,7 @@ if ! _fsx 1; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
231.out +6 -0
index 2f2d072..ef264a9 100644
@@ -1,10 +1,16 @@
 QA output created by 231
 === FSX Standard Mode, Memory Mapping, 1 Tasks ===
 All operations completed A-OK!
+Comparing user usage
+Comparing group usage
 === FSX Standard Mode, Memory Mapping, 4 Tasks ===
 All operations completed A-OK!
 All operations completed A-OK!
 All operations completed A-OK!
 All operations completed A-OK!
+Comparing user usage
+Comparing group usage
 === FSX Standard Mode, Memory Mapping, 1 Tasks ===
 All operations completed A-OK!
+Comparing user usage
+Comparing group usage
232 +1 -13
index cf4d25a..d5f99bd 100755
@@ -46,18 +46,6 @@ s,$SCRATCH_DEV,[SCR_DEV],;
         print;"
 }
 
-check_usage()
-{
-	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
-		sort >$tmp.orig
-	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
-		sort >$tmp.checked
-	quotaon -u -g $SCRATCH_MNT 2>/dev/null
-	diff $tmp.orig $tmp.checked
-}
-
 _filter_num()
 {
 	tee -a $here/$seq.full |\
@@ -104,7 +92,7 @@ if ! _fsstress; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
232.out +2 -0
index 744192e..ef82a89 100644
@@ -4,3 +4,5 @@ Testing fsstress
 
 fsstress -n 2000 -d outdir -p 7
 seed = S
+Comparing user usage
+Comparing group usage
233 +1 -13
index b967e0d..5060931 100755
@@ -50,18 +50,6 @@ s,$SCRATCH_DEV,[SCR_DEV],;
         print;"
 }
 
-check_usage()
-{
-	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
-		sort >$tmp.orig
-	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
-		sort >$tmp.checked
-	quotaon -u -g $SCRATCH_MNT 2>/dev/null
-	diff $tmp.orig $tmp.checked
-}
-
 _filter_num()
 {
 	tee -a $here/$seq.full |\
@@ -113,7 +101,7 @@ if ! _fsstress; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
233.out +2 -0
index 208910d..fa36ca3 100644
@@ -4,3 +4,5 @@ Testing fsstress
 
 fsstress -z -f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 -n 5000 -d outdir -p 7
 seed = S
+Comparing user usage
+Comparing group usage
common.quota +36 -0
index d32e285..655e34d 100644
@@ -211,5 +211,41 @@ _qmount_option()
 	echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seq.full
 }
 
+_check_quota_usage()
+{
+	# Sync to get delalloc to disk
+	sync
+	VFS_QUOTA=0
+	if [ $FSTYP = "ext2" -o $FSTYP = "ext3" -o $FSTYP = "ext4" -o $FSTYP = "reiserfs" ]; then
+		VFS_QUOTA=1
+		quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
+	fi
+	repquota -u -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.user.orig
+	repquota -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.group.orig
+	if [ $VFS_QUOTA -eq 1 ]; then
+		quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+	else
+		# use XFS method to force quotacheck
+		mount -o remount,noquota $SCRATCH_DEV
+		mount -o remount,usrquota,grpquota $SCRATCH_DEV
+	fi
+	repquota -u -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.user.checked
+	repquota -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.group.checked
+	if [ $VFS_QUOTA -eq 1 ]; then
+		quotaon -u -g $SCRATCH_MNT 2>/dev/null
+	fi
+	{
+		echo "Comparing user usage"
+		diff $tmp.user.orig $tmp.user.checked
+	} && {
+		echo "Comparing group usage"
+		diff $tmp.group.orig $tmp.group.checked
+	}
+}
+
 # make sure this script returns success
 /bin/true
Signature · 6 lines
1.6.4.2

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

PATCH 2/2 Add test for correct $SCRATCH_MNT into _require_scratch

In reply to Jan Kara
---
 common.rc |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
common.rc +4 -0
index 6bf1e12..72997f9 100644
@@ -703,6 +703,10 @@ _require_scratch()
 		 then
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
+		if [ ! -d "$SCRATCH_MNT" ]
+		then
+		     _notrun "this test requires a valid \$SCRATCH_MNT"
+		fi
 		 ;;
     esac
 
Signature · 6 lines
1.6.4.2

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

Re: [PATCH 2/2] Add test for correct $SCRATCH_MNT into _require_scratch

Quoted 2 lines · Christoph Hellwig

This one is missing a signoff. Once you add it I can apply the series and push it out.

Oops sorry. Attached is the patch including the signoff.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
Quoted 1 line

From d72c11b63aa22c920b460a71d4384c2f39be6513 Mon Sep 17 00:00:00 2001

From: Jan Kara <[email protected]>
Date: Tue, 15 Jun 2010 10:54:12 +0200
Subject: [PATCH 2/2] Add test for correct $SCRATCH_MNT into _require_scratch

---
 common.rc |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
common.rc +4 -0
index 6bf1e12..72997f9 100644
@@ -703,6 +703,10 @@ _require_scratch()
 		 then
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
+		if [ ! -d "$SCRATCH_MNT" ]
+		then
+		     _notrun "this test requires a valid \$SCRATCH_MNT"
+		fi
 		 ;;
     esac
 
Signature · 1 line
1.6.4.2

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

#6 lore raw

Re: [PATCH 2/2] Add test for correct $SCRATCH_MNT into _require_scratch

Quoted 1 line · Christoph Hellwig

Thanks, I've pushed both patches out.

And I'll pick them up and push them out to
oss.sgi.com this week; I'm updating xfsprogs
and xfstests.

-Alex

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