Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3622918ybi; Mon, 29 Jul 2019 09:39:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNw7S0D3wrxWmmHQ8K+W2Dub1//i0YULey9aoFKIx/OyfMAZ2CXb9dLOpzKJtcgJxjh12h X-Received: by 2002:a17:902:ac87:: with SMTP id h7mr114736592plr.36.1564418355884; Mon, 29 Jul 2019 09:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564418355; cv=none; d=google.com; s=arc-20160816; b=wSYjho/yR2/l2nxicjA/M6jXyd/DJv9QqgS9zHxDCi0gQgbDDjLEVGPecihhUKSx7Q LAxlqvK3hI+8DbBYPO7jJ3A3/kvIWyYXJfc+maEK1ri9NuzBsdYQ5UDgReL80/ASWPAz OIZhIaNt47nGXF4tOOOAYfX6SibQq+KRrK2bYwq+8enWSEj3pCvVtvu5Rf7v774Hp7H6 +NLygfgMajI9w3JbgvnzGYVdfVKlfJ/nblus0tO0gpTxab8LnvqHriop6Poe2Vo7PrZy oooYFqv0sQNj/RFd0p4lVfocUyK3MAphdXLrTGLolBcJzjUBtz5duMB8yObX2oIC8nRo qKlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=XKHXPDxRecsQtRl+aiRsfHYdNoifPh6ZP5S7KkpQm0A=; b=JYwQpXDSleLF/0tnX6+J4y7ESWiYVQqYTB2hmWTHG1ljpebX2h5NZEugz+dy9oFtEa 2GVe6o/nldVVHWAR+WzHipRGjAdG+gKvZ/+l/h0LUBPHd+e7U8W/OhM2xJZwSYY8w0XG KwaTT3LQGc+ijJB+5ibUftCoyE6+Ke07z8la4o+5NG0Jz9Ca1IyhmwC+FHJuN6iJ0LIs SE8k7xkNVVuHHvPzmqDgDeExxX/CPwil0dVvEQWFIU2kThkbw2lpc3OZ+zM+ETY1xuxv eeyeirkGAnZJzYumDzDxmlcpoPTUxXoKGr4rX0DmgyQ7M6PzRx2tXNry/yx9WCVpO6oD pQDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="o8LQ/PbT"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si23608489plp.304.2019.07.29.09.39.01; Mon, 29 Jul 2019 09:39:15 -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; dkim=pass header.i=@kernel.org header.s=default header.b="o8LQ/PbT"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727278AbfG2QBH (ORCPT + 99 others); Mon, 29 Jul 2019 12:01:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:56810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbfG2QBG (ORCPT ); Mon, 29 Jul 2019 12:01:06 -0400 Received: from [192.168.0.101] (unknown [180.111.32.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DEDE121773; Mon, 29 Jul 2019 16:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564416065; bh=zsjK32URpw9E8xLWXuq6yO1piXT5U7FJRiPetxczkY8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=o8LQ/PbTkEysPkQh7s5MVgRkrgiRvXMDYlm8omA3B0CBInsniNIHXTNJ2PZJsNi1Z JueR51t44xI69CjyVNWrfVCorx+hK+Dn0qG5uc666cyg8aS3049O10gSFQDYEdpotu owo+G2PTA73CG0Z0jbYWREIAYkSdj950MAFQl9b0= Subject: Re: [f2fs-dev] [PATCH] f2fs: Fix indefinite loop in f2fs_gc() To: Sahitya Tummala , Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org References: <1564377626-12898-1-git-send-email-stummala@codeaurora.org> From: Chao Yu Message-ID: Date: Tue, 30 Jul 2019 00:00:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1564377626-12898-1-git-send-email-stummala@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sahitya, On 2019-7-29 13:20, Sahitya Tummala wrote: > Policy - foreground GC, LFS mode and greedy GC mode. > > Under this policy, f2fs_gc() loops forever to GC as it doesn't have > enough free segements to proceed and thus it keeps calling gc_more > for the same victim segment. This can happen if the selected victim > segment could not be GC'd due to failed blkaddr validity check i.e. > is_alive() returns false for the blocks set in current validity map. > > Fix this by not resetting the sbi->cur_victim_sec to NULL_SEGNO, when > the segment selected could not be GC'd. This helps to select another > segment for GC and thus helps to proceed forward with GC. > > Signed-off-by: Sahitya Tummala > --- > fs/f2fs/gc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 8974672..7bbcc4a 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -1303,7 +1303,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, > round++; > } > > - if (gc_type == FG_GC) > + if (gc_type == FG_GC && seg_freed) > sbi->cur_victim_sec = NULL_SEGNO; In some cases, we may remain last victim in sbi->cur_victim_sec, and jump out of GC cycle, then SSR can skip the last victim due to sec_usage_check()... Thanks, > > if (sync) >