Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753224AbdIDByl (ORCPT ); Sun, 3 Sep 2017 21:54:41 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5511 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753120AbdIDByk (ORCPT ); Sun, 3 Sep 2017 21:54:40 -0400 Subject: Re: [PATCH] f2fs: clear get_ssr_cost To: Chao Yu , , , CC: , , , , References: <1504268075-81858-1-git-send-email-yunlong.song@huawei.com> <2503831f-3868-4037-307d-1e5fb4833a29@huawei.com> From: Yunlong Song Message-ID: Date: Mon, 4 Sep 2017 09:54:07 +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: <2503831f-3868-4037-307d-1e5fb4833a29@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 X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.59ACB254.00E1,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b4088d526ea95be72007d4d00d570429 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1587 Lines: 57 The update_sit_entry provides this: ... 1658 if (!f2fs_test_bit(offset, se->ckpt_valid_map)) 1659 se->ckpt_valid_blocks += del; ... As a result, the ckpt_valid_blocks is always larger than valid_blocks. If not correct, can you provide the case valid_blocks larger than ckpt_valid_blocks? On 2017/9/4 9:17, Chao Yu wrote: > On 2017/9/1 20:14, Yunlong Song wrote: >> se->ckpt_valid_blocks is always larger than se->valid_blocks, so >> get_ssr_cost can be cleared. > I think this is not correct. > > Thanks, > >> Signed-off-by: Yunlong Song >> --- >> fs/f2fs/gc.c | 11 +---------- >> 1 file changed, 1 insertion(+), 10 deletions(-) >> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >> index cd147e7..b226760 100644 >> --- a/fs/f2fs/gc.c >> +++ b/fs/f2fs/gc.c >> @@ -277,20 +277,11 @@ static unsigned int get_greedy_cost(struct f2fs_sb_info *sbi, >> valid_blocks * 2 : valid_blocks; >> } >> >> -static unsigned int get_ssr_cost(struct f2fs_sb_info *sbi, >> - unsigned int segno) >> -{ >> - struct seg_entry *se = get_seg_entry(sbi, segno); >> - >> - return se->ckpt_valid_blocks > se->valid_blocks ? >> - se->ckpt_valid_blocks : se->valid_blocks; >> -} >> - >> static inline unsigned int get_gc_cost(struct f2fs_sb_info *sbi, >> unsigned int segno, struct victim_sel_policy *p) >> { >> if (p->alloc_mode == SSR) >> - return get_ssr_cost(sbi, segno); >> + return get_seg_entry(sbi, segno)->ckpt_valid_blocks; >> >> /* alloc_mode == LFS */ >> if (p->gc_mode == GC_GREEDY) >> > > . > -- Thanks, Yunlong Song