[PATCH 1/2] btrfs: inline enable_quota helper in test 301

Boris Burkov <[email protected]>
Newsgroups org.kernel.vger.fstests,org.kernel.vger.linux-btrfs
Message-ID <3234af372b0f16511aa5856aa7a3a0ca28397fcb.1778632843.git.boris@bur.io>
The enable_quota helper in btrfs/301 takes a mode argument ('n', 's',
or anything else) to switch between "no quota", "simple quota", and
"full quota" enable.  Only the simple-quota path is ever exercised by
this test, so the dispatch is dead weight and the indirection just
obscures the actual btrfs command being run.

Inline the two call sites to call 'btrfs quota enable --simple'
directly and drop the helper.

Signed-off-by: Boris Burkov <[email protected]>
---
 tests/btrfs/301 | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/tests/btrfs/301 b/tests/btrfs/301
index 1f72a97b..31243aab 100755
--- a/tests/btrfs/301
+++ b/tests/btrfs/301
@@ -169,16 +169,6 @@ do_enospc_falloc()
 	do_falloc $file $sz
 }
 
-enable_quota()
-{
-	local mode=$1
-
-	[ $mode == "n" ] && return
-	arg=$([ $mode == "s" ] && echo "--simple")
-
-	$BTRFS_UTIL_PROG quota enable $arg $SCRATCH_MNT
-}
-
 get_subvid()
 {
 	_btrfs_get_subvolid $SCRATCH_MNT subv
@@ -198,7 +188,7 @@ prepare()
 {
 	_scratch_mkfs >> $seqres.full
 	_scratch_mount
-	enable_quota "s"
+	$BTRFS_UTIL_PROG quota enable --simple $SCRATCH_MNT
 	$BTRFS_UTIL_PROG subvolume create $subv >> $seqres.full
 	local subvid=$(get_subvid)
 	set_subvol_limit $subvid $limit
@@ -421,7 +411,7 @@ enable_mature()
 	# Sync before enabling squotas to reliably *not* count the writes
 	# we did before enabling.
 	sync
-	enable_quota "s"
+	$BTRFS_UTIL_PROG quota enable --simple $SCRATCH_MNT
 	set_subvol_limit $subvid $limit
 	_scratch_cycle_mount
 	usage=$(get_subvol_usage $subvid)
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.