linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Johannes Weiner <jweiner@fb.com>,
	Nick Terrell <nickrterrell@gmail.com>, Yann Collet <cyan@fb.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-f2fs-devel@lists.sourceforge.net"
	<linux-f2fs-devel@lists.sourceforge.net>,
	Petr Malat <oss@malat.biz>, Chris Mason <clm@fb.com>,
	Nick Terrell <terrelln@fb.com>, Kernel Team <Kernel-team@fb.com>,
	Niket Agarwal <niketa@fb.com>
Subject: Re: [f2fs-dev] [PATCH 6/9] f2fs: zstd: Switch to the zstd-1.4.6 API
Date: Fri, 18 Sep 2020 10:58:35 +0800	[thread overview]
Message-ID: <6eb268c8-7276-5859-e5b0-ce0a541e27e7@huawei.com> (raw)
In-Reply-To: <20200918025627.GA3518637@gmail.com>

On 2020/9/18 10:56, Eric Biggers wrote:
> On Fri, Sep 18, 2020 at 09:47:32AM +0800, Chao Yu wrote:
>> Ah, I got it.
>>
>> Step of enabling compressed inode is not correct, we should touch an empty
>> file, and then use 'chattr +c' on that file to enable compression, otherwise
>> the race condition could be complicated to handle. So we need below diff to
>> disallow setting compression flag on an non-empty file:
>>
>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>> index 8a422400e824..b462db7898fd 100644
>> --- a/fs/f2fs/file.c
>> +++ b/fs/f2fs/file.c
>> @@ -1836,6 +1836,8 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
>>   		if (iflags & F2FS_COMPR_FL) {
>>   			if (!f2fs_may_compress(inode))
>>   				return -EINVAL;
>> +			if (get_dirty_pages(inode) || fi->i_compr_blocks)
>> +				return  -EINVAL;
>>
>>   			set_compress_context(inode);
>>   		}
> 
> Why not:
> 
> 	if (inode->i_size)
> 		return -EINVAL;

Yeah, I noticed that after replying this email, I've prepared the new patch
which including the i_size check.

Thanks for noticing this.

Thanks,

> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2020-09-18  2:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  3:42 [f2fs-dev] [PATCH 0/9] Update to zstd-1.4.6 Nick Terrell
2020-09-16  3:42 ` [f2fs-dev] [PATCH 1/9] lib: zstd: Add zstd compatibility wrapper Nick Terrell
2020-09-16  8:48   ` Christoph Hellwig
2020-09-16 20:21     ` Nick Terrell via Linux-f2fs-devel
2020-09-16  3:42 ` [f2fs-dev] [PATCH 2/9] lib: zstd: Add decompress_sources.h for decompress_unzstd Nick Terrell
2020-09-16  3:42 ` [f2fs-dev] [PATCH 3/9] lib: zstd: Upgrade to latest upstream zstd version 1.4.6 Nick Terrell
2020-09-16 20:53   ` Nick Terrell via Linux-f2fs-devel
2020-09-16  3:42 ` [f2fs-dev] [PATCH 4/9] crypto: zstd: Switch to zstd-1.4.6 API Nick Terrell
2020-09-16  8:49   ` Christoph Hellwig
2020-09-16  3:42 ` [f2fs-dev] [PATCH 5/9] btrfs: zstd: Switch to the " Nick Terrell
2020-09-16  8:49   ` Christoph Hellwig
2020-09-16 14:20     ` Chris Mason via Linux-f2fs-devel
2020-09-16 14:30       ` Christoph Hellwig
2020-09-16 14:43         ` Chris Mason via Linux-f2fs-devel
2020-09-16 14:46           ` Christoph Hellwig
2020-09-16 15:01             ` Chris Mason via Linux-f2fs-devel
2020-09-16 18:27             ` Eric Biggers
2020-09-16 19:18             ` Nick Terrell via Linux-f2fs-devel
     [not found]               ` <b1eec667d42849f757bbd55f014739509498a59d.camel@surriel.com>
2020-09-17 10:04                 ` Christoph Hellwig
2020-09-17 14:28                   ` Chris Mason via Linux-f2fs-devel
2020-09-17 17:57                     ` Nick Terrell via Linux-f2fs-devel
2020-09-16  3:43 ` [f2fs-dev] [PATCH 6/9] f2fs: " Nick Terrell
2020-09-16  6:31   ` Chao Yu
2020-09-16 18:39     ` Nick Terrell via Linux-f2fs-devel
2020-09-17  6:31       ` Chao Yu
2020-09-17 18:00         ` Nick Terrell via Linux-f2fs-devel
2020-09-17 19:34           ` Nick Terrell via Linux-f2fs-devel
2020-09-18  1:47             ` Chao Yu
2020-09-18  2:56               ` Eric Biggers
2020-09-18  2:58                 ` Chao Yu [this message]
2020-09-18  5:39               ` Nick Terrell via Linux-f2fs-devel
2020-09-18  1:41           ` Chao Yu
2020-09-16  3:43 ` [f2fs-dev] [PATCH 7/9] squashfs: " Nick Terrell
2020-09-16  3:43 ` [f2fs-dev] [PATCH 8/9] lib: unzstd: " Nick Terrell
2020-09-16  3:43 ` [f2fs-dev] [PATCH 9/9] lib: zstd: Remove zstd compatibility wrapper Nick Terrell

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=6eb268c8-7276-5859-e5b0-ce0a541e27e7@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=Kernel-team@fb.com \
    --cc=clm@fb.com \
    --cc=cyan@fb.com \
    --cc=ebiggers@kernel.org \
    --cc=jweiner@fb.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickrterrell@gmail.com \
    --cc=niketa@fb.com \
    --cc=oss@malat.biz \
    --cc=terrelln@fb.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;
as well as URLs for NNTP newsgroup(s).