All of lore.kernel.org
 help / color / mirror / Atom feed
From: Su Yue <suy.fnst@cn.fujitsu.com>
To: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: property: Set incompat flag of lzo/zstd compression
Date: Tue, 15 May 2018 16:34:41 +0800	[thread overview]
Message-ID: <35b17130-c787-e46f-c9b9-d7f7ddaedf1b@cn.fujitsu.com> (raw)
In-Reply-To: <88f4d96f-e362-4b09-b436-30b3d1720e8a@cn.fujitsu.com>

[-- Attachment #1: Type: text/plain, Size: 1970 bytes --]



On 05/15/2018 04:05 PM, Su Yue wrote:
> 
> 
> On 05/15/2018 03:51 PM, Misono Tomohiro wrote:
>> Incompat flag of lzo/zstd compression should be set at:
>>  1. mount time (-o compress/compress-force)
>>  2. when defrag is done
>>  3. when property is set
>>
>> Currently 3. is missing and this commit adds this.
>>
> 
> If I don't misunderstand, compression property of an inode is only

Embarrassed for bad memory about btrfs_set_fs_incompat().
The patch is fine. Just ignore this thread.

> apply for *the* inode, not the whole filesystem.
> So the original logical should be okay.
> 
> Thanks,
> Su
> 
>> Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
>> ---
>>  fs/btrfs/props.c | 12 ++++++++----
>>  1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
>> index 53a8c95828e3..dc6140013ae8 100644
>> --- a/fs/btrfs/props.c
>> +++ b/fs/btrfs/props.c
>> @@ -380,6 +380,7 @@ static int prop_compression_apply(struct inode *inode,
>>  				  const char *value,
>>  				  size_t len)
>>  {
>> +	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
>>  	int type;
>>  
>>  	if (len == 0) {
>> @@ -390,14 +391,17 @@ static int prop_compression_apply(struct inode *inode,
>>  		return 0;
>>  	}
>>  
>> -	if (!strncmp("lzo", value, 3))
>> +	if (!strncmp("lzo", value, 3)) {
>>  		type = BTRFS_COMPRESS_LZO;
>> -	else if (!strncmp("zlib", value, 4))
>> +		btrfs_set_fs_incompat(fs_info, COMPRESS_LZO);
>> +	} else if (!strncmp("zlib", value, 4)) {
>>  		type = BTRFS_COMPRESS_ZLIB;
>> -	else if (!strncmp("zstd", value, len))
>> +	} else if (!strncmp("zstd", value, len)) {
>>  		type = BTRFS_COMPRESS_ZSTD;
>> -	else
>> +		btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD);
>> +	} else {
>>  		return -EINVAL;
>> +	}
>>  
>>  	BTRFS_I(inode)->flags &= ~BTRFS_INODE_NOCOMPRESS;
>>  	BTRFS_I(inode)->flags |= BTRFS_INODE_COMPRESS;
>>
> 
> 



[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 1791 bytes --]

  reply	other threads:[~2018-05-15  8:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1526370458.git.misono.tomohiro@jp.fujitsu.com>
2018-05-15  7:51 ` [PATCH] btrfs: property: Set incompat flag of lzo/zstd compression Misono Tomohiro
2018-05-15  8:05   ` Su Yue
2018-05-15  8:34     ` Su Yue [this message]
2018-05-15  8:35     ` Duncan
2018-05-15  8:50       ` Su Yue
2018-05-15  8:20   ` Anand Jain
2018-05-15 14:07   ` 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=35b17130-c787-e46f-c9b9-d7f7ddaedf1b@cn.fujitsu.com \
    --to=suy.fnst@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=misono.tomohiro@jp.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.