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.tomoh...@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: pEpkey.asc
Description: application/pgp-keys

Reply via email to