Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Dhruva G <goledhruva@gmail.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com,
	fstests@vger.kernel.org
Cc: Boris Burkov <boris@bur.io>, Anand Jain <asj@kernel.org>
Subject: Re: [PATCH v2] btrfs: test defrag --nocomp converts compressed extents to uncompressed
Date: Mon, 21 Sep 2026 07:15:26 +0930	[thread overview]
Message-ID: <0090e23b-bbc5-45e0-a46e-9a5b2eb2dc72@gmx.com> (raw)
In-Reply-To: <d8930005-39c7-405f-96ac-ea0530e9b2c1@gmail.com>



在 2026/9/20 21:41, Dhruva G 写道:
> "btrfs filesystem defragment --nocomp" rewrites already compressed file
> data as uncompressed data. The kernel flag was added by commit
> 009b2056cb25 ("btrfs: defrag: add flag to force no-compression") in
> v6.17, and the userspace option shipped in btrfs-progs v6.16. There is
> no test for it.
> 
> Add a test that writes compressible data in 128K blocks on a filesystem
> mounted with compress=zlib, runs defragment with --nocomp, and uses the
> FIEMAP encoded flag to verify that no extent remains compressed. Also
> verify that the file contents are unchanged after a remount. Keeping
> compression enabled throughout the test confirms that the defrag ioctl
> takes precedence over the mount option.
> 
> Regular defrag deliberately leaves maximum-sized compressed extents
> alone, as asserted by btrfs/259. Creating maximum-sized compressed
> extents therefore ensures that an implementation which silently treats
> --nocomp as regular defrag fails the test.
> 
> Check support in two stages: first require btrfs-progs to advertise
> --nocomp, then invoke it on a 10-byte file to verify that the kernel
> accepts the flag. Kernels with the unknown-flag validation from commit
> 173431b274a9 return EOPNOTSUPP when NOCOMPRESS is unavailable. Kernels
> predating that validation may silently ignore the flag and fail the
> semantic checks instead of skipping.
> 
> Signed-off-by: Dhruva Gole <goledhruva@gmail.com>

Looks good to me overall.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

      reply	other threads:[~2026-09-20 21:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 12:11 [PATCH v2] btrfs: test defrag --nocomp converts compressed extents to uncompressed Dhruva G
2026-09-20 21:45 ` Qu Wenruo [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=0090e23b-bbc5-45e0-a46e-9a5b2eb2dc72@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=asj@kernel.org \
    --cc=boris@bur.io \
    --cc=fstests@vger.kernel.org \
    --cc=goledhruva@gmail.com \
    --cc=kernel-team@fb.com \
    --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