From: Qu Wenruo <wqu@suse.com>
To: Naohiro Aota <naohiro.aota@wdc.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device
Date: Tue, 2 Sep 2025 18:52:09 +0930 [thread overview]
Message-ID: <7f3398a0-9ea1-470f-83d2-f9e0f449246d@suse.com> (raw)
In-Reply-To: <20250902042920.4039355-4-naohiro.aota@wdc.com>
在 2025/9/2 13:59, Naohiro Aota 写道:
> This new test is based on mkfs-tests/001-basic-profiles, and it goes
> through the profiles to mkfs and do some basic checks.
>
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Despite the cond_wait_for_nullbdevs() usage, the test case itself looks
good to me.
With the comment in patch 2 addressed, feel free to add:
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> tests/mkfs-tests/039-zoned-profiles/test.sh | 98 +++++++++++++++++++++
> 1 file changed, 98 insertions(+)
> create mode 100755 tests/mkfs-tests/039-zoned-profiles/test.sh
>
> diff --git a/tests/mkfs-tests/039-zoned-profiles/test.sh b/tests/mkfs-tests/039-zoned-profiles/test.sh
> new file mode 100755
> index 000000000000..f40648cd06e1
> --- /dev/null
> +++ b/tests/mkfs-tests/039-zoned-profiles/test.sh
> @@ -0,0 +1,98 @@
> +#!/bin/bash
> +# test various blockgroup profile combinations, use nullb devices as block
> +# devices. This test is based on mkfs-tests/001-basic-profiles.
> +
> +source "$TEST_TOP/common" || exit
> +
> +check_prereq mkfs.btrfs
> +check_prereq btrfs
> +check_global_prereq blkzone
> +
> +setup_root_helper
> +# Create one 128M device with 4M zones, 32 of them
> +setup_nullbdevs 4 128 4
> +prepare_nullbdevs
> +dev1=${nullb_devs[1]}
> +
> +test_get_info()
> +{
> + local tmp_out
> +
> + tmp_out=$(_mktemp mkfs-get-info)
> + run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$dev1"
> + run_check $SUDO_HELPER "$TOP/btrfs" check "$dev1"
> +
> + # Work around for kernel bug that will treat SINGLE and single
> + # device RAID0 as the same.
> + # Thus kernel may create new SINGLE chunks, causing extra warning
> + # when testing single device RAID0.
> + cond_wait_for_nullbdevs
> + run_check $SUDO_HELPER mount -o ro "$dev1" "$TEST_MNT"
> + run_check_stdout "$TOP/btrfs" filesystem df "$TEST_MNT" > "$tmp_out"
> + if grep -q "Multiple block group profiles detected" "$tmp_out"; then
> + rm -- "$tmp_out"
> + _fail "temporary chunks are not properly cleaned up"
> + fi
> + rm -- "$tmp_out"
> + run_check $SUDO_HELPER "$TOP/btrfs" filesystem usage "$TEST_MNT"
> + run_check $SUDO_HELPER "$TOP/btrfs" device usage "$TEST_MNT"
> + run_check $SUDO_HELPER umount "$TEST_MNT"
> +}
> +
> +test_do_mkfs()
> +{
> + run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@"
> + if run_check_stdout $SUDO_HELPER "$TOP/btrfs" check "$dev1" | grep -iq warning; then
> + _fail "warnings found in check output"
> + fi
> +}
> +
> +test_mkfs_single()
> +{
> + test_do_mkfs "$@" "$dev1"
> + test_get_info
> +}
> +test_mkfs_multi()
> +{
> + test_do_mkfs "$@" ${nullb_devs[@]}
> + test_get_info
> +}
> +
> +test_mkfs_single
> +test_mkfs_single -d single -m single
> +test_mkfs_single -d single -m dup
> +
> +test_mkfs_multi
> +test_mkfs_multi -d single -m single
> +
> +if [ -f "/sys/fs/btrfs/features/raid_stripe_tree" ]; then
> + test_mkfs_single -d dup -m single
> + test_mkfs_single -d dup -m dup
> +
> + test_mkfs_multi -d raid0 -m raid0
> + test_mkfs_multi -d raid1 -m raid1
> + test_mkfs_multi -d raid10 -m raid10
> + # RAID5/6 are not yet supported.
> + # test_mkfs_multi -d raid5 -m raid5
> + # test_mkfs_multi -d raid6 -m raid6
> + test_mkfs_multi -d dup -m dup
> +
> + if [ -f "/sys/fs/btrfs/features/raid1c34" ]; then
> + test_mkfs_multi -d raid1c3 -m raid1c3
> + test_mkfs_multi -d raid1c4 -m raid1c4
> + else
> + _log "skip mount test, missing support for raid1c34"
> + test_do_mkfs -d raid1c3 -m raid1c3 ${nullb_devs[@]}
> + test_do_mkfs -d raid1c4 -m raid1c4 ${nullb_devs[@]}
> + fi
> +
> + # Non-standard profile/device combinations
> +
> + # Single device raid0, two device raid10 (simple mount works on older kernels too)
> + test_do_mkfs -d raid0 -m raid0 "$dev1"
> + test_get_info
> + test_do_mkfs -d raid10 -m raid10 "${nullb_devs[1]}" "${nullb_devs[2]}"
> + test_get_info
> +fi
> +
> +cleanup_nullbdevs
next prev parent reply other threads:[~2025-09-02 9:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 4:29 [PATCH 0/3] btrfs-progs: tests: add new mkfs test for zoned device Naohiro Aota
2025-09-02 4:29 ` [PATCH 1/3] btrfs-progs: tests: check nullb index for the error case Naohiro Aota
2025-09-02 9:11 ` Qu Wenruo
2025-09-03 7:56 ` Naohiro Aota
2025-09-02 4:29 ` [PATCH 2/3] btrfs-progs: tests: add {,cond_}wait_for_nullbdevs Naohiro Aota
2025-09-02 9:15 ` Qu Wenruo
2025-09-03 7:42 ` Naohiro Aota
2025-09-02 4:29 ` [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device Naohiro Aota
2025-09-02 9:22 ` Qu Wenruo [this message]
2025-09-02 9:59 ` Johannes Thumshirn
2025-09-02 18:57 ` David Sterba
2025-09-03 7:45 ` Naohiro Aota
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7f3398a0-9ea1-470f-83d2-f9e0f449246d@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox