Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: Leo Martins <loemra.dev@gmail.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org
Subject: Re: [PATCH v2 3/3] fstests: btrfs: test RAID conversions under stress
Date: Tue, 14 Oct 2025 20:31:24 -0700	[thread overview]
Message-ID: <20251015033124.GC1702774@zen.localdomain> (raw)
In-Reply-To: <455b9a2b102631febc1b05802006d3d304d4baeb.1759534540.git.loemra.dev@gmail.com>

On Fri, Oct 03, 2025 at 04:41:59PM -0700, Leo Martins wrote:
> Add test to test btrfs conversion while being stressed. This is
> important since btrfs no longer allows allocating from different RAID
> block_groups during conversions meaning there may be added enospc
> pressure.
> 

Aside from the patch intermingling stuff, this test looks good to me,
thanks for adding it.

Reviewed-by: Boris Burkov <boris@bur.io>

> Signed-off-by: Leo Martins <loemra.dev@gmail.com>
> ---
>  tests/btrfs/337     | 95 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/337.out |  2 +
>  2 files changed, 97 insertions(+)
>  create mode 100755 tests/btrfs/337
>  create mode 100644 tests/btrfs/337.out
> 
> diff --git a/tests/btrfs/337 b/tests/btrfs/337
> new file mode 100755
> index 00000000..fa335ed7
> --- /dev/null
> +++ b/tests/btrfs/337
> @@ -0,0 +1,95 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2025 Meta Platforms, Inc. All Rights Reserved.
> +#
> +# FS QA Test btrfs/337
> +#
> +# Test RAID profile conversion with concurrent allocations.
> +# This combines profile conversion (like btrfs/195) with concurrent
> +# fsstress allocations (like btrfs/060-064).
> +
> +. ./common/preamble
> +_begin_fstest auto volume balance scrub raid
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -f $tmp.*
> +	_kill_fsstress
> +}
> +
> +. ./common/filter
> +# we check scratch dev after each loop
> +_require_scratch_nocheck
> +_require_scratch_dev_pool 4
> +# Zoned btrfs only supports SINGLE profile
> +_require_non_zoned_device "${SCRATCH_DEV}"
> +
> +# Load up the available configs
> +_btrfs_get_profile_configs
> +declare -a TEST_VECTORS=(
> +# $nr_dev_min:$data:$metadata:$data_convert:$metadata_convert
> +"4:single:raid1"
> +"4:single:raid0"
> +"4:single:raid10"
> +"4:single:dup"
> +"4:single:raid5"
> +"4:single:raid6"
> +"2:raid1:single"
> +)
> +
> +run_testcase() {
> +	IFS=':' read -ra args <<< $1
> +	num_disks=${args[0]}
> +	src_type=${args[1]}
> +	dst_type=${args[2]}
> +
> +	if [[ ! "${_btrfs_profile_configs[@]}" =~ "$dst_type" ]]; then
> +		echo "=== Skipping test: $1 ===" >> $seqres.full
> +		return
> +	fi
> +
> +	_scratch_dev_pool_get $num_disks
> +
> +	echo "=== Running test: $1 (converting $src_type -> $dst_type) ===" >> $seqres.full
> +
> +	_scratch_pool_mkfs -d$src_type -m$src_type >> $seqres.full 2>&1
> +	_scratch_mount
> +
> +	echo "Creating initial data..." >> $seqres.full
> +	_run_fsstress -d $SCRATCH_MNT -w -n 10000 >> $seqres.full 2>&1
> +
> +	args=`_scale_fsstress_args -p 20 -n 1000 -d $SCRATCH_MNT/stressdir`
> +	echo "Starting fsstress: $args" >> $seqres.full
> +	_run_fsstress_bg $args
> +
> +	echo "Starting conversion: $src_type -> $dst_type" >> $seqres.full
> +	_run_btrfs_balance_start -f -dconvert=$dst_type $SCRATCH_MNT >> $seqres.full
> +	[ $? -eq 0 ] || echo "$1: Failed convert"
> +
> +	echo "Waiting for fsstress to complete..." >> $seqres.full
> +	_wait_for_fsstress
> +
> +	# Verify the conversion was successful
> +	echo "Checking filesystem profile after conversion..." >> $seqres.full
> +	$BTRFS_UTIL_PROG filesystem df $SCRATCH_MNT >> $seqres.full
> +
> +	# Scrub to verify data integrity
> +	echo "Scrubbing filesystem..." >> $seqres.full
> +	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >> $seqres.full 2>&1
> +	if [ $? -ne 0 ]; then
> +		echo "$1: Scrub found errors"
> +	fi
> +
> +	_scratch_unmount
> +	_check_scratch_fs
> +	_scratch_dev_pool_put
> +}
> +
> +echo "Silence is golden"
> +for i in "${TEST_VECTORS[@]}"; do
> +	run_testcase $i
> +done
> +
> +status=0
> +exit
> diff --git a/tests/btrfs/337.out b/tests/btrfs/337.out
> new file mode 100644
> index 00000000..d80a9830
> --- /dev/null
> +++ b/tests/btrfs/337.out
> @@ -0,0 +1,2 @@
> +QA output created by 337
> +Silence is golden
> -- 
> 2.47.3
> 

      parent reply	other threads:[~2025-10-15  3:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03 23:41 [PATCH v2 0/3] btrfs: find_free_extent cleanups Leo Martins
2025-10-03 23:41 ` [PATCH v2 1/3] btrfs: remove ffe RAID loop Leo Martins
2025-10-15  3:29   ` Boris Burkov
2025-10-03 23:41 ` [PATCH v2 2/3] btrfs: add tracing for find_free_extent skip conditions Leo Martins
2025-10-15  3:28   ` Boris Burkov
2025-10-03 23:41 ` [PATCH v2 3/3] fstests: btrfs: test RAID conversions under stress Leo Martins
2025-10-04  1:54   ` Qu Wenruo
2025-10-06 17:37     ` Leo Martins
2025-10-06 18:16       ` David Sterba
2025-10-15  3:31   ` Boris Burkov [this message]

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=20251015033124.GC1702774@zen.localdomain \
    --to=boris@bur.io \
    --cc=fstests@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=loemra.dev@gmail.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