@@ -618,11 +618,14 @@ _filter_getcap()
# Filter user/group/project id numbers out of quota reports, and standardize
# the block counts to use filesystem block size. Callers must set the id and
-# bsize variables before calling this function.
+# bsize variables before calling this function. The HIDDEN_QUOTA_FILES variable
+# (by default zero) is the number of root files to filter out of the inode
+# count part of the quota report.
_filter_quota_report()
{
test -n "$id" || echo "id must be set"
test -n "$bsize" || echo "block size must be set"
+ test -n "$HIDDEN_QUOTA_FILES" || HIDDEN_QUOTA_FILES=0
tr -s '[:space:]' | \
perl -npe '
@@ -630,7 +633,7 @@ _filter_quota_report()
s/^\#0 \d+ /[ROOT] 0 /g;
s/6 days/7 days/g' |
perl -npe '
- $val = 0;
+ $val = '"$HIDDEN_QUOTA_FILES"';
if ($ENV{'LARGE_SCRATCH_DEV'}) {
$val = $ENV{'NUM_SPACE_FILES'};
}
@@ -1900,3 +1900,32 @@ _scratch_xfs_force_no_metadir()
MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS"
fi
}
+
+# Decide if a mount filesystem has metadata directory trees.
+_xfs_mount_has_metadir() {
+ local mount="$1"
+
+ # spaceman (and its info command) predate metadir
+ test ! -e "$XFS_SPACEMAN_PROG" && return 1
+ $XFS_SPACEMAN_PROG -c "info" "$mount" | grep -q 'metadir=1'
+}
+
+# Compute the number of files that are not counted in quotas.
+_xfs_calc_hidden_quota_files() {
+ local mount="$1"
+
+ if _xfs_mount_has_metadir "$mount"; then
+ # Prior to the metadir feature, the realtime bitmap and summary
+ # file were "owned" by root and hence accounted to the root
+ # dquots. The metadata directory feature stopped accounting
+ # metadata files to quotas, so we must subtract 2 inodes from
+ # the repquota golden outputs to keep the tests going.
+ #
+ # We needn't adjust the block counts because the kernel doesn't
+ # support rt quota and hence the rt metadata files will always
+ # be zero length.
+ echo -2
+ else
+ echo 0
+ fi
+}
@@ -30,9 +30,14 @@ _require_scratch
_require_xfs_quota
_scratch_mkfs >/dev/null 2>&1
+orig_mntopts="$MOUNT_OPTIONS"
+_qmount_option "uquota"
_scratch_mount
bsize=$(_get_file_block_size $SCRATCH_MNT)
+# needs quota enabled to compute the number of metadata dir files
+HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT)
_scratch_unmount
+MOUNT_OPTIONS="$orig_mntopts"
bsoft=$(( 200 * $bsize ))
bhard=$(( 1000 * $bsize ))
@@ -35,9 +35,14 @@ _require_idmapped_mounts
_require_test_program "vfs/mount-idmapped"
_scratch_mkfs >/dev/null 2>&1
+orig_mntopts="$MOUNT_OPTIONS"
+_qmount_option "uquota"
_scratch_mount
bsize=$(_get_file_block_size $SCRATCH_MNT)
+# needs quota enabled to compute the number of metadata dir files
+HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT)
_scratch_unmount
+MOUNT_OPTIONS="$orig_mntopts"
bsoft=$(( 200 * $bsize ))
bhard=$(( 1000 * $bsize ))
@@ -155,6 +155,7 @@ _qmount_option "uquota,gquota,pquota"
_qmount
bsize=$(_get_file_block_size $SCRATCH_MNT)
+HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT)
bsoft=$(( 100 * $bsize ))
bhard=$(( 500 * $bsize ))
@@ -24,7 +24,10 @@ _require_nobody
do_repquota()
{
- repquota $SCRATCH_MNT | grep -E '^(fsgqa|root|nobody)' | sort -r
+ repquota $SCRATCH_MNT | grep -E '^(fsgqa|root|nobody)' | sort -r | \
+ perl -npe '
+ $val = '"$HIDDEN_QUOTA_FILES"';
+ s/(^root\s+--\s+\S+\s+\S+\s+\S+\s+)(\S+)/$1@{[$2 - $val]}/g'
}
rm -f "$seqres.full"
@@ -33,6 +36,7 @@ echo "Format and mount"
_scratch_mkfs > "$seqres.full" 2>&1
export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS"
_scratch_mount >> "$seqres.full" 2>&1
+HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT)
quotacheck -u -g $SCRATCH_MNT 2> /dev/null
quotaon $SCRATCH_MNT 2> /dev/null