From: Anand Jain <anand.jain@oracle.com>
To: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: allow defrag compress to override NOCOMPRESS attribute
Date: Sat, 15 Jul 2017 12:52:34 +0800 [thread overview]
Message-ID: <43b258b2-b808-5301-f832-44c4274aae38@oracle.com> (raw)
In-Reply-To: <20170713131844.706-1-dsterba@suse.com>
On 07/13/2017 09:18 PM, David Sterba wrote:
> Currently, the BTRFS_INODE_NOCOMPRESS will prevent any compression on a
> given file, except when the mount is force-compress. As users have
> reported on IRC, this will also prevent compression when requested by
> defrag (btrfs fi defrag -c file).
>
> The nocompress flag is set automatically by filesystem when the ratios
> are bad and the user would have to manually drop the bit in order to
> make defrag -c work. This is not good from the usability perspective.
>
> This patch will raise priority for the defrag -c over nocompress, ie.
> any file with NOCOMPRESS bit set will get defragmented. The bit will
> remain untouched.
>
> Alternate option was to also drop the nocompress bit and keep the
> decision logic as is, but I think this is not the right solution.
Now the compression set through property will act same as
'-o compress-force'. Before this patch is was like '-o compress'.
I am ok to fix that patch with a new patch.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Thanks, Anand
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
> fs/btrfs/inode.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 5d3c6ac960fd..ea2f02ec0394 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -399,12 +399,14 @@ static inline int inode_need_compress(struct inode *inode)
> /* force compress */
> if (btrfs_test_opt(fs_info, FORCE_COMPRESS))
> return 1;
> + /* force compress when called from defrag */
> + if (BTRFS_I(inode)->force_compress)
> + return 1;
> /* bad compression ratios */
> if (BTRFS_I(inode)->flags & BTRFS_INODE_NOCOMPRESS)
> return 0;
> if (btrfs_test_opt(fs_info, COMPRESS) ||
> - BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS ||
> - BTRFS_I(inode)->force_compress)
> + BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS)
> return 1;
> return 0;
> }
>
next prev parent reply other threads:[~2017-07-15 4:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 13:18 [PATCH] btrfs: allow defrag compress to override NOCOMPRESS attribute David Sterba
2017-07-15 4:52 ` Anand Jain [this message]
2017-07-15 6:45 ` Paul Jones
2017-07-17 17:06 ` David Sterba
2017-07-17 16:47 ` David Sterba
2017-07-17 17:09 ` David Sterba
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=43b258b2-b808-5301-f832-44c4274aae38@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).