mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
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:
+11
-7
@@ -46,12 +46,14 @@ _cleanup()
|
||||
rm -f $seqres.full
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs xfs
|
||||
_supported_fs generic
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
_require_xfs_quota
|
||||
_require_quota
|
||||
_require_xfs_quota_foreign
|
||||
|
||||
_scratch_mkfs_xfs >/dev/null 2>&1
|
||||
_scratch_mkfs >/dev/null 2>&1
|
||||
_scratch_enable_pquota
|
||||
|
||||
do_project_test()
|
||||
{
|
||||
@@ -72,20 +74,22 @@ EOF
|
||||
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
|
||||
-c "project -s $qa_project" $SCRATCH_MNT > /dev/null
|
||||
|
||||
# We set & test inodes, because xfs vs ext4 consume differing
|
||||
# amounts of space for an empty dir, but an inode is an inode...
|
||||
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
|
||||
-c "limit -p bsoft=100m bhard=200m $qa_project" $SCRATCH_MNT
|
||||
-c "limit -p isoft=100 ihard=200 $qa_project" $SCRATCH_MNT
|
||||
|
||||
echo "=== quota command output ==="
|
||||
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid \
|
||||
-c "quota -p -v -b $qa_project" $SCRATCH_MNT | _filter_quota
|
||||
-c "quota -p -v -i $qa_project" $SCRATCH_MNT | _filter_quota
|
||||
|
||||
echo "=== report command output ==="
|
||||
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
|
||||
-c "report -p -N -b" $SCRATCH_MNT | _filter_project_quota
|
||||
-c "report -p -N -i" $SCRATCH_MNT | _filter_project_quota
|
||||
}
|
||||
|
||||
# Test project
|
||||
_qmount_option "uquota,pquota"
|
||||
_qmount_option "usrquota,prjquota"
|
||||
_qmount
|
||||
_require_prjquota $SCRATCH_DEV
|
||||
do_project_test
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
QA output created by 133
|
||||
=== quota command output ===
|
||||
Disk quotas for Project 123456-project (10)
|
||||
Filesystem Blocks Quota Limit Warn/Time Mounted on
|
||||
SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
|
||||
Filesystem Files Quota Limit Warn/Time Mounted on
|
||||
SCRATCH_DEV 1 100 200 00 [--------] SCRATCH_MNT
|
||||
=== report command output ===
|
||||
123456-project 0 102400 204800 00 [--------]
|
||||
123456-project 1 100 200 00 [--------]
|
||||
|
||||
|
||||
+10
-16
@@ -45,11 +45,14 @@ _cleanup()
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs xfs
|
||||
_supported_fs generic
|
||||
_supported_os Linux IRIX
|
||||
|
||||
_require_test
|
||||
_require_xfs_quota
|
||||
_require_quota
|
||||
_require_xfs_quota_foreign
|
||||
_require_xfs_io_command "chproj"
|
||||
|
||||
# we can't run with group quotas
|
||||
_exclude_scratch_mount_option "gquota" "grpquota"
|
||||
|
||||
@@ -68,21 +71,12 @@ cp /dev/null $seqres.full
|
||||
chmod a+rwx $seqres.full # arbitrary users will write here
|
||||
|
||||
_require_scratch
|
||||
_scratch_mkfs_xfs >/dev/null 2>&1
|
||||
_scratch_mkfs >/dev/null 2>&1
|
||||
_scratch_enable_pquota
|
||||
|
||||
#if pquota's already in mount options then we dont need to enable
|
||||
|
||||
EXTRA_MOUNT_OPTIONS="-o pquota"
|
||||
|
||||
if ! _scratch_mount "$EXTRA_MOUNT_OPTIONS" >$tmp.out 2>&1
|
||||
then
|
||||
cat $tmp.out
|
||||
echo "!!! mount failed"
|
||||
exit
|
||||
fi
|
||||
|
||||
src/feature -p $SCRATCH_DEV
|
||||
[ $? -ne 0 ] && _notrun "Installed kernel does not support project quotas"
|
||||
_qmount_option "prjquota"
|
||||
_qmount
|
||||
_require_prjquota $SCRATCH_DEV
|
||||
|
||||
report_quota()
|
||||
{
|
||||
|
||||
+8
-5
@@ -46,11 +46,12 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
. ./common/quota
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs xfs
|
||||
_supported_fs generic
|
||||
_supported_os Linux
|
||||
|
||||
_require_scratch
|
||||
_require_xfs_quota
|
||||
_require_quota
|
||||
_require_xfs_quota_foreign
|
||||
|
||||
#
|
||||
# Setup temporary replacements for /etc/projects and /etc/projid
|
||||
@@ -66,11 +67,13 @@ EOF
|
||||
#
|
||||
# And make sure we always use our replacements
|
||||
#
|
||||
quota_cmd="xfs_quota -D $tmp.projects -P $tmp.projid"
|
||||
quota_cmd="$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid"
|
||||
|
||||
_scratch_mkfs_xfs >/dev/null 2>&1
|
||||
_qmount_option "pquota"
|
||||
_scratch_mkfs >/dev/null 2>&1
|
||||
_scratch_enable_pquota
|
||||
_qmount_option "prjquota"
|
||||
_qmount
|
||||
_require_prjquota $SCRATCH_DEV
|
||||
|
||||
#
|
||||
# Create the project root
|
||||
|
||||
+8
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user