* [PATCH 0/3] btrfs-progs: tests: add new mkfs test for zoned device
@ 2025-09-02 4:29 Naohiro Aota
2025-09-02 4:29 ` [PATCH 1/3] btrfs-progs: tests: check nullb index for the error case Naohiro Aota
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Naohiro Aota @ 2025-09-02 4:29 UTC (permalink / raw)
To: linux-btrfs; +Cc: Naohiro Aota
This series adds a new mkfs test for zoned device. The test is based on
mkfs-tests/001-basic-profiles, but uses nullb devices instead of loop
devices, to set a zoned profile.
Two preparation patches are necessaly for the test case. The first one
fixes the error handling of _find_free_index(). And, the second one adds
wait_for_nullbdevs and cond_wait_for_nullbdevs like the loop device's
counterpart.
Naohiro Aota (3):
btrfs-progs: tests: check nullb index for the error case
btrfs-progs: tests: add {,cond_}wait_for_nullbdevs
btrfs-progs: tests: add new mkfs test for zoned device
tests/common | 14 +++
tests/mkfs-tests/039-zoned-profiles/test.sh | 98 +++++++++++++++++++++
tests/nullb | 3 +
3 files changed, 115 insertions(+)
create mode 100755 tests/mkfs-tests/039-zoned-profiles/test.sh
--
2.51.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3] btrfs-progs: tests: check nullb index for the error case
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 ` Naohiro Aota
2025-09-02 9:11 ` Qu Wenruo
2025-09-02 4:29 ` [PATCH 2/3] btrfs-progs: tests: add {,cond_}wait_for_nullbdevs Naohiro Aota
2025-09-02 4:29 ` [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device Naohiro Aota
2 siblings, 1 reply; 12+ messages in thread
From: Naohiro Aota @ 2025-09-02 4:29 UTC (permalink / raw)
To: linux-btrfs; +Cc: Naohiro Aota
"_find_free_index" can return "ERROR: ...". Check the return value for the
case and fail the test.
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
tests/nullb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/nullb b/tests/nullb
index 457ae0d8354a..bfc5640c4470 100755
--- a/tests/nullb
+++ b/tests/nullb
@@ -146,6 +146,9 @@ fi
if [ "$CMD" = 'create' ]; then
_check_setup
index=$(_find_free_index)
+ if [[ "$index" = ERROR* ]]; then
+ _error "$index"
+ fi
name="nullb$index"
# size in MB
size=$(_parse_device_size "$@")
--
2.51.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] btrfs-progs: tests: add {,cond_}wait_for_nullbdevs
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 4:29 ` Naohiro Aota
2025-09-02 9:15 ` Qu Wenruo
2025-09-02 4:29 ` [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device Naohiro Aota
2 siblings, 1 reply; 12+ messages in thread
From: Naohiro Aota @ 2025-09-02 4:29 UTC (permalink / raw)
To: linux-btrfs; +Cc: Naohiro Aota
It is a nullb version of {,cond_}wait_for_loopdevs. It waits for all the
nullb devices are ready to use.
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
tests/common | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tests/common b/tests/common
index 2c90acb90cfc..1df37c390bf6 100644
--- a/tests/common
+++ b/tests/common
@@ -984,6 +984,20 @@ cleanup_nullbdevs()
name=$(basename "$dev")
run_check $SUDO_HELPER "$nullb" rm "$name"
done
+ unset nullb_devs
+}
+
+wait_for_nullbdevs()
+{
+ for dev in ${nullb_devs[@]}; do
+ run_mayfail $SUDO_HELPER "$TOP/btrfs" device ready "$dev"
+ done
+}
+
+cond_wait_for_nullbdevs() {
+ if [ -n "${nullb_devs[1]}" ]; then
+ wait_for_nullbdevs
+ fi
}
init_env()
--
2.51.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device
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 4:29 ` [PATCH 2/3] btrfs-progs: tests: add {,cond_}wait_for_nullbdevs Naohiro Aota
@ 2025-09-02 4:29 ` Naohiro Aota
2025-09-02 9:22 ` Qu Wenruo
2025-09-02 9:59 ` Johannes Thumshirn
2 siblings, 2 replies; 12+ messages in thread
From: Naohiro Aota @ 2025-09-02 4:29 UTC (permalink / raw)
To: linux-btrfs; +Cc: 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>
---
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
--
2.51.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] btrfs-progs: tests: check nullb index for the error case
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
0 siblings, 1 reply; 12+ messages in thread
From: Qu Wenruo @ 2025-09-02 9:11 UTC (permalink / raw)
To: Naohiro Aota, linux-btrfs
在 2025/9/2 13:59, Naohiro Aota 写道:
> "_find_free_index" can return "ERROR: ...". Check the return value for the
> case and fail the test.
>
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
> tests/nullb | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tests/nullb b/tests/nullb
> index 457ae0d8354a..bfc5640c4470 100755
> --- a/tests/nullb
> +++ b/tests/nullb
> @@ -146,6 +146,9 @@ fi
> if [ "$CMD" = 'create' ]; then
> _check_setup
> index=$(_find_free_index)
> + if [[ "$index" = ERROR* ]]; then
> + _error "$index"
> + fi
I think the bigger problem is that:
- _error() output into stdout instead of stderr
- the "exit 1" doesn't help in this case
It will only kill the child bash, not the calling one.
So I'd prefer to make _error() to output the warning to stderr, so that
index will be empty on error.
Thanks,
Qu
> name="nullb$index"
> # size in MB
> size=$(_parse_device_size "$@")
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] btrfs-progs: tests: add {,cond_}wait_for_nullbdevs
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
0 siblings, 1 reply; 12+ messages in thread
From: Qu Wenruo @ 2025-09-02 9:15 UTC (permalink / raw)
To: Naohiro Aota, linux-btrfs
在 2025/9/2 13:59, Naohiro Aota 写道:
> It is a nullb version of {,cond_}wait_for_loopdevs. It waits for all the
> nullb devices are ready to use.
>
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
> tests/common | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/tests/common b/tests/common
> index 2c90acb90cfc..1df37c390bf6 100644
> --- a/tests/common
> +++ b/tests/common
> @@ -984,6 +984,20 @@ cleanup_nullbdevs()
> name=$(basename "$dev")
> run_check $SUDO_HELPER "$nullb" rm "$name"
> done
> + unset nullb_devs
> +}
> +
> +wait_for_nullbdevs()
> +{
> + for dev in ${nullb_devs[@]}; do
> + run_mayfail $SUDO_HELPER "$TOP/btrfs" device ready "$dev"
> + done
> +}
> +
> +cond_wait_for_nullbdevs() {
> + if [ -n "${nullb_devs[1]}" ]; then
> + wait_for_nullbdevs
> + fi
I guess we don't need cond_wait_for_nummbdevs()?
As if nullb_devs array is not defined/empty, the for loop inside
wait_for_nullbdevs() will do nothing anyway.
Thanks,
Qu
> }
>
> init_env()
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device
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
2025-09-02 9:59 ` Johannes Thumshirn
1 sibling, 0 replies; 12+ messages in thread
From: Qu Wenruo @ 2025-09-02 9:22 UTC (permalink / raw)
To: Naohiro Aota, linux-btrfs
在 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device
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
@ 2025-09-02 9:59 ` Johannes Thumshirn
2025-09-02 18:57 ` David Sterba
1 sibling, 1 reply; 12+ messages in thread
From: Johannes Thumshirn @ 2025-09-02 9:59 UTC (permalink / raw)
To: Naohiro Aota, linux-btrfs@vger.kernel.org
On 9/2/25 6:30 AM, Naohiro Aota wrote:
> +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
Wouldn't this need to check if mkfs.btrfs supports "-O raid-stripe-tree"
as well?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device
2025-09-02 9:59 ` Johannes Thumshirn
@ 2025-09-02 18:57 ` David Sterba
2025-09-03 7:45 ` Naohiro Aota
0 siblings, 1 reply; 12+ messages in thread
From: David Sterba @ 2025-09-02 18:57 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: Naohiro Aota, linux-btrfs@vger.kernel.org
On Tue, Sep 02, 2025 at 09:59:20AM +0000, Johannes Thumshirn wrote:
> On 9/2/25 6:30 AM, Naohiro Aota wrote:
> > +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
> Wouldn't this need to check if mkfs.btrfs supports "-O raid-stripe-tree"
> as well?
The assumption of the environment is that kernel may not support all
features so there are the sysfs checks. For progs this assumes that it's
either a git version or the the testsuite version matches the installed
progs version.
We could possibly encode the assumptions simlar to what check_prereq()
does but for version-dependent features. I'm not sure if it's worth, so
far nobody else complained but it does make sense to make it more
robust.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] btrfs-progs: tests: add {,cond_}wait_for_nullbdevs
2025-09-02 9:15 ` Qu Wenruo
@ 2025-09-03 7:42 ` Naohiro Aota
0 siblings, 0 replies; 12+ messages in thread
From: Naohiro Aota @ 2025-09-03 7:42 UTC (permalink / raw)
To: WenRuo Qu, Naohiro Aota, linux-btrfs@vger.kernel.org
On Tue Sep 2, 2025 at 6:15 PM JST, Qu Wenruo wrote:
>
>
> 在 2025/9/2 13:59, Naohiro Aota 写道:
>> It is a nullb version of {,cond_}wait_for_loopdevs. It waits for all the
>> nullb devices are ready to use.
>>
>> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
>> ---
>> tests/common | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/tests/common b/tests/common
>> index 2c90acb90cfc..1df37c390bf6 100644
>> --- a/tests/common
>> +++ b/tests/common
>> @@ -984,6 +984,20 @@ cleanup_nullbdevs()
>> name=$(basename "$dev")
>> run_check $SUDO_HELPER "$nullb" rm "$name"
>> done
>> + unset nullb_devs
>> +}
>> +
>> +wait_for_nullbdevs()
>> +{
>> + for dev in ${nullb_devs[@]}; do
>> + run_mayfail $SUDO_HELPER "$TOP/btrfs" device ready "$dev"
>> + done
>> +}
>> +
>> +cond_wait_for_nullbdevs() {
>> + if [ -n "${nullb_devs[1]}" ]; then
>> + wait_for_nullbdevs
>> + fi
>
> I guess we don't need cond_wait_for_nummbdevs()?
>
> As if nullb_devs array is not defined/empty, the for loop inside
> wait_for_nullbdevs() will do nothing anyway.
Ah, yes, that's correct. I followed cond_wait_for_loopdevs here. Maybe,
we should drop wait_for_loopdevs and convert the callers as wel.
>
> Thanks,
> Qu
>
>> }
>>
>> init_env()
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] btrfs-progs: tests: add new mkfs test for zoned device
2025-09-02 18:57 ` David Sterba
@ 2025-09-03 7:45 ` Naohiro Aota
0 siblings, 0 replies; 12+ messages in thread
From: Naohiro Aota @ 2025-09-03 7:45 UTC (permalink / raw)
To: dsterba@suse.cz, Johannes Thumshirn; +Cc: linux-btrfs@vger.kernel.org
On Wed Sep 3, 2025 at 3:57 AM JST, David Sterba wrote:
> On Tue, Sep 02, 2025 at 09:59:20AM +0000, Johannes Thumshirn wrote:
>> On 9/2/25 6:30 AM, Naohiro Aota wrote:
>> > +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
>> Wouldn't this need to check if mkfs.btrfs supports "-O raid-stripe-tree"
>> as well?
>
> The assumption of the environment is that kernel may not support all
> features so there are the sysfs checks. For progs this assumes that it's
> either a git version or the the testsuite version matches the installed
> progs version.
>
> We could possibly encode the assumptions simlar to what check_prereq()
> does but for version-dependent features. I'm not sure if it's worth, so
> far nobody else complained but it does make sense to make it more
> robust.
I remembered that raid-stripe-tree is still only available with the
EXPERIMENTAL config. I'll add "_test_config EXPERIMENTAL" for this part.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] btrfs-progs: tests: check nullb index for the error case
2025-09-02 9:11 ` Qu Wenruo
@ 2025-09-03 7:56 ` Naohiro Aota
0 siblings, 0 replies; 12+ messages in thread
From: Naohiro Aota @ 2025-09-03 7:56 UTC (permalink / raw)
To: WenRuo Qu, Naohiro Aota, linux-btrfs@vger.kernel.org
On Tue Sep 2, 2025 at 6:11 PM JST, Qu Wenruo wrote:
>
>
> 在 2025/9/2 13:59, Naohiro Aota 写道:
>> "_find_free_index" can return "ERROR: ...". Check the return value for the
>> case and fail the test.
>>
>> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
>> ---
>> tests/nullb | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/tests/nullb b/tests/nullb
>> index 457ae0d8354a..bfc5640c4470 100755
>> --- a/tests/nullb
>> +++ b/tests/nullb
>> @@ -146,6 +146,9 @@ fi
>> if [ "$CMD" = 'create' ]; then
>> _check_setup
>> index=$(_find_free_index)
>> + if [[ "$index" = ERROR* ]]; then
>> + _error "$index"
>> + fi
>
> I think the bigger problem is that:
>
> - _error() output into stdout instead of stderr
>
> - the "exit 1" doesn't help in this case
> It will only kill the child bash, not the calling one.
>
> So I'd prefer to make _error() to output the warning to stderr, so that
> index will be empty on error.
Ah, yes. It's safer to do so. I'll revise the patch.
>
> Thanks,
> Qu
>
>> name="nullb$index"
>> # size in MB
>> size=$(_parse_device_size "$@")
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-09-03 7:56 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2025-09-02 9:59 ` Johannes Thumshirn
2025-09-02 18:57 ` David Sterba
2025-09-03 7:45 ` Naohiro Aota
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox