Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp214121pxy; Wed, 21 Apr 2021 23:52:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzza5vPHaBS/3CgbXp88s0bqjLC2+AqWSu0qQsIuwql4h8nP1PkPeXte1luoG6AMeqzYfHv X-Received: by 2002:a17:906:c297:: with SMTP id r23mr1836739ejz.48.1619074372379; Wed, 21 Apr 2021 23:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619074372; cv=none; d=google.com; s=arc-20160816; b=YZKNFY7guSeKZl5P0MDmZuHpvUmAunuSEynqNW+o3KoM2C2a7xnjiYp87a/95RMH9G +AOTEwpctlyKsXkbo4sR4QyIPnhyHSuo+FppcaWahY0XT/gf4eFKK+CwJUD95+6O9g6x lQHZcHn2iWmtz0tT4q+5zHgU2vycFmIRGyRSMkwVazCgTUhK37U/dB/C+Rg/Ej0JH8pv CNcSD7CS6LeprF4E3zxIaBzhDp/Z9Bzn879chgbX8fVFoTPhyQSg0JXZzztKCULask9z rd22hc0sLiJ9GapHiznrmTpGuEh65FgT8IUuMZN7dRXk6WB8ZYa6kUMF1BRg7uPfUxep 1isw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=CC2mwbyAGpdrj5tsshO4VUCIjOwEnXMNGg8B830uQZs=; b=usiSfOlU8Wo0QEsReNpDT0RpKVmDTy4qmPckqDa6Uw1e2VFq0rHxGinjJQS5nbvR5P hvWiFAuSOIhZNVE+1xxTOB8E2BOjWmE57UZ09+QbQEJZfL5/2edvkKYx2Rg1mNBg/nI1 dD+KVlu5f31+PwMvISX224i6USni80hK2lK9fMxrMCYpekwpLn4oSJMPagjEmaXvXxu1 gCX2xU6La8y8bEOnMMBuNYG31U6YhznyiIzBsbsoibSnKGmWGcOy56QgJrsYUmqrv8P5 dv3wPb/pzoJWvVQUpXnrEV2irbT00yNb0j9n0kDhIYO0cTUd9/tSFbZcqGg078tIiX8H zMlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si1329111edr.441.2021.04.21.23.52.28; Wed, 21 Apr 2021 23:52:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234923AbhDVGvq (ORCPT + 99 others); Thu, 22 Apr 2021 02:51:46 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:16488 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234925AbhDVGvn (ORCPT ); Thu, 22 Apr 2021 02:51:43 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FQp0r2Rqxzrdwb; Thu, 22 Apr 2021 14:48:44 +0800 (CST) Received: from [10.136.110.154] (10.136.110.154) by smtp.huawei.com (10.3.19.206) with Microsoft SMTP Server (TLS) id 14.3.498.0; Thu, 22 Apr 2021 14:51:04 +0800 Subject: Re: [PATCH] f2fs: compress: remove unneed check condition To: Jaegeuk Kim CC: , , References: <20210421083941.66371-1-yuchao0@huawei.com> From: Chao Yu Message-ID: <2c6f17e6-ef23-f313-5df2-6bd63d7df2b1@huawei.com> Date: Thu, 22 Apr 2021 14:51:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.136.110.154] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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 > . >