Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6757220imm; Tue, 24 Jul 2018 02:29:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcx32MPZtqWGwKfSyn689YCMuVYtWPb24nbY6PbNj/kFOSQh5TdH3KB8bdSzJtMl/zIzjuB X-Received: by 2002:a63:d155:: with SMTP id c21-v6mr3889101pgj.188.1532424552973; Tue, 24 Jul 2018 02:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532424552; cv=none; d=google.com; s=arc-20160816; b=S5tbKAaQNKr7NShViq6gaMjpkFyH2sNGxPJ7ZM0F6y30/FW4n67dUaeWvpX4q1P84N hKH125kRev4SS5voyBDK2JP1bqyWsk/aAPo+Vkbl/jpg1Qi8WmHXnxWrV7HxKLhOKZL/ iVT23WebxeEwvxBZ8mzvwb2mhwkDF6Wr41jEd7xwRNTUWF3ZSP4DWIZIlVDKNqkE9qOC WnMmXnNOvBiO3h8LragWpA0h/OFkzctz4NwlmCfdKv/QHqVyu2zztIfZZgmLaKzfGs2x ueaq1ag6WThL2rcXTcQMHL52I0DhHQj+Govt02Rb4hTNlirFoQq7Wt9i3wV+guVwfJf2 GCCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=Q+lf9VkWxHplxeqb80Pj0//PXCQZo7u0YJKBHpc210o=; b=SbtcFMEwC6eEQZpSFmyN/GtQMsH9YlTRww+HklSE6QZXtsKqXyiDWulPXKW0yyEgwn TMtIXNr5qAQYV5sxzU/fcOvPiQOydvzlpEfHzwiyMmc1J7oJaqcsRwAfAt8RptkC6BkC 2rZdVlsL3UROXZJL5xQL8xQAEIU5UEAhPRCZ6Kn7aBJWiwUzAeVKhC48FpdxpMuY3PGt X1sTnOvhqHra02sQGz6lGK4WpF4w+7iV641yd69vWQpLIdjv4u521bztP/PLX4/csDYK zqvwFHamB9yCfr7z3Mda/Xdjkc//aZM5T1ED7SFWKWOeBEUivQILwDpqft0lyXuFFMIG Og7g== 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 l20-v6si10685043pgo.471.2018.07.24.02.28.57; Tue, 24 Jul 2018 02:29:12 -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 S2388389AbeGXKdO (ORCPT + 99 others); Tue, 24 Jul 2018 06:33:14 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9711 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388211AbeGXKdO (ORCPT ); Tue, 24 Jul 2018 06:33:14 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E9CEE12EAED33; Tue, 24 Jul 2018 17:27:36 +0800 (CST) Received: from huawei.com (10.113.189.234) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.382.0; Tue, 24 Jul 2018 17:27:29 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH v2] f2fs: clear victim_secmap when section has full valid blocks Date: Tue, 24 Jul 2018 17:27:22 +0800 Message-ID: <1532424442-9867-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1532355022-163029-1-git-send-email-yunlong.song@huawei.com> References: <1532355022-163029-1-git-send-email-yunlong.song@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.113.189.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Without this patch, f2fs only clears victim_secmap when it finds out that the section has no valid blocks at all, but forgets to clear the victim_secmap when the whole section has full valid blocks. Signed-off-by: Yunlong Song --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index cfff7cf..0a79554 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -776,7 +776,8 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, if (test_and_clear_bit(segno, dirty_i->dirty_segmap[t])) dirty_i->nr_dirty[t]--; - if (get_valid_blocks(sbi, segno, true) == 0) + if (get_valid_blocks(sbi, segno, true) == 0 || + get_valid_blocks(sbi, segno, true) == BLKS_PER_SEC(sbi)) clear_bit(GET_SEC_FROM_SEG(sbi, segno), dirty_i->victim_secmap); } -- 1.8.5.2