Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5854883imm; Mon, 23 Jul 2018 07:13:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd93vbN5C5nVOdOfCnBarWug6a+XzE++3oRY13HXF+aUF2mqHZVvUpAyfy2YLj6nkFLG74I X-Received: by 2002:a63:ae42:: with SMTP id e2-v6mr12411568pgp.351.1532355230178; Mon, 23 Jul 2018 07:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532355230; cv=none; d=google.com; s=arc-20160816; b=ypwWyCpdAiiwemofVNLV6jKuFn9eT0Pr0T7SYgK5qYggKfC7X8tozHb5S7SFw74dZn p57rXYI3bB+gTHBPiV4AR8mL2YhWl1rbZcYrx+EQljMx8MtUUcya0aIpeR2fD8qnBzjE AE3CWQgGL8sPSVksA8lwlt8VBPRkav02ZCFtJA5H7LsLqOVNzNcPF5gXZxF7PK1gLUJ+ aMw6w0bmcxznTFzfjZ2d62BkdGV0InVwq/JfdU82ablsRs+LHWQNunHFL1tbJTRnYmSo E12SxEuwwfONOrIqL3djWm74ENqrlLUqkNshupBNuHUVmYd6N5+w5tH5jJJveJV9DTuk XbGw== 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=c8NX5kMEIz0IK7Wbh6u83qvuMBt0jcs+RVND5VLbyEg=; b=VApcw+mocXXnhnsO4r+Dom0SssMsWYFqaT43Sn7MFkI6Z5ZCEIKcBEY7WrijU5k2so +kQAoNQ3HwHQiJzLwqnPlUyM/8+XdwL8dCAzTq9s7XvccraNmvD6u2ea41P1DCVtwZtu e/ucHVLHtn6WsGx7B8BYRDi0nNjtItlVr0mrBU5ZdCohsUkvlH7CZ8HKpmxB25ZxK7Ma BhQcDQxD/frGuRuPFUD2/Fstp3h/g+wh5Gl9eKdVS0B8CDOWdFH8L5/ZWC3hv8dz7iyi 0hZcVCJQK4IsW4l4yFoKnPlacdfjsFbXImeAj+/VdxEB74aAAmL5Zkpx7OUSfn/u70PZ nTPA== 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 t21-v6si9096624pgb.553.2018.07.23.07.13.35; Mon, 23 Jul 2018 07:13:50 -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 S2388345AbeGWPMn (ORCPT + 99 others); Mon, 23 Jul 2018 11:12:43 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:55398 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388129AbeGWPMn (ORCPT ); Mon, 23 Jul 2018 11:12:43 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id F010740F93243; Mon, 23 Jul 2018 22:10:45 +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:40 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH 5/5] f2fs: add proc entry to show victim_secmap bitmap Date: Mon, 23 Jul 2018 22:10:22 +0800 Message-ID: <1532355022-163029-6-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 This patch adds a new proc entry to show victim_secmap information in more detail, which is very helpful to know the get_victim candidate status clearly, and helpful to debug problems (e.g., some sections can not gc all of its blocks, since some blocks belong to atomic file, leaving victim_secmap with section bit setting, in extrem case, this will lead all bytes of victim_secmap setting with 0xff). Signed-off-by: Yunlong Song --- fs/f2fs/sysfs.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index bca1236..f22782a 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -615,6 +615,28 @@ static int __maybe_unused iostat_info_seq_show(struct seq_file *seq, return 0; } +static int __maybe_unused victim_bits_seq_show(struct seq_file *seq, + void *offset) +{ + struct super_block *sb = seq->private; + struct f2fs_sb_info *sbi = F2FS_SB(sb); + struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); + int i; + + seq_puts(seq, "format: victim_secmap bitmaps\n"); + + for (i = 0; i < MAIN_SECS(sbi); i++) { + if ((i % 10) == 0) + seq_printf(seq, "%-10d", i); + seq_printf(seq, "%d", test_bit(i, dirty_i->victim_secmap) ? 1 : 0); + if ((i % 10) == 9 || i == (MAIN_SECS(sbi) - 1)) + seq_putc(seq, '\n'); + else + seq_putc(seq, ' '); + } + return 0; +} + int __init f2fs_init_sysfs(void) { int ret; @@ -664,6 +686,8 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi) segment_bits_seq_show, sb); proc_create_single_data("iostat_info", S_IRUGO, sbi->s_proc, iostat_info_seq_show, sb); + proc_create_single_data("victim_bits", S_IRUGO, sbi->s_proc, + victim_bits_seq_show, sb); } return 0; } @@ -674,6 +698,7 @@ void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi) remove_proc_entry("iostat_info", sbi->s_proc); remove_proc_entry("segment_info", sbi->s_proc); remove_proc_entry("segment_bits", sbi->s_proc); + remove_proc_entry("victim_bits", sbi->s_proc); remove_proc_entry(sbi->sb->s_id, f2fs_proc_root); } kobject_del(&sbi->s_kobj); -- 1.8.5.2