2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle. All Rights Reserved.
7 # Test if it's losing data chunk's raid profile after 'btrfs device
11 # Btrfs: avoid losing data raid profile when deleting a device
14 _begin_fstest auto quick volume
16 # Import common functions.
19 # real QA test starts here
21 # Modify as appropriate.
24 _require_scratch_dev_pool 3
25 _require_btrfs_dev_del_by_devid
26 _check_minimal_fs_size $(( 1024 * 1024 * 1024 ))
28 # We need exactly 3 disks to form a fixed stripe layout for this test.
29 _scratch_dev_pool_get 3
31 # create raid1 for data
32 _scratch_pool_mkfs "-d raid1 -b 1G" >> $seqres.full 2>&1
34 # we need an empty data chunk, so nospace_cache is required.
35 _scratch_mount -onospace_cache
37 # if data chunk is empty, 'btrfs device remove' can change raid1 to
39 $BTRFS_UTIL_PROG device delete 2 $SCRATCH_MNT >> $seqres.full 2>&1
41 # save btrfs filesystem df output for debug purpose
42 $BTRFS_UTIL_PROG filesystem df $SCRATCH_MNT 2>&1 | \
43 tee -a $seqres.full | $AWK_PROG -F ':' '/Data,/ {print $1}'