Skip to content

Commit b56cb0b

Browse files
adam900710kdave
authored andcommitted
btrfs-progs: tests: add test case for zoned block group tree feature
Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Naohiro Aota <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent bc01b42 commit b56cb0b

File tree

1 file changed

+40
-0
lines changed
  • tests/mkfs-tests/031-zoned-bgt

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
# Verify mkfs for zoned devices support block-group-tree feature
3+
4+
source "$TEST_TOP/common" || exit
5+
6+
setup_root_helper
7+
prepare_test_dev
8+
9+
nullb="$TEST_TOP/nullb"
10+
# Create one 128M device with 4M zones, 32 of them
11+
size=128
12+
zone=4
13+
14+
run_mayfail $SUDO_HELPER "$nullb" setup
15+
if [ $? != 0 ]; then
16+
_not_run "cannot setup nullb environment for zoned devices"
17+
fi
18+
19+
# Record any other pre-existing devices in case creation fails
20+
run_check $SUDO_HELPER "$nullb" ls
21+
22+
# Last line has the name of the device node path
23+
out=$(run_check_stdout $SUDO_HELPER "$nullb" create -s "$size" -z "$zone")
24+
if [ $? != 0 ]; then
25+
_fail "cannot create nullb zoned device $i"
26+
fi
27+
dev=$(echo "$out" | tail -n 1)
28+
name=$(basename "${dev}")
29+
30+
run_check $SUDO_HELPER "$nullb" ls
31+
32+
TEST_DEV="${dev}"
33+
# Use single as it's supported on more kernels
34+
run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -m single -d single -O block-group-tree "${dev}"
35+
run_check_mount_test_dev
36+
run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT"/file bs=1M count=1
37+
run_check $SUDO_HELPER "$TOP/btrfs" filesystem usage -T "$TEST_MNT"
38+
run_check_umount_test_dev
39+
40+
run_check $SUDO_HELPER "$nullb" rm "${name}"

0 commit comments

Comments
 (0)