[PATCH 2/2] btrfs/254: fix test failure in case scratch devices are larger than 50G

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



From: Filipe Manana <fdmanana@xxxxxxxx>

If the devices in the scratch pool have a size larger than 50G, then the
test fails due to chunk allocation failure when attempting to create a
multidevice filesystem on $lvdev and $scratch_dev2. This happens because
the $lvdev device has a size of 1G and metadata chunks have a size of 1G
for filesystems with a size greater than 50G, so mkfs fails when it
attempts to allocate chunks since it needs to allocate a 1G metadata
chunk plus a system chunk and a data chunk.

  $ ./check btrfs/254
  FSTYP         -- btrfs
  PLATFORM      -- Linux/x86_64 debian0 6.14.0-rc3-btrfs-next-187+ #1 SMP PREEMPT_DYNAMIC Tue Feb 18 10:53:23 WET 2025
  MKFS_OPTIONS  -- /dev/sdc
  MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

  btrfs/254 2s ... [failed, exit status 1]- output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/254.out.bad)
      --- tests/btrfs/254.out	2024-10-07 12:36:15.532225987 +0100
      +++ /home/fdmanana/git/hub/xfstests/results//btrfs/254.out.bad	2025-02-19 18:07:06.479812229 +0000
      @@ -1,5 +1,13 @@
       QA output created by 254
      -Label: none  uuid: <UUID>
      -	Total devices <NUM> FS bytes used <SIZE>
      -	devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV
      -	*** Some devices missing
      +ERROR: not enough free space to allocate chunk
      +btrfs-progs v6.13
      ...
      (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/254.out /home/fdmanana/git/hub/xfstests/results//btrfs/254.out.bad'  to see the entire diff)

  HINT: You _MAY_ be missing kernel fix:
        770c79fb6550 btrfs: harden identification of a stale device

  Ran: btrfs/254
  Failures: btrfs/254
  Failed 1 of 1 tests

Fix this by creating a 2G $lvdev device instead of 1G.

Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
---
 tests/btrfs/254 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/btrfs/254 b/tests/btrfs/254
index 6523389b..ec303e24 100755
--- a/tests/btrfs/254
+++ b/tests/btrfs/254
@@ -44,8 +44,11 @@ _scratch_dev_pool_get 3
 
 setup_dmdev()
 {
-	# Some small size.
-	size=$((1024 * 1024 * 1024))
+	# On filesystems up to 50G the metadata chunk size if 256M, but on
+	# larger ones it's 1G, so use 2G to ensure the test doesn't fail with
+	# -ENOSPC when running mkfs against $lvdev and $scratch_dev2 in case
+	# the device at $scratch_dev2 has more capacity than 50G.
+	size=$((2 * 1024 * 1024 * 1024))
 	size_in_sector=$((size / 512))
 
 	table="0 $size_in_sector linear $SCRATCH_DEV 0"
-- 
2.45.2





[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