All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@kernel.org>
To: fstests@vger.kernel.org
Cc: djwong@kernel.org
Subject: [PATCH v3 2/2] generic/603: use project quota create and restore common helpers
Date: Fri, 13 May 2022 02:22:03 +0800	[thread overview]
Message-ID: <20220512182203.2839593-2-zlang@kernel.org> (raw)
In-Reply-To: <20220512182203.2839593-1-zlang@kernel.org>

As common/quota has _create_project_quota and _restore_project_quota
helpers now, so replace local similar functions with them.

Signed-off-by: Zorro Lang <zlang@kernel.org>
---
 tests/generic/603 | 36 ++----------------------------------
 1 file changed, 2 insertions(+), 34 deletions(-)

diff --git a/tests/generic/603 b/tests/generic/603
index b362a3d0..08ddcbf2 100755
--- a/tests/generic/603
+++ b/tests/generic/603
@@ -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
-- 
2.31.1


  reply	other threads:[~2022-05-12 18:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 18:22 [PATCH v3 1/2] generic: soft quota limits testing within grace time Zorro Lang
2022-05-12 18:22 ` Zorro Lang [this message]
2022-05-12 19:07   ` [PATCH v3 2/2] generic/603: use project quota create and restore common helpers Darrick J. Wong
2022-05-12 19:06 ` [PATCH v3 1/2] generic: soft quota limits testing within grace time Darrick J. Wong
2022-05-12 20:16   ` Zorro Lang
2022-05-13  0:58     ` Darrick J. Wong
2022-05-13  5:09       ` Zorro Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220512182203.2839593-2-zlang@kernel.org \
    --to=zlang@kernel.org \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.