@@ -14,6 +14,7 @@ _begin_fstest auto qgroup limit
_supported_fs btrfs
_require_scratch
+_require_qgroup_rescan
_require_btrfs_qgroup_report
# Test to make sure we can actually turn it on and it makes sense
@@ -25,7 +25,7 @@ _scratch_mkfs >/dev/null
_scratch_mount
_run_btrfs_util_prog quota enable $SCRATCH_MNT
-_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+_qgroup_rescan $SCRATCH_MNT
# Increase the probability of generating de-refer extent, and decrease
# other.
@@ -94,7 +94,7 @@ _explode_fs_tree 1 $SCRATCH_MNT/snap2/files-snap2
# Enable qgroups now that we have our filesystem prepared. This
# will kick off a scan which we will have to wait for.
_run_btrfs_util_prog quota enable $SCRATCH_MNT
-_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+_qgroup_rescan $SCRATCH_MNT
# Remount to clear cache, force everything to disk
_scratch_cycle_mount
@@ -39,7 +39,7 @@ sync
# enable quota and rescan to get correct number
_run_btrfs_util_prog quota enable $SCRATCH_MNT
-_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+_qgroup_rescan $SCRATCH_MNT
# now balance data block groups to corrupt qgroup
_run_btrfs_balance_start -d $SCRATCH_MNT >> $seqres.full
@@ -28,7 +28,7 @@ _scratch_mkfs >/dev/null
_scratch_mount "-o enospc_debug"
_run_btrfs_util_prog quota enable $SCRATCH_MNT
-_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+_qgroup_rescan $SCRATCH_MNT
_run_btrfs_util_prog qgroup limit 512K 0/5 $SCRATCH_MNT
# The amount of written data may change due to different nodesize at mkfs time,
@@ -30,7 +30,7 @@ SUBVOL=$SCRATCH_MNT/subvol
_run_btrfs_util_prog subvolume create $SUBVOL
_run_btrfs_util_prog quota enable $SCRATCH_MNT
-_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+_qgroup_rescan $SCRATCH_MNT
_run_btrfs_util_prog qgroup limit -e 1G $SUBVOL
# Write and delete files within 1G limits, multiple times
@@ -24,7 +24,7 @@ _scratch_mkfs >/dev/null
_scratch_mount
_run_btrfs_util_prog quota enable $SCRATCH_MNT
-_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+_qgroup_rescan $SCRATCH_MNT
_run_btrfs_util_prog qgroup limit 100M 0/5 $SCRATCH_MNT
testfile1=$SCRATCH_MNT/testfile1
@@ -35,7 +35,7 @@ $BTRFS_UTIL_PROG subvolume snapshot "$SCRATCH_MNT/subvol" \
"$SCRATCH_MNT/snapshot" > /dev/null
$BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null
-$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
+_qgroup_rescan $SCRATCH_MNT > /dev/null
# Create high level qgroup
$BTRFS_UTIL_PROG qgroup create 1/0 "$SCRATCH_MNT"
@@ -45,7 +45,7 @@ $BTRFS_UTIL_PROG qgroup assign "$SCRATCH_MNT/snapshot" 1/0 "$SCRATCH_MNT" \
# Above assignment will mark qgroup inconsistent due to the shared extents
# between subvol/snapshot/high level qgroup, do rescan here.
-$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
+_qgroup_rescan $SCRATCH_MNT > /dev/null
# Now remove the qgroup relationship and make 1/0 childless
# Due to the shared extent outside of 1/0, we will mark qgroup inconsistent
@@ -54,7 +54,7 @@ $BTRFS_UTIL_PROG qgroup remove "$SCRATCH_MNT/snapshot" 1/0 "$SCRATCH_MNT" \
2>&1 | _filter_btrfs_qgroup_assign_warnings
# Above removal also marks qgroup inconsistent, rescan again
-$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
+_qgroup_rescan $SCRATCH_MNT > /dev/null
# After the test, btrfs check will verify qgroup numbers to catch any
# corruption.
@@ -33,7 +33,7 @@ _scratch_mount
mkdir -p "$SCRATCH_MNT/snapshots"
$BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/src" > /dev/null
$BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null
-$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
+_qgroup_rescan "$SCRATCH_MNT" > /dev/null
fill_workload()
{
@@ -27,7 +27,7 @@ _scratch_mkfs > /dev/null
_scratch_mount
$BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null
-$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
+_qgroup_rescan "$SCRATCH_MNT" > /dev/null
$BTRFS_UTIL_PROG qgroup limit -e 1G "$SCRATCH_MNT"
$XFS_IO_PROG -f -c "falloc 0 900M" "$SCRATCH_MNT/padding"
@@ -30,7 +30,7 @@ _log_writes_mkfs >> $seqres.full 2>&1
_log_writes_mount
$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT >> $seqres.full
-$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
+_qgroup_rescan $SCRATCH_MNT >> $seqres.full
# Create enough metadata for later balance
for ((i = 0; i < $nr_files; i++)); do
@@ -26,7 +26,7 @@ _scratch_mkfs > /dev/null
_scratch_mount
$BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null
-$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
+_qgroup_rescan "$SCRATCH_MNT" > /dev/null
$BTRFS_UTIL_PROG qgroup limit -e 256M "$SCRATCH_MNT"
# Create a file with the following layout:
@@ -29,7 +29,7 @@ _pwrite_byte 0xcd 0 16M "$SCRATCH_MNT/src/file" > /dev/null
# by qgroup
sync
$BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT"
-$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
+_qgroup_rescan "$SCRATCH_MNT" > /dev/null
$BTRFS_UTIL_PROG qgroup create 1/0 "$SCRATCH_MNT"
# Create a snapshot with qgroup inherit
@@ -30,7 +30,7 @@ assign_shared_test()
echo "=== qgroup assign shared test ===" >> $seqres.full
$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
- $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
+ _qgroup_rescan $SCRATCH_MNT >> $seqres.full
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/b >> $seqres.full
@@ -54,7 +54,7 @@ assign_no_shared_test()
echo "=== qgroup assign no shared test ===" >> $seqres.full
$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
- $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
+ _qgroup_rescan $SCRATCH_MNT >> $seqres.full
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/b >> $seqres.full
@@ -75,7 +75,7 @@ snapshot_test()
echo "=== qgroup snapshot test ===" >> $seqres.full
$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
- $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
+ _qgroup_rescan $SCRATCH_MNT >> $seqres.full
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full
_ddt of="$SCRATCH_MNT"/a/file1 bs=1M count=1 >> $seqres.full 2>&1
@@ -31,7 +31,7 @@ _pwrite_byte 0xcd 0 1G $SCRATCH_MNT/file >> $seqres.full
sync
$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
-$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
+_qgroup_rescan $SCRATCH_MNT >> $seqres.full
# Set the limit to just 512MiB, which is way below the existing usage
$BTRFS_UTIL_PROG qgroup limit 512M 0/5 $SCRATCH_MNT
@@ -46,7 +46,7 @@ _pwrite_byte 0xcd 0 900m $SCRATCH_MNT/file >> $seqres.full
sync
$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
-$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
+_qgroup_rescan $SCRATCH_MNT >> $seqres.full
# set the limit to 1 g, leaving us just 100mb of slack space
$BTRFS_UTIL_PROG qgroup limit 1G 0/5 $SCRATCH_MNT
These tests can pass in simple quota mode if we skip the rescans via the wrapper. Signed-off-by: Boris Burkov <boris@bur.io> --- tests/btrfs/022 | 1 + tests/btrfs/028 | 2 +- tests/btrfs/104 | 2 +- tests/btrfs/123 | 2 +- tests/btrfs/126 | 2 +- tests/btrfs/139 | 2 +- tests/btrfs/153 | 2 +- tests/btrfs/171 | 6 +++--- tests/btrfs/179 | 2 +- tests/btrfs/180 | 2 +- tests/btrfs/190 | 2 +- tests/btrfs/193 | 2 +- tests/btrfs/210 | 2 +- tests/btrfs/224 | 6 +++--- tests/btrfs/230 | 2 +- tests/btrfs/232 | 2 +- 16 files changed, 20 insertions(+), 19 deletions(-)