From: Anand Jain <anand.jain@oracle.com>
To: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/4] btrfs: separate defrag and property compression
Date: Thu, 20 Jul 2017 18:49:19 +0800 [thread overview]
Message-ID: <c5ce5317-a1d2-f4b3-1615-76812c8874f8@oracle.com> (raw)
In-Reply-To: <9dc75da8c4a2cfc0cddec3c9ccf95f5d28a89084.1500317040.git.dsterba@suse.com>
On 07/18/2017 02:46 AM, David Sterba wrote:
> Add new value for compression to distinguish between defrag and
> property. Previously, a single variable was used and this caused clashes
> when the per-file 'compression' was set and a defrag -c was called.
How about..
deprecate property compression
introduce property compress (inline with -o compress) [1]
introduce property compress-force (inline with -o compress-force) [2]
inode_need_compress will look something like this..
-----
static inline int inode_need_compress(struct inode *inode)
{
struct btrfs_root *root = BTRFS_I(inode)->root;
/* force compress */
if (btrfs_test_opt(root->fs_info, FORCE_COMPRESS) ||
BTRFS_I(inode)->force_compress) [2]
return 1;
/* bad compression ratios */
if (BTRFS_I(inode)->flags & BTRFS_INODE_NOCOMPRESS)
return 0;
if (btrfs_test_opt(root->fs_info, COMPRESS) ||
BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS ||
BTRFS_I(inode)->compress) [1]
return 1;
return 0;
}
-----
defrag -c will in turn set the compress property.
introduce defrag --compress-force|-C to in turn set the compress-force
property.
Now user has a way to check the compression property using
btrfs prop get ...
And we have a consistent nomenclature ;-)
Thanks, Anand
> The property-compression is loaded when the file is open, defrag will
> overwrite the same variable and reset to 0 (ie. NONE) at when the file
> defragmentaion is finished. That's considered a usability bug.
>
> Now we won't touch the property value, use the defrag-compression. The
> precedence of defrag is higher than for property (and whole-filesystem).
> @@ -511,7 +514,9 @@ static noinline void compress_file_range(struct inode *inode,
> goto cont;
> }
>
> - if (BTRFS_I(inode)->prop_compress)
> + if (BTRFS_I(inode)->defrag_compress)
> + compress_type = BTRFS_I(inode)->defrag_compress;
> + else if (BTRFS_I(inode)->prop_compress)
> compress_type = BTRFS_I(inode)->prop_compress;
next prev parent reply other threads:[~2017-07-20 10:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 18:46 [PATCH 0/4] Compression David Sterba
2017-07-17 18:46 ` [PATCH 1/4] btrfs: rename variable holding per-inode compression type David Sterba
2017-07-17 18:46 ` [PATCH 2/4] btrfs: separate defrag and property compression David Sterba
2017-07-20 10:49 ` Anand Jain [this message]
2017-07-21 17:35 ` David Sterba
2017-07-17 18:46 ` [PATCH 3/4] btrfs: defrag: cleanup checking for compression status David Sterba
2017-07-17 18:46 ` [PATCH 4/4] btrfs: allow defrag compress to override NOCOMPRESS attribute David Sterba
2017-07-20 11:02 ` Anand Jain
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=c5ce5317-a1d2-f4b3-1615-76812c8874f8@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.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;
as well as URLs for NNTP newsgroup(s).