Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5852777imm; Mon, 23 Jul 2018 07:11:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeokH+ywwzAb9+vzN+Fpdgj/65e4WY22nLBnpwtspXhTfOHEBxCW2aVErCaipgGyUhXDY0w X-Received: by 2002:a63:9902:: with SMTP id d2-v6mr12404982pge.343.1532355118675; Mon, 23 Jul 2018 07:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532355118; cv=none; d=google.com; s=arc-20160816; b=FCfSfgcC0Muywdhum/yFNor7DMJL3MQcb5OXdYF7lSHFqgj4OGS5SMnm2eCA3IAJxi CnmggwVjGekfu3Id8QnkKblJnV5N9CBgfB/U6owXSLf5xlVDYu3OCmc7x4KUMmfL3DJ6 ETEUxkFmQClru5fi26UGkZKHtZU+Ntavt8qNZpuHlkLauaT0MKWALbu0XhR+hC5rEj4z x7D2wEZmkk1fmSjgctebAQomi/55xyfN8XZeAHcTBh5vi94wC+MP/tcEbW0iNmB/Ff/+ YhEz3+hF+kzhdi3ahSqY7+2rVikZuHsrGGhvILAgSmzztoXkS+nTpMQgL+cnqnGi7l45 eWvQ== 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=jldqeprh8udmhMALxSKh9vX/XUgwBXdEEWhW8LBQ9CA=; b=O0fWnTSvTsv024pQDl2JblyUZZQClNiC1biZocR6Qe5MP3Dkg5/gfH44zqk4d/xaWQ v/i17x1Uur0D3k34qydZNomERNKlSNVpuyi+boXtW6+i9OuZXkTNdUv71SI7ZQzGJQuJ BMd/UsnZUWkRPjmkO1UwI6mVZnkV3LYKQM8B7U7avHE7mYNukNTCx6p6wYcDA/BbCIEr kx+GCaiWukE9byrSHRZl/PVn6b2xpy8XCBBygrxFYwZhiRxztOcnO9hjnS8N5cPOR0+s 8K7EGz33Ui9YXSUL9rYasz2QlOirlq11Zvpaxjsd0qAFScQulut9MQzjvs6Dqes9jo6M +5PQ== 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 r5-v6si7887491pga.602.2018.07.23.07.11.44; Mon, 23 Jul 2018 07:11:58 -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 S2388248AbeGWPMN (ORCPT + 99 others); Mon, 23 Jul 2018 11:12:13 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9669 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388099AbeGWPMM (ORCPT ); Mon, 23 Jul 2018 11:12:12 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 88111EE27A07; Mon, 23 Jul 2018 22:10:40 +0800 (CST) Received: from huawei.com (10.113.189.234) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.382.0; Mon, 23 Jul 2018 22:10:32 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH 1/5] f2fs: clear victim_secmap when section has full valid blocks Date: Mon, 23 Jul 2018 22:10:18 +0800 Message-ID: <1532355022-163029-2-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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index cfff7cf..255bff5 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -776,7 +776,9 @@ 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) == + (sbi->segs_per_sec << sbi->log_blocks_per_seg)) clear_bit(GET_SEC_FROM_SEG(sbi, segno), dirty_i->victim_secmap); } -- 1.8.5.2