Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Eric Sandeen <sandeen@redhat.com>
Cc: "fstests@vger.kernel.org" <fstests@vger.kernel.org>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: use -f by default for mkfs as xfs/extN do
Date: Thu, 4 Jun 2026 21:08:52 -0700	[thread overview]
Message-ID: <aiJL1CBTV_N4YAtb@infradead.org> (raw)
In-Reply-To: <a31e9841-fd0c-435f-b376-86a7e01ddca7@redhat.com>

On Tue, Jun 02, 2026 at 10:47:39PM -0500, Eric Sandeen wrote:
> Recently saw a case where testing ext4, xfs, then btrfs failed all
> btrfs tests because mkfs.btrfs refused to overwrite the left-over
> xfs filesystem on $SCRATCH_DEV.
> 
> This seems well-enough fixed by only making the change to _scratch_mkfs,
> but several other helper functions explicitly use -f / -F for xfs
> and extN, so I've updated them for btrfs as well.

I haven't run into this yet, but it seem like btrfs needs this.
But maybe you should also Cc the btrfs list?

> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> TBH I'm a little baffled, has nobody really run into this before, or
> am I missing something?
> 
>  common/rc | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 9632b211..e77edf97 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -871,7 +871,7 @@ _test_mkfs()
>          $MKFS_UDF_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null
>  	;;
>      btrfs)
> -        $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null
> +        $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $TEST_DEV > /dev/null
>  	;;
>      ext2|ext3|ext4)
>  	$MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* $TEST_DEV
> @@ -920,7 +920,7 @@ _try_mkfs_dev()
>          $MKFS_UDF_PROG $MKFS_OPTIONS $*
>  	;;
>      btrfs)
> -        $MKFS_BTRFS_PROG $MKFS_OPTIONS $*
> +        $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $*
>  	;;
>      ext2|ext3|ext4)
>  	$MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $*
> @@ -1010,7 +1010,7 @@ _scratch_mkfs()
>  		mkfs_filter="cat"
>  		;;
>  	btrfs)
> -		mkfs_cmd="$MKFS_BTRFS_PROG"
> +		mkfs_cmd="$MKFS_BTRFS_PROG -f"
>  		mkfs_filter="cat"
>  		;;
>  	ext3)
> @@ -1176,7 +1176,7 @@ _scratch_pool_mkfs()
>  {
>      case $FSTYP in
>      btrfs)
> -        $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null
> +        $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null
>          ;;
>      *)
>          echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2
> @@ -1369,7 +1369,7 @@ _try_scratch_mkfs_sized()
>  		# the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size()
>  		(( fssize < $((256 * 1024 * 1024)) )) &&
>  			! _scratch_btrfs_is_zoned && mixed_opt='--mixed'
> -		$MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV
> +		$MKFS_BTRFS_PROG -f $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV
>  		;;
>  	jfs)
>  		${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS "$@" $SCRATCH_DEV $blocks
> -- 
> 2.54.0
> 
> 
---end quoted text---

       reply	other threads:[~2026-06-05  4:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a31e9841-fd0c-435f-b376-86a7e01ddca7@redhat.com>
2026-06-05  4:08 ` Christoph Hellwig [this message]
2026-06-05  4:14   ` [PATCH] btrfs: use -f by default for mkfs as xfs/extN do Qu Wenruo
2026-06-05  4:17     ` Christoph Hellwig
2026-06-05  4:23       ` Qu Wenruo
2026-06-05  4:27         ` Christoph Hellwig
2026-06-05 17:59     ` Eric Sandeen

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=aiJL1CBTV_N4YAtb@infradead.org \
    --to=hch@infradead.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sandeen@redhat.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