]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
Provide generic function for checking quota usage
authorJan Kara <jack@suse.cz>
Wed, 21 Jul 2010 16:50:51 +0000 (18:50 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 21 Jul 2010 16:52:31 +0000 (18:52 +0200)
Provide generic function _check_quota_usage for checking whether quota usage
matches the space used and use it in proper tests.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christoph Hellwig <hch@lst.de>
231
231.out
232
232.out
233
233.out
common.quota

diff --git a/231 b/231
index ebbe11e53614e95d6f5137a4c1c1b8085c86bbb5..e499c9a24c92f9235f2553472f3129a0227a1a8b 100755 (executable)
--- a/231
+++ b/231
@@ -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
diff --git a/231.out b/231.out
index 2f2d0723d6404eac5dd312433bfbb168ceec2b74..ef264a90db5c5081df955bfa50a2cc45ec9e8a3b 100644 (file)
--- a/231.out
+++ b/231.out
@@ -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
diff --git a/232 b/232
index cf4d25adc78920d328a087ea7059ca43bcc19bcb..d5f99bd3e0cc6e943432d9d28ba5ccdc31473af9 100755 (executable)
--- a/232
+++ b/232
@@ -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
diff --git a/232.out b/232.out
index 744192ecf3eb9f6cdaaefe5cbae6725e88b08ea8..ef82a890919b82c7a00e4537012dd9bdc854fec7 100644 (file)
--- a/232.out
+++ b/232.out
@@ -4,3 +4,5 @@ Testing fsstress
 
 fsstress -n 2000 -d outdir -p 7
 seed = S
+Comparing user usage
+Comparing group usage
diff --git a/233 b/233
index b967e0d156addf19978bd5f38e27324a2673a160..506093126709979ba667f49f88fa17eb5533d433 100755 (executable)
--- a/233
+++ b/233
@@ -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
diff --git a/233.out b/233.out
index 208910d76b07d0ff937fa9f1597267fcf0629bca..fa36ca347ae2fe951772482ff3a75827a161bb98 100644 (file)
--- a/233.out
+++ b/233.out
@@ -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
index d32e285bdc46c100d978376bc38c3f1edd326fa7..655e34d11145950f06fac15f764353f4857fe5ef 100644 (file)
@@ -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