From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78739C433ED for ; Sun, 25 Apr 2021 00:47:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4BD80613C1 for ; Sun, 25 Apr 2021 00:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbhDYAsR (ORCPT ); Sat, 24 Apr 2021 20:48:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:44814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbhDYAsR (ORCPT ); Sat, 24 Apr 2021 20:48:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2FCF613C4; Sun, 25 Apr 2021 00:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619311658; bh=mijs84e9TdAULlSFMzEsjGetGLdyir4mZ+ORmJUQPxw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XkvpZaFuiMXZxiAo7kTJH47fZSBRkvK4MeVbZuQZVnqR3facBiY/7U1yUxzzSmpw6 H6hN9sTuGUSinznQNiywDO6aIwjvnONqO4pn7AfL5me9xUF7rA99Je7yW4rTWgeEYe w8Zde1WJ7tySt5Oc3+DtfOOoKebLD8I6kf1lTHMwmikfQ277dA0NVLLziGeZokRfZN AqNbLcMnvEQKNrOzTZ0/71I0tqc9yD3OkB617y9Th5AIL63JgwSidgKJIW74UmCt/s zGFAI3V364zr5zNBaFkFJkYBUy0+mCEv5HGMDVxKtRi+WVa5GBluTIihP4miMChqOR +D9aZGoWXwSlw== Date: Sat, 24 Apr 2021 17:47:36 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, chao@kernel.org Subject: Re: [PATCH] f2fs: compress: remove unneed check condition Message-ID: References: <20210421083941.66371-1-yuchao0@huawei.com> <2c6f17e6-ef23-f313-5df2-6bd63d7df2b1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c6f17e6-ef23-f313-5df2-6bd63d7df2b1@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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()? > > Thanks, > > > > > > > > > Signed-off-by: Chao Yu > > > --- > > > 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 > > . > >