xfs: make some xfs project quota tests generic

This patch makes some xfs project quota tests generic,
so that there is at least some coverage on ext4 for this
(semi-)new feature.

It requires bleeding edge xfsprogs, so that xfs_quota and
xfs_io's chproj command can operate on "foreign" filesystems,
and requires relatively new e2fsprogs to enable the project
quota feature on-disk.

The mechanism for enabling project quota on ext4 is a bit
arcane, but hopefully I've encapsulated it reasonably well here.

Changes:

* look for "project" feature in _require_prjquota
* look for accounting not enforcement (-P) in _require_prjquota
* add a _scratch_enable_pquota to turn on project quota feature
* s/pquota/quota/ in _qmount_option for ext4
* add helper to test for xfs_io chproj on foreign filesystems
* switch from block to inode quota in xfs/133 because empty
  ext4 dirs consume one block
* cosmetic/generic changes for mkfs, require tests, etc.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eric Sandeen
2016-09-22 17:51:03 -05:00
committed by Eryu Guan
parent fe901ccaa7
commit 7369e9c7f9
7 changed files with 74 additions and 41 deletions
+8 -4
View File
@@ -63,10 +63,11 @@ echo "Silence is golden."
proj_dir="$SCRATCH_MNT/test"
# Modify as appropriate.
_supported_fs xfs
_supported_fs generic
_supported_os Linux
_require_quota
_require_xfs_quota_foreign
_require_scratch
# Make sure the hard limits reported are what was set.
@@ -115,7 +116,7 @@ _filter_quota_rpt() {
}
_quota_cmd() {
xfs_quota -P "$my_projid" -D "$my_projects" -x \
$XFS_QUOTA_PROG -P "$my_projid" -D "$my_projects" -x \
-c "$@" "$SCRATCH_MNT"
}
@@ -124,10 +125,13 @@ _quota_cmd() {
echo $proj_name:$proj_num > "$my_projid"
echo $proj_num:$proj_dir > "$my_projects"
_scratch_mkfs >> "$seqres.full" 2>&1
_scratch_mkfs >> "$seqres.full" 2>&1
_scratch_enable_pquota
export MOUNT_OPTIONS="-opquota"
_qmount_option "prjquota"
_qmount
_require_prjquota $SCRATCH_DEV
mkdir -p "${proj_dir}"
# Setup the project quota directory