From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932609AbdKCQIb (ORCPT ); Fri, 3 Nov 2017 12:08:31 -0400 Received: from mr11p26im-asmtp004.me.com ([17.110.86.109]:59055 "EHLO mr11p26im-asmtp004.me.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752249AbdKCQIa (ORCPT ); Fri, 3 Nov 2017 12:08:30 -0400 X-Greylist: delayed 3600 seconds by postgrey-1.27 at vger.kernel.org; Fri, 03 Nov 2017 12:08:30 EDT X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-03_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711030182 Content-type: text/plain; charset=gb2312 MIME-version: 1.0 (1.0) Subject: Re: [PATCH v2] f2fs: add bug_on when f2fs_gc even fails to get one victim From: =?GB2312?B?y87UxsH6?= X-Mailer: iPhone Mail (15A432) In-reply-to: <20171103034402.GC11335@jaegeuk-macbookpro.roam.corp.google.com> Date: Fri, 03 Nov 2017 23:08:23 +0800 Cc: Yunlong Song , chao@kernel.org, yuchao0@huawei.com, miaoxie@huawei.com, bintian.wang@huawei.com, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Message-id: <3E42CE2B-DC94-47C2-8AD3-76ECD95F10E3@icloud.com> References: <1507729864-118702-1-git-send-email-yunlong.song@huawei.com> <1507901500-162168-1-git-send-email-yunlong.song@huawei.com> <20171103034402.GC11335@jaegeuk-macbookpro.roam.corp.google.com> To: Jaegeuk Kim Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vA3G8bxi024155 OK to me. > > >> On 10/13, Yunlong Song wrote: >> This can help us to debug on some corner case. >> >> Signed-off-by: Yunlong Song >> Signed-off-by: Chao Yu >> --- >> fs/f2fs/gc.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >> index 197ebf4..2b03202 100644 >> --- a/fs/f2fs/gc.c >> +++ b/fs/f2fs/gc.c >> @@ -986,6 +986,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, >> .ilist = LIST_HEAD_INIT(gc_list.ilist), >> .iroot = RADIX_TREE_INIT(GFP_NOFS), >> }; >> + bool need_fggc = false; >> >> trace_f2fs_gc_begin(sbi->sb, sync, background, >> get_pages(sbi, F2FS_DIRTY_NODES), >> @@ -1018,8 +1019,10 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, >> if (ret) >> goto stop; >> } >> - if (has_not_enough_free_secs(sbi, 0, 0)) >> + if (has_not_enough_free_secs(sbi, 0, 0)) { >> gc_type = FG_GC; >> + need_fggc = true; >> + } >> } >> >> /* f2fs_balance_fs doesn't need to do BG_GC in critical path. */ >> @@ -1028,6 +1031,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, >> goto stop; >> } >> if (!__get_victim(sbi, &segno, gc_type)) { >> + f2fs_bug_on(sbi, !total_freed && need_fggc); > > Just like this? > > f2fs_bug_on(sbi, !total_freed && !sync && gc_type == FG_GC)£» Agree > >> ret = -ENODATA; >> goto stop; >> } >> -- >> 1.8.5.2