2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2019 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test if balance will report false ENOSPC error
9 # This is a long existing bug, caused by over-estimated metadata
10 # space_info::bytes_may_use.
12 # There is one proposed patch for btrfs-progs to fix it, titled:
13 # "btrfs-progs: balance: Sync the fs before balancing metadata chunks"
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
21 status=1 # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
30 # get standard environment, filters and checks
34 # remove previous $seqres.full before test
37 # real QA test starts here
39 # Modify as appropriate.
45 _scratch_mkfs > /dev/null
48 $BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/subvol" > /dev/null
50 # Create some small files to take up enough metadata reserved space
51 for ((i = 0; i < $nr_files; i++)) do
52 _pwrite_byte 0xcd 0 1K "$SCRATCH_MNT/subvol/file_$i" > /dev/null
55 _run_btrfs_balance_start -m $SCRATCH_MNT >> $seqres.full
58 echo "Silence is golden"