From: David Sterba <dsterba@suse.cz>
To: Daniel Vacek <neelx@suse.com>
Cc: Qu Wenruo <quwenruo.btrfs@gmx.com>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs/defrag: implement compression levels
Date: Wed, 5 Mar 2025 08:05:21 +0100 [thread overview]
Message-ID: <20250305070521.GZ5777@suse.cz> (raw)
In-Reply-To: <CAPjX3FcZ6TJZnHNf3sm00F49BVsDzQaZr5fJHMXRUXne3gLZ2w@mail.gmail.com>
On Wed, Mar 05, 2025 at 08:02:28AM +0100, Daniel Vacek wrote:
> > > @@ -1376,10 +1377,19 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra,
> > > return -EINVAL;
> > >
> > > if (do_compress) {
> > > - if (range->compress_type >= BTRFS_NR_COMPRESS_TYPES)
> > > - return -EINVAL;
> > > - if (range->compress_type)
> > > - compress_type = range->compress_type;
> > > + if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS_LEVEL) {
> > > + if (range->compress.type >= BTRFS_NR_COMPRESS_TYPES)
> > > + return -EINVAL;
> > > + if (range->compress.type) {
> > > + compress_type = range->compress.type;
> > > + compress_level= range->compress.level;
> > > + }
> >
> > I am not familiar with the compress level, but
> > btrfs_compress_set_level() does extra clamping, maybe we also want to do
> > that too?
>
> This is intentionally left to be limited later. There's no need to do
> it at this point and the code is simpler. It's also compression
> type/method agnostic.
This is input parameter validation so we should not postpone it until
the whole process starts. The complexity can be wrapped in helpers, we
already have that for various purposes like
compression_decompress_bio().
next prev parent reply other threads:[~2025-03-05 7:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 17:14 [PATCH] btrfs/defrag: implement compression levels Daniel Vacek
2025-03-04 21:31 ` Qu Wenruo
2025-03-05 7:02 ` David Sterba
2025-03-05 7:08 ` Daniel Vacek
2025-03-05 7:02 ` Daniel Vacek
2025-03-05 7:05 ` David Sterba [this message]
2025-03-05 7:21 ` Daniel Vacek
2025-03-05 7:44 ` Qu Wenruo
2025-03-05 8:01 ` David Sterba
2025-03-05 8:08 ` Qu Wenruo
2025-03-05 10:32 ` [PATCH v2] " Daniel Vacek
2025-03-06 8:27 ` David Sterba
2025-03-06 13:15 ` Daniel Vacek
2025-03-06 13:15 ` [PATCH v3] " Daniel Vacek
2025-03-06 17:16 ` David Sterba
2025-03-06 21:54 ` Qu Wenruo
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=20250305070521.GZ5777@suse.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neelx@suse.com \
--cc=quwenruo.btrfs@gmx.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