public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: hch <hch@lst.de>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"fstests@vger.kernel.org" <fstests@vger.kernel.org>,
	Hans Holmberg <Hans.Holmberg@wdc.com>,
	Naohiro Aota <Naohiro.Aota@wdc.com>
Subject: Re: [PATCH] fstests: test premature ENOSPC in zoned garbage collection
Date: Tue, 10 Mar 2026 00:51:48 +0800	[thread overview]
Message-ID: <20260309165148.nxuukjvpizrwawft@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com> (raw)
In-Reply-To: <f39bb05c-f3ea-439e-8a78-71909ec3ef3e@wdc.com>

On Mon, Mar 09, 2026 at 03:35:56PM +0000, Johannes Thumshirn wrote:
> On 3/9/26 4:31 PM, Zorro Lang wrote:
> > On Tue, Feb 10, 2026 at 12:11:03PM +0100, Johannes Thumshirn wrote:
> >> This test stresses garbage collection in zoned file systems by
> >> constantly overwriting the same file. It is inspired by a reproducer for
> >> a btrfs bugifx.
> >>
> >> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> >> ---
> >>   tests/generic/783     | 48 +++++++++++++++++++++++++++++++++++++++++++
> >>   tests/generic/783.out |  2 ++
> >>   2 files changed, 50 insertions(+)
> >>   create mode 100755 tests/generic/783
> >>   create mode 100644 tests/generic/783.out
> >>
> >> diff --git a/tests/generic/783 b/tests/generic/783
> >> new file mode 100755
> >> index 000000000000..f996d78803a1
> >> --- /dev/null
> >> +++ b/tests/generic/783
> >> @@ -0,0 +1,48 @@
> >> +#! /bin/bash
> >> +# SPDX-License-Identifier: GPL-2.0
> >> +# Copyright (c) 2026 Western Digital Corporation.  All Rights Reserved.
> >> +#
> >> +# FS QA Test 783
> >> +#
> >> +# This test stresses garbage collection in zoned file systems by constantly
> >> +# overwriting the same file. It is inspired by a reproducer for a btrfs bugifx.
> >> +
> >> +. ./common/preamble
> >> +_begin_fstest auto quick zone
> >> +
> >> +. ./common/filter
> >> +
> >> +_require_scratch_size $((16 * 1024 * 1024))
> >> +_require_zoned_device "$SCRATCH_DEV"
> >> +
> >> +# This test requires specific data space usage, skip if we have compression
> >> +# enabled.
> >> +_require_no_compress
> >> +
> >> +if [ "$FSTYP" = btrfs ]; then
> >> +	_fixed_by_kernel_commit XXXXXXXXXXXX \
> >> +		"btrfs: zoned: cap delayed refs metadata reservation to avoid overcommit"
> >> +	_fixed_by_kernel_commit XXXXXXXXXXXX \
> >> +		"btrfs: zoned: move partially zone_unusable block groups to reclaim list"
> >> +	_fixed_by_kernel_commit XXXXXXXXXXXX \
> >> +		"btrfs: zoned: add zone reclaim flush state for DATA space_info"
> > Please rebase to latest for-next branch, then change above "_fixed_by_kernel_commit"
> > to "_fixed_by_fs_commit btrfs ...."
> 
> Sure.
> 
> 
> >> +fi
> >> +
> >> +_scratch_mkfs_sized $((16 * 1024 * 1024 * 1024)) &>>$seqres.full
> >> +_scratch_mount
> >> +
> >> +blocks="$(df -TB 1G $SCRATCH_DEV |\
> >> +	$AWK_PROG -v fstyp="$FSTYP" 'match($2, fstyp) {print $3}')"
> > Wouldn’t it make more sense to get the available size here? And there's a helper
> > _get_available_space in common/rc.
> 
> I'll have a look at it and see if it fits.
> 
> 
> >> +
> >> +loops=$(echo "$blocks * 4 - 2" | bc)
> > Is $blocks a huge number? How about using $((blocks * 4 - 2)) simply?
> >
> > Can you add a comment to explain what's this "blocks * 4 - 2" for?
> Will do.
> >> +
> >> +for (( i = 0; i < $loops; i++)); do
> >> +	dd if=/dev/zero of=$SCRATCH_MNT/test bs=1M count=1024 status=none 2>&1
> > Not sure what's the "2>&1" for.
> It was there before I had status=none, I'll fix it in the next revision.
> >
> > This isn't an append write, right? So we keep writting from 0 to 1G? Can you use a
> > comment to explain why we require 16G sized SCRATCH_DEV ?
> Because of the zoned write constraints? We can't overwrite until the 
> zone is reset.

Oh, this's a zoned storage test, sure, thanks! I think we could add a comment here to
remind readers that this is actually a sequential/append write :)

Thanks,
Zorro


      reply	other threads:[~2026-03-09 16:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10 11:11 [PATCH] fstests: test premature ENOSPC in zoned garbage collection Johannes Thumshirn
2026-02-10 15:51 ` Christoph Hellwig
2026-02-10 15:58   ` Johannes Thumshirn
2026-02-11 15:29     ` Zorro Lang
2026-03-05  8:50 ` Johannes Thumshirn
2026-03-09 15:31 ` Zorro Lang
2026-03-09 15:35   ` Johannes Thumshirn
2026-03-09 16:51     ` Zorro Lang [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=20260309165148.nxuukjvpizrwawft@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com \
    --to=zlang@redhat.com \
    --cc=Hans.Holmberg@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=Naohiro.Aota@wdc.com \
    --cc=fstests@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=linux-btrfs@vger.kernel.org \
    /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