[PATCH 3/5] common/btrfs: quota rescan helpers

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



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@xxxxxx>
---
 common/btrfs | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/common/btrfs b/common/btrfs
index 66c065a10..d88feaded 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -715,6 +715,31 @@ _qgroup_mode()
 	fi
 }
 
+_check_regular_qgroup()
+{
+	local mnt=$1
+
+	_qgroup_mode $mnt | grep -q 'qgroup'
+}
+
+_qgroup_rescan()
+{
+	local mnt=$1
+
+	_check_regular_qgroup $mnt || 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
+    $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT || \
+         _notrun "not able to run quota rescan"
+	_scratch_unmount
+}
+
 _require_scratch_qgroup()
 {
 	_scratch_mkfs >>$seqres.full 2>&1
-- 
2.41.0




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux