Received: by 10.223.164.221 with SMTP id h29csp652187wrb; Wed, 11 Oct 2017 06:59:05 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAfxwv5HgAPWw33OUu0JQGoQ+JSjxhklr3hl0PXDkIXe0E8EjWQHWDUEG9ziIRqIVblNBcu X-Received: by 10.101.77.210 with SMTP id q18mr13639276pgt.95.1507730345493; Wed, 11 Oct 2017 06:59:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507730345; cv=none; d=google.com; s=arc-20160816; b=KAxm8Gn3jGW7oY+JxtUKFwjXo370mhiSynlNB+nkxGc9oKr9aMBpaqErcZahZQEHBV h2W6Q7r54x/Lfa7DPC/rWk673R/ZBnZ/KhUlhpe2k8tTBcSes+jiu14sAYs8pIR/USGL awtA5n0xhFJJJfdNR4dvvDYXhqa2fMkWZb+RH3If2jyYFjwWDXq/XUYQAvQosD1yrXu9 DISPuQrBgnk6GEhH3TYLsi6xBzUlwLy51oEVLsNgtfJmr+Tv+tiIpKU7vOnyIMylHev0 bIg92GP2C0VBaQyjwmMLggIGRS29XiPvKkRcU4NbiIAR8lTci9h9x/QX6kND9ysghTdT GI7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=UFOa/hMZJyK1BtqtN0Mj2rwDRCuOz2Q3JDAMA8DTrMM=; b=DvF8MUjFRBoGJ7r7VMM3mdJnYLsXkpGYltRc5sC7MpU2s8mYHpVYSK3J1Us/n/wgcJ Sk2T6OkOqMpIb1arwWV62KEzZuqTC3Uuc1rCNPGjT8GJy8EHDBgE1jVmS1OPNg7kKPvT +r9wP/f+cV1LxftCMUuEp6GR4mPpYOPTVr5Hnp3OkHtOBtvr3Vrk2MjrmZZroSWn2HeH K1lShvwOKG4Velgq4OgL7Qtc315PAfxG4qzD6cPW4cP6g5yTaoxPjVU7GnwdjkUFbYYi PREvJvTIh/aqb7XHhE5WKHH/m5ZO19qpz6S300ea9rEGrzjDO5cCO8K9adS+fEKt59/Q 589A== 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 h1si10945431pld.533.2017.10.11.06.58.51; Wed, 11 Oct 2017 06:59:05 -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 S1757806AbdJKN4f (ORCPT + 99 others); Wed, 11 Oct 2017 09:56:35 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8002 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752777AbdJKN4c (ORCPT ); Wed, 11 Oct 2017 09:56:32 -0400 Received: from 172.30.72.58 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.58]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DIY08988; Wed, 11 Oct 2017 21:56:30 +0800 (CST) Received: from huawei.com (10.107.193.250) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 11 Oct 2017 21:51:09 +0800 From: Yunlong Song To: , , , , CC: , , , , Subject: [PATCH] f2fs: add bug_on when f2fs_gc even fails to get one victim Date: Wed, 11 Oct 2017 21:51:04 +0800 Message-ID: <1507729864-118702-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.250] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.59DE230E.008F,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: 8618ada7df3fc96d3d42ef4ce8fd66a3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This can help us to debug on some corner case. Signed-off-by: Yunlong Song --- 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..960503e 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_gc = 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_gc = 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_gc); ret = -ENODATA; goto stop; } -- 1.8.5.2 From 1583460043269010562@xxx Wed Nov 08 01:39:34 +0000 2017 X-GM-THRID: 1583460043269010562 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread