Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6872438imm; Tue, 24 Jul 2018 04:45:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeFguzkNjf/xDv3lBZTovuQEylH6GvvlkCEVoj0JYshxnjqnEqkh/KMlpBBUQhjcSboersN X-Received: by 2002:a17:902:1005:: with SMTP id b5-v6mr16872247pla.207.1532432718109; Tue, 24 Jul 2018 04:45:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532432718; cv=none; d=google.com; s=arc-20160816; b=BiuoB5dZyh1KEnEnQ9Dkjtl1a/KNI2adtH9Bu6nYtwV04gud4joTg7AatZx3Iv2P3e +Qe4rcfWWCbqq8odzt5FI0oqzTE3fJ0lkXXsGxc+QGid+PAg7zNSxOH2YSHmOvieHx5B VQoSRGdyx4L2mKLSGM9Z97OZZZo/hHewr355iLf1ctDaHAr3rM6QL65hB8ThqepiIPsG nghLIaSFeIiDjuEuusWcAP+05kKxnd9epJ8Zv1KAqwFLSFYyelPst+6r7Cvdr4yOqgDx /r7pC86BbDS7B1yENS7BTDSxx4TE8VALKatdtYjZRRdbD+NpRDlgM32f2b6Q6EXdXq6A SnZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=o17DTQ2qcu73J/ZqIaBS53r6ARsj9LeRbTjCAeKeqeY=; b=ADyjkZ13gYINVjtpPR300ijZp0DdFVjoIYp1KCgKycQGOAwXZOP3zesh+NvyCOB9bs 8fSV9O9SzwZY5RJcN1IdBwXOdzQPc51sZeyAfH4h3g7GjYhTXBfh+2IF63JTLWMW+5aI DQsSYmoNaKrG0WFA+9BhmOjS43lwHd+m7tZojJcZ4EI8Ek0uayq1gvdLTyTdVfMmJ2OA mJhLrfWMJ+4weH7M0//QJAE/hDwAJYsROqb3xt/FFyMLuh3/oOZwERlxxjSfD3kZfGwY voK4YiEEyCPtpNBBCfK1ia3qfdnAom6LHzNco+EReyXWcQx4UADLCLPZBM6ka+WuY5k8 g3Gw== 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 b16-v6si10015484pls.474.2018.07.24.04.45.03; Tue, 24 Jul 2018 04:45:18 -0700 (PDT) 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 S2388300AbeGXMuO (ORCPT + 99 others); Tue, 24 Jul 2018 08:50:14 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:41048 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388236AbeGXMuO (ORCPT ); Tue, 24 Jul 2018 08:50:14 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D6F6159E2C64F; Tue, 24 Jul 2018 19:44:04 +0800 (CST) Received: from [127.0.0.1] (10.111.220.140) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.382.0; Tue, 24 Jul 2018 19:43:59 +0800 Subject: Re: [PATCH v2] f2fs: clear victim_secmap when section has full valid blocks To: Chao Yu , , , CC: , , , , , References: <1532355022-163029-1-git-send-email-yunlong.song@huawei.com> <1532424442-9867-1-git-send-email-yunlong.song@huawei.com> <8026538e-2a8b-fad4-82b1-9bb2c04e097d@huawei.com> From: Yunlong Song Message-ID: <087b0b73-83b3-1d2a-99cc-bd4f451841bf@huawei.com> Date: Tue, 24 Jul 2018 19:42:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <8026538e-2a8b-fad4-82b1-9bb2c04e097d@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.111.220.140] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just in case, or maybe this patch should be put after [patch 2/5],which let BG_GC avoids skipping BG_GC victim, then SSR can also select the BG_GC victim to allocate data blocks, which can make bggc selected section get back to full state. On 2018/7/24 17:36, Chao Yu wrote: > On 2018/7/24 17:27, Yunlong Song wrote: >> Without this patch, f2fs only clears victim_secmap when it finds out >> that the section has no valid blocks at all, but forgets to clear the >> victim_secmap when the whole section has full valid blocks. > Look this patch again, I have a question, why bggc selected section can > get back to full state? > > Thanks, > >> Signed-off-by: Yunlong Song >> --- >> fs/f2fs/segment.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c >> index cfff7cf..0a79554 100644 >> --- a/fs/f2fs/segment.c >> +++ b/fs/f2fs/segment.c >> @@ -776,7 +776,8 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, >> if (test_and_clear_bit(segno, dirty_i->dirty_segmap[t])) >> dirty_i->nr_dirty[t]--; >> >> - if (get_valid_blocks(sbi, segno, true) == 0) >> + if (get_valid_blocks(sbi, segno, true) == 0 || >> + get_valid_blocks(sbi, segno, true) == BLKS_PER_SEC(sbi)) >> clear_bit(GET_SEC_FROM_SEG(sbi, segno), >> dirty_i->victim_secmap); >> } >> > > . > -- Thanks, Yunlong Song