]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/rc: add btrfs support for _small_fs_size_mb()
authorQu Wenruo <wqu@suse.com>
Wed, 25 Jun 2025 23:20:21 +0000 (08:50 +0930)
committerZorro Lang <zlang@kernel.org>
Thu, 26 Jun 2025 20:07:09 +0000 (04:07 +0800)
[FAILURE]
With the incoming shutdown ioctl and remove_bdev callback support, btrfs
is able to run the shutdown group.

However test case like generic/042 fails on btrfs:

generic/042 9s ... [failed, exit status 1]- output mismatch (see /home/adam/xfstests/results//generic/042.out.bad)
    --- tests/generic/042.out 2022-05-11 11:25:30.763333331 +0930
    +++ /home/adam/xfstests/results//generic/042.out.bad 2025-06-26 08:43:56.078509452 +0930
    @@ -1,10 +1 @@
     QA output created by 042
    -falloc -k
    -wrote 65536/65536 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    -fpunch
    -wrote 65536/65536 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    ...
    (Run 'diff -u /home/adam/xfstests/tests/generic/042.out /home/adam/xfstests/results//generic/042.out.bad'  to see the entire diff)
Ran: generic/042
Failures: generic/042
Failed 1 of 1 tests

[CAUSE]
The full output shows the reason directly:

  ERROR: '/mnt/scratch/042.img' is too small to make a usable filesystem
  ERROR: minimum size for each btrfs device is 114294784

And the helper _small_fs_size_mb() doesn't support btrfs, thus the small
25M file is not large enough to support a btrfs.

[FIX]
Fix the false alert by adding btrfs support in _small_fs_size_mb().

The btrfs minimal size is depending on the profiles even on a single
device, e.g. DUP data will cost extra space.

So here we go safe by using 512MiB as the minimal size for btrfs.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc

index c6393576de133486870d61697a688a8081322501..b7e95f03db12d7a084bdf48960335c34bb0957e4 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1237,6 +1237,11 @@ _small_fs_size_mb()
                # it will change again. So just set it 128M.
                fs_min_size=128
                ;;
+       btrfs)
+               # Minimal btrfs size depends on the profiles, for single device
+               # case, 512M should be enough.
+               fs_min_size=512
+               ;;
        esac
        (( size < fs_min_size )) && size="$fs_min_size"