aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Burkov <boris@bur.io>2023-09-28 16:16:46 -0700
committerZorro Lang <zlang@kernel.org>2023-10-05 22:32:01 +0800
commit177848f09a13950899ef067253af8243866148b7 (patch)
tree0d7086a8ce6275459d019d52b35ef5532cb5454f
parentb887c9f7bd387d9dfadce26ce384e4f889c683cb (diff)
downloadxfstests-dev-177848f09a13950899ef067253af8243866148b7.tar.gz
btrfs: quota rescan helpers
Many btrfs tests explicitly trigger quota rescan. This is not a meaningful operation for simple quotas, so we wrap it in a helper that doesn't blow up quite so badly and lets us run those tests where the rescan is a qgroup detail. Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--common/btrfs23
1 files changed, 23 insertions, 0 deletions
diff --git a/common/btrfs b/common/btrfs
index 3884d9904b..c3bffd2ae3 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -710,6 +710,29 @@ _check_regular_qgroup()
_qgroup_mode "$@" | grep -q 'qgroup'
}
+_qgroup_rescan()
+{
+ local mnt=$1
+ local dev=$(findmnt -n -o SOURCE $mnt)
+
+ _check_regular_qgroup $dev || return 1
+ _run_btrfs_util_prog quota rescan -w $mnt
+}
+
+_require_qgroup_rescan()
+{
+ _scratch_mkfs >>$seqres.full 2>&1
+ _scratch_mount
+ _run_btrfs_util_prog quota enable $SCRATCH_MNT
+ # Wait for the first rescan.
+ $BTRFS_UTIL_PROG quota rescan -W $SCRATCH_MNT || \
+ _notrun "not able to wait on a quota rescan"
+ # Make sure we can start a rescan.
+ $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full || \
+ _notrun "not able to run quota rescan"
+ _scratch_unmount
+}
+
_require_scratch_qgroup()
{
_scratch_mkfs >>$seqres.full 2>&1