]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
btrfs: use new rescan wrapper
authorBoris Burkov <boris@bur.io>
Thu, 28 Sep 2023 23:16:47 +0000 (16:16 -0700)
committerZorro Lang <zlang@kernel.org>
Thu, 5 Oct 2023 14:32:01 +0000 (22:32 +0800)
These tests can pass in simple quota mode if we skip the rescans via the
wrapper.

Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
16 files changed:
tests/btrfs/022
tests/btrfs/028
tests/btrfs/104
tests/btrfs/123
tests/btrfs/126
tests/btrfs/139
tests/btrfs/153
tests/btrfs/171
tests/btrfs/179
tests/btrfs/180
tests/btrfs/190
tests/btrfs/193
tests/btrfs/210
tests/btrfs/224
tests/btrfs/230
tests/btrfs/232

index e2d37b0949b018dd26ec5b3c004c3cc3efb41bb8..b1ef2fdf78764027bf959bd52c3c6075a9ddd132 100755 (executable)
@@ -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
index fe0678f867dce8f32f637bf03c2368be55a44831..c4080c950c465fa28ad40ce1bcc1ae967bbc2991 100755 (executable)
@@ -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.
index 499de6bfb89a7e67f6b32b1260a4f12f89c43326..c9528eb13d610d793ded40b51d4c51a583b96f1c 100755 (executable)
@@ -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
index c179eeec97d2ba9455fdad3476a41c19c44783a2..4c5b7e116a4d9ea811738f15c193ea4483d6a9c5 100755 (executable)
@@ -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
index 2b0edb65b4bfcfdcc60e71336ae624bb88f0d649..1bb24e00f98ace30fcd636e9b4cfcf5460b4e55e 100755 (executable)
@@ -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,
index c4b09f9fc1daca12e0997eb40961bc5fe519f67b..f3d92ba468b6d18e5e8bbc01e0e4c59e1beaafd6 100755 (executable)
@@ -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
index 99fab1018fa9764b6d0d3b6006a57653f28ae86e..4a5fe2b8ce4faeee5c9dcc2930314ffa5c8d0e66 100755 (executable)
@@ -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
index 461cdd0fa4d6467829cf2013b47f82107bb7c67f..6a1ed1c1a9d4f4035d889096687a7f26b85f62c8 100755 (executable)
@@ -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.
index 479667f05fd2753b18c4c382307d8197ed25b85f..00013af0a19038fff8cd9d108a5b34a74bf9cec9 100755 (executable)
@@ -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()
 {
index b7c8dac96eb541348b54f12025e35316df8513db..aa195f7b40085dbfcb06b5494cb8d35a45238c84 100755 (executable)
@@ -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"
index 974438c15055e451e3947e771629f36dcf26947f..f78c14fe446458dadf408072fc72665b5a7c04cf 100755 (executable)
@@ -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
index b4632ab0a977ae22598c27911c82196566889f00..67220c7a5c68dffe59a76907d2971abea83d26e8 100755 (executable)
@@ -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:
index 383a307ff02d188c90d384c169aa6fb77c1ab424..f3d769fa09de6baab00446dbb500fc64e9ec3ef5 100755 (executable)
@@ -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
index d7ec573600c518581a60b49ff661363ae45edad0..de10942fe7a366c6d9ef2673b5c02459682eaab4 100755 (executable)
@@ -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
index 46b0c63693a3130c55c37c9a5610304936bc9e67..7a4cd18e926872dd0316652422000a2bb3a1bbe1 100755 (executable)
@@ -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
index 02c7e49de8ceec49576e69a06b87b8b8e3630068..debe070bbca24dd99e8862ec5638276664cb5655 100755 (executable)
@@ -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