]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic/603: use project quota create and restore common helpers
authorZorro Lang <zlang@kernel.org>
Thu, 12 May 2022 15:16:56 +0000 (23:16 +0800)
committerZorro Lang <zlang@kernel.org>
Sat, 21 May 2022 18:51:35 +0000 (02:51 +0800)
As common/quota has _create_project_quota and _restore_project_quota
helpers now, so replace local similar functions with them.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/603

index b362a3d075158b2b4e789576cb491c9ad8f3e8de..08ddcbf2ecf3f150536a6f02fda55547f775a746 100755 (executable)
@@ -13,7 +13,7 @@ _begin_fstest auto quick quota
 # Override the default cleanup function.
 _cleanup()
 {
-       restore_project
+       _restore_project_quota
        cd /
        rm -f $tmp.*
 }
@@ -22,38 +22,6 @@ _cleanup()
 . ./common/filter
 . ./common/quota
 
-require_project()
-{
-       rm -f $tmp.projects $tmp.projid
-       if [ -f /etc/projects ];then
-               cat /etc/projects > $tmp.projects
-       fi
-       if [ -f /etc/projid ];then
-               cat /etc/projid > $tmp.projid
-       fi
-
-       cat >/etc/projects <<EOF
-100:$SCRATCH_MNT/t
-EOF
-       cat >/etc/projid <<EOF
-$qa_user:100
-EOF
-       PROJECT_CHANGED=1
-}
-
-restore_project()
-{
-       if [ "$PROJECT_CHANGED" = "1" ];then
-               rm -f /etc/projects /etc/projid
-               if [ -f $tmp.projects ];then
-                       cat $tmp.projects > /etc/projects
-               fi
-               if [ -f $tmp.projid ];then
-                       cat $tmp.projid > /etc/projid
-               fi
-       fi
-}
-
 init_files()
 {
        local dir=$1
@@ -157,7 +125,7 @@ BLOCK_SIZE=$(_get_file_block_size $SCRATCH_MNT)
 rm -rf $SCRATCH_MNT/t
 mkdir $SCRATCH_MNT/t
 $XFS_IO_PROG -r -c "chproj 100" -c "chattr +P" $SCRATCH_MNT/t
-require_project
+_create_project_quota $SCRATCH_MNT/t 100 $qa_user
 
 echo "### Set up different grace timers to each type of quota"
 UBGRACE=12