]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs/266: fix restore summary counter when quotas are enabled
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 1 Nov 2018 23:19:33 +0000 (16:19 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 4 Nov 2018 16:42:49 +0000 (00:42 +0800)
When quotas are enabled, an incremental backup has to record the quota
file updates too.  Inside a dump the quota files are stored as special
files under the root dump directory.  xfsrestore reports the dump dir
in its restore summary counts even if the dump dir was only there for
the sake of the quota updates, which makes the test fail.  Fix this by
massaging the output when quotas are turned on.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/266

index c4c3e8d9f9e527a6a9c10648fe801f0ef1e43b36..9084f5b9b5340d2f0ce2ffff5c71b7f72e91c4fb 100755 (executable)
@@ -26,6 +26,21 @@ _add_and_append_dumpdir_fill()
     _append_dumpdir_fill
 }
 
+# Quota files are stored as special files in the dumpdir of the incremental
+# backup.  This throws off the directory/file count reported because xfsrestore
+# includes the dumpdir in the restore summary counts.
+filter_cumulative_quota_updates() {
+    $here/src/feature -U $SCRATCH_DEV && quota=1
+    $here/src/feature -G $SCRATCH_DEV && quota=1
+    $here/src/feature -P $SCRATCH_DEV && quota=1
+
+    $AWK_PROG -v quota=$quota '
+       /entries processed/ {
+               if (quota) {$2--; $5--;}
+       }
+       {print}'
+}
+
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/dump
@@ -47,7 +62,7 @@ _add_and_append_dumpdir_fill
 _do_dump_file -f $tmp.df.1 -l 1 -D
 _prepare_restore_dir
 _do_restore_file_cum -f $tmp.df.0
-_do_restore_file_cum -f $tmp.df.1
+_do_restore_file_cum -f $tmp.df.1 | filter_cumulative_quota_updates
 _ls_compare_sub
 _diff_compare