[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ea5102a1-eb91-6799-4353-aefd877e0864@kernel.org>
Date: Fri, 7 Apr 2023 09:22:22 +0800
From: Chao Yu <chao@...nel.org>
To: Jaegeuk Kim <jaegeuk@...nel.org>
Cc: Yangtao Li <frank.li@...o.com>,
linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] f2fs: merge lz4hc_compress_pages() to
lz4_compress_pages()
On 2023/4/6 0:13, Jaegeuk Kim wrote:
> On 04/05, Chao Yu wrote:
>> On 2023/3/31 0:49, Yangtao Li wrote:
>>> +#ifdef CONFIG_F2FS_FS_LZ4HC
>>> + unsigned char level = F2FS_I(cc->inode)->i_compress_level;
>>> if (level)
>>> len = LZ4_compress_HC(cc->rbuf, cc->cbuf->cdata, cc->rlen,
>>> cc->clen, level, cc->private);
>>> else
>>
>> [snip]
>>
>>> #endif
>>
>> [snip]
>>
>>> + len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen,
>>
>> It's weired that whole else xxx; statement is split by #endif.
>>
>> What about?
>>
>> unsigned char level = 0;
>>
>> #if
>> ...
>> #endif
>> if (!level)
>> len = LZ4_compress_default()
>
> I modified like this.
>
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -266,17 +266,19 @@ static void lz4_destroy_compress_ctx(struct compress_ctx *cc)
>
> static int lz4_compress_pages(struct compress_ctx *cc)
> {
> - int len;
> -#ifdef CONFIG_F2FS_FS_LZ4HC
> + int len = -EINVAL;
> unsigned char level = F2FS_I(cc->inode)->i_compress_level;
>
> - if (level)
> + if (!level)
> + len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen,
> + cc->clen, cc->private);
> +#ifdef CONFIG_F2FS_FS_LZ4HC
> + else
> len = LZ4_compress_HC(cc->rbuf, cc->cbuf->cdata, cc->rlen,
> cc->clen, level, cc->private);
> - else
> #endif
> - len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen,
> - cc->clen, cc->private);
> + if (len < 0)
> + return len;
> if (!len)
> return -EAGAIN;
>
Better.
Reviewed-by: Chao Yu <chao@...nel.org>
Thanks,
Powered by blists - more mailing lists