From patchwork Wed Oct 11 13:51:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunlong Song X-Patchwork-Id: 9999707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7185B6037F for ; Wed, 11 Oct 2017 13:57:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 654D828A51 for ; Wed, 11 Oct 2017 13:57:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A39528A53; Wed, 11 Oct 2017 13:57:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC38728A51 for ; Wed, 11 Oct 2017 13:57:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757579AbdJKN4e (ORCPT ); Wed, 11 Oct 2017 09:56:34 -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 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }