From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BCF1C6778A for ; Tue, 24 Jul 2018 09:27:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0D6920852 for ; Tue, 24 Jul 2018 09:27:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0D6920852 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388393AbeGXKdO (ORCPT ); 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