Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4251895ybv; Sun, 16 Feb 2020 17:42:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzv1u3IkIfPYHT7BTSnh1pO2wglwRA8/FxprUGvzYL63PQgVwo3pjEAR4xPBRqlzVx6pPtX X-Received: by 2002:a05:6830:1d6e:: with SMTP id l14mr10259003oti.32.1581903760179; Sun, 16 Feb 2020 17:42:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581903760; cv=none; d=google.com; s=arc-20160816; b=YbRVqMIuCObwVEWRPAJ8wu46dRANWaj+4GS0aJV8knShcjxFXiJ9HVHowPL8IxKrFe xKqT//Wz+yMtzNxvYrboSzDRxcW4GqvWABD9ONgnthHmUhwpZiHJanb+hldYpouujaQD 5/mNZzlbjz6z+KPgnYMwFIChEOHItYWmeRj5m4HnLCRJcvqmvi6FJkmEzKi/s4B5jRFO 9oGY0Y6yJZG19bGLqLfzx3KMzjG60neu6sOClB0PXRZ4VMjLtJyuWM1hUeWH1FM763ut c1N3qUKKnm109Qvm0NlsY82lyb7D3J+xAGhEuEN7+0oT+JiEuoM/LCuOS2qDfk8gsE9Z ab6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=CuIIF0NRN7sickqt7X3jZJxmE/mhGbAzvl4k/cnqxqA=; b=ku3cWIAXYrbBu0hOge75RgTv4HOecYeaNbI2bWYsUVizjTyavudofqESIO79bY070B smxK9Sj9VYsvGcQ+mzCywV9hpEAikMcaaX92v4pUb61/07i2VC028rYk9oG+pZvw+d2y 9T/OeLJSEdKQeSIOjRyy9wtobcL+JtcTUXFwt5xCx7qkVAZnunHd14P8a2aVI+qU/ltn 2hLkYbrXNP6A10vbOtSLvbyE2y1LgUYvo86KWAnv6K6iqEdifwPjmzpKvDvdl3Suzkiz bR4LbuX8Rphp4JSKnQS6gH3BYUT+SSwyLMYqELtff1eFBvHHD/yvtcypN5aVXO0yVnVp iHmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h26si5513858otm.303.2020.02.16.17.42.28; Sun, 16 Feb 2020 17:42:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbgBQBk5 (ORCPT + 99 others); Sun, 16 Feb 2020 20:40:57 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:51808 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726240AbgBQBk4 (ORCPT ); Sun, 16 Feb 2020 20:40:56 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7CD18B4D637C8E4DA0A6; Mon, 17 Feb 2020 09:40:53 +0800 (CST) Received: from [10.134.22.195] (10.134.22.195) by smtp.huawei.com (10.3.19.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 17 Feb 2020 09:40:49 +0800 Subject: Re: [f2fs-dev] [PATCH 1/3] f2fs: skip GC when section is full To: Jaegeuk Kim , , References: <20200214185855.217360-1-jaegeuk@kernel.org> From: Chao Yu Message-ID: <2ea7ce0e-b40e-e80b-55b6-8256b3e9c2c1@huawei.com> Date: Mon, 17 Feb 2020 09:40:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200214185855.217360-1-jaegeuk@kernel.org> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/2/15 2:58, Jaegeuk Kim wrote: > This fixes skipping GC when segment is full in large section. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/gc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 53312d7bc78b..65c0687ee2bb 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -1018,8 +1018,8 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, > * race condition along with SSR block allocation. > */ > if ((gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0)) || > - get_valid_blocks(sbi, segno, false) == > - sbi->blocks_per_seg) > + get_valid_blocks(sbi, segno, true) == > + BLKS_PER_SEC(sbi)) Then in large section, if current segment is all valid, we won't skip scanning it, so do we need to change like this: if ((gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0)) || get_valid_blocks(sbi, segno, false) == sbi->blocks_per_seg || get_valid_blocks(sbi, segno, true) == BLKS_PER_SEC(sbi)) return submitted; > return submitted; > > if (check_valid_map(sbi, segno, off) == 0) >