lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d7de7c7-5cc5-c342-3652-ab904b3e43b2@huawei.com>
Date:   Sun, 25 Apr 2021 09:28:25 +0800
From:   Chao Yu <yuchao0@...wei.com>
To:     Jaegeuk Kim <jaegeuk@...nel.org>
CC:     <linux-f2fs-devel@...ts.sourceforge.net>,
        <linux-kernel@...r.kernel.org>, <chao@...nel.org>
Subject: Re: [PATCH] f2fs: compress: remove unneed check condition

On 2021/4/25 8:47, Jaegeuk Kim wrote:
> On 04/22, Chao Yu wrote:
>> On 2021/4/22 12:04, Jaegeuk Kim wrote:
>>> On 04/21, Chao Yu wrote:
>>>> In only call path of __cluster_may_compress(), __f2fs_write_data_pages()
>>>> has checked SBI_POR_DOING condition, and also cluster_may_compress()
>>>> has checked CP_ERROR_FLAG condition, so remove redundant check condition
>>>> in __cluster_may_compress() for cleanup.
>>>
>>> I think cp_error can get any time without synchronization. Is it safe to say
>>> it's redundant?
>>
>> Yes,
>>
>> But no matter how late we check cp_error, cp_error can happen after our
>> check points, it won't cause regression if we remove cp_error check there,
>> because for compress write, it uses OPU, it won't overwrite any existed data
>> in device.
>>
>> Seems it will be more appropriate to check cp_error in
>> f2fs_write_compressed_pages() like we did in f2fs_write_single_data_page()
>> rather than in __cluster_may_compress().
>>
>> BTW, shouldn't we rename __cluster_may_compress() to
>> cluster_beyond_filesize() for better readability?
> 
> f2fs_cluster_has_data()?

Maybe cluster_has_invalid_data()? which indicates there is invalid data
beyond filesize.

Thanks,

> 
>>
>> Thanks,
>>
>>>
>>>>
>>>> Signed-off-by: Chao Yu <yuchao0@...wei.com>
>>>> ---
>>>>    fs/f2fs/compress.c | 5 -----
>>>>    1 file changed, 5 deletions(-)
>>>>
>>>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>>>> index 3c9d797dbdd6..532c311e3a89 100644
>>>> --- a/fs/f2fs/compress.c
>>>> +++ b/fs/f2fs/compress.c
>>>> @@ -906,11 +906,6 @@ static bool __cluster_may_compress(struct compress_ctx *cc)
>>>>    		f2fs_bug_on(sbi, !page);
>>>> -		if (unlikely(f2fs_cp_error(sbi)))
>>>> -			return false;
>>>> -		if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
>>>> -			return false;
>>>> -
>>>>    		/* beyond EOF */
>>>>    		if (page->index >= nr_pages)
>>>>    			return false;
>>>> -- 
>>>> 2.29.2
>>> .
>>>
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ