Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4583496ybe; Mon, 9 Sep 2019 11:17:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqynLHHIY0k0bKrDyPreb8254p3i6gVUs+hco9gXEVrQLK881uXiWs3PuqTfRRYRfl1HldGf X-Received: by 2002:a50:9eee:: with SMTP id a101mr3446665edf.128.1568053048674; Mon, 09 Sep 2019 11:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568053048; cv=none; d=google.com; s=arc-20160816; b=XpzNZxS2R2sZpvl+7mynlWSfeH/nJhzHWA7ZaUQ9Iw/mHT5oIeeEa432n6p+BvTTji PZ+mnwCbVvgm7XjZMjRD2oxSDbfumW1ZPL5z3w2mjAQSc/BFIp/jw1GjhJbc+YSUjDx/ eQX3Z0hstIFgMHTTJ9nojhQr9qkxGGeezXaMOCMIo1Junkvv2SqdyQ3Bo/QYX82qwgTr swL9Ef+0SaraKSTRzdKaWULdLfbuFpm3x/XLkk+0WoZADSdjKn+hAdyTtwgIwCD0XZVo FsLNU4XVEKJrDckWOTVe5iGcYv5TW2Z50HI4BAJLK3TQc0nVbP4Fg3roQluAzntWQ5hz QTuA== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kBVGNDcTKPZVznvFRf5crqHiUXKlbunngo6Cw0m5plo=; b=eTfx+dzgrP+qWlLLw4HuCn4TDZg4C2KUv/CxZm9y2JivtGUTTKo1ZE5uDmaX9MI+qk E5qeSa0I99nNmn4ftMDnPbJ8MT7gh8QxprgL4AzRytyVdWPWBoFM3HyVMXGqSfaMoGXG ww/cTEkghEIlfsrjjVUi7RXPjlFEMJaKqxx1LcG4rmgfdbjZzq6CEZIbRTPm4HjQZyQK 5z3uDOV3I1SNVlB9TOEwJfoy6FqmQDlsOFVCPq1hWloWaDOknK+M4bhQLwPmTfwplMu/ dWlP8UtZIx2Kp6krYhMed+yXEs17rKN8c10PSjEQ2soNYi2YuJFC0wEtY0wh8mEy3877 vxAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U+XjKg5B; 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 k11si8953622eds.29.2019.09.09.11.17.04; Mon, 09 Sep 2019 11:17:28 -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=U+XjKg5B; 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 S1732110AbfIIBZh (ORCPT + 99 others); Sun, 8 Sep 2019 21:25:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:40856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731552AbfIIBZg (ORCPT ); Sun, 8 Sep 2019 21:25:36 -0400 Received: from localhost (unknown [148.69.85.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2F562086D; Mon, 9 Sep 2019 01:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567992336; bh=E2cqUMgnAApDs9Dsnc3TkUoWZaykQ41wUr7ucx5cits=; h=From:To:Cc:Subject:Date:From; b=U+XjKg5BZeMQiD3PXoW/UEPCmrQK8Q0NPiqdpxHOERHwJI9vfsVDlXvDI/pCc3ckO PQques6ArVn5mc8J/Jf6suYB6L4roUtEABY/k+NfQlNwZUIgvav6B5FPdgAvQzN+Fl QTFKL6XoELbN8HFR3CSohe0uvu5YCDxnR0a443LM= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 1/2] f2fs: do not select same victim right again Date: Mon, 9 Sep 2019 02:25:31 +0100 Message-Id: <20190909012532.20454-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GC must avoid select the same victim again. Signed-off-by: Jaegeuk Kim --- fs/f2fs/gc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index e88f98ddf396..15ca8bbb0b22 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -274,6 +274,9 @@ static unsigned int get_cb_cost(struct f2fs_sb_info *sbi, unsigned int segno) static inline unsigned int get_gc_cost(struct f2fs_sb_info *sbi, unsigned int segno, struct victim_sel_policy *p) { + if (sbi->cur_victim_sec == GET_SEC_FROM_SEG(sbi, segno)) + return UINT_MAX; + if (p->alloc_mode == SSR) return get_seg_entry(sbi, segno)->ckpt_valid_blocks; @@ -1326,9 +1329,6 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, round++; } - if (gc_type == FG_GC) - sbi->cur_victim_sec = NULL_SEGNO; - if (sync) goto stop; -- 2.19.0.605.g01d371f741-goog