Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp742495lqs; Tue, 5 Mar 2024 15:28:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVq/EZ583rz2dHC4HaaNMd9PLgh/89nkHQtF6frDHMtaUmuZU2Ny35pc3Hcu9Ia/HO0XbFa7WBQXmxKF8Qg3iVp92Kz8nXrO3ZuAP4jig== X-Google-Smtp-Source: AGHT+IG6Omhu9/a3uFYiGsib2MCTYcDO0huIy22kYhH5pAuiecm4oz8QGGtdGh5hqHNcF6eeOI0Y X-Received: by 2002:a0d:e805:0:b0:607:8306:6b0f with SMTP id r5-20020a0de805000000b0060783066b0fmr11392243ywe.18.1709681319591; Tue, 05 Mar 2024 15:28:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709681319; cv=pass; d=google.com; s=arc-20160816; b=Ep+wbIt6gz31+87LtN4zOwnb1TJz1JfGtMdbmFYCohl3kKVMcDRlZK6oJjWHNjoEz1 GgOIfA0Og6BsJq0HwLwDE1Xfu3CdcjtKAqCN3Qgd2YpZ2ZWWxUsDmD3IMp04enFnjejQ v6JRJ14amn9N9zibcmLDDF/Krb1yUFqM2zGBr8vhhbv329wbHPZgjKQpaao4qHlCM5bt nbCygmN47YTmMLMFT8PsXtzsFCvrmrcJc1Ibv1/pTvXyvuRdOaMWsedsf3CrGQfCtdL6 q/yir4XkkkkVJVz29aImlzJKNRbtsTRgZ734Z0Z/iby71ZvnwSvUVOEdtWq9xzLpUSyG f/yQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:to :from:date:dkim-signature; bh=eEjPiKXIb+fynaUZxSbO7iiQJsbWGK5dOMznx7fun64=; fh=YrirFCflo0HC1j049mfXEQ1jukbakoASvSGieiclzfE=; b=vNOqMHQOS8eyOHmtAiDz+JAaXksXp7Yulhi03H+O54hb1eUpErD9rjQKswz5z4azHw rhX8cnb/WuRql7/zIRWHjCa2gVbK2foHe5K6aAtojalWmB0AG8aEWuTywi7j8pdLZYxz Fa2NxZFd0I7nAMep2oHet4CHw3X5p5MtZbb4klujw717XZvtyRKBcZ07uIVsnf3xCeJt Y553VVLiRnqN0Ylwu8RI4LCQPUNc0JqTy8OyR6MFcqQqEgsQbAW8VJmTPP8Cko0g2ivd R/qyMuof1CaNFeav4i8VlLAa1Hz7WDDLJKec4JTjGfNBA+BunDRFmepTa536bBQEStse B88w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mipPC2ae; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-93099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93099-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id vu4-20020a05620a560400b00788374851d2si1994488qkn.567.2024.03.05.15.28.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 15:28:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mipPC2ae; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-93099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93099-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 534E21C24856 for ; Tue, 5 Mar 2024 23:28:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CFF012DD82; Tue, 5 Mar 2024 23:28:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mipPC2ae" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AF8012D201 for ; Tue, 5 Mar 2024 23:28:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709681306; cv=none; b=Nw+mRV4HADmLYwoW0oFqMm2R6DmTMpk96wuJZ5Tko325jc3C00u2MZKP46TTOaRB7ArLcsV8MSucBsLgsqldqmHF6jS2tSVEXSp/cxIBgvctFNi1wqIMaH5fYqkpkLl+Pw+o5t/s9Fb7ZzgAjyNtU5atwepfsa+hiVX/AwPaT4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709681306; c=relaxed/simple; bh=27L4pOWFrwC1g57YyoUEfbh9+oQq5Vs01mlHipPt88w=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nHBbsx9aWXvznIbR4AG1cbIgBu/ammxrHAYUkl+CPO8rxQohUNbUpq5YBwUxF/VwAiS8wCRuYHnWYwHuTHkOLzVHf76m9Psb87K9v0hx0rxDCoC35kS/9uiiOrrzsGhFaLfzgYhkOisveGPS4jiNLEQwwQWiaPwBFWHX4du02kk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mipPC2ae; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4BF5C433C7; Tue, 5 Mar 2024 23:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709681305; bh=27L4pOWFrwC1g57YyoUEfbh9+oQq5Vs01mlHipPt88w=; h=Date:From:To:Subject:References:In-Reply-To:From; b=mipPC2aeXfg/7ogYaUxPffwb4ewFUdxkoopES4d2yjjGNWMDBUD9/977cG1YZ5YYp FSoYNZs41dCN82TsO1nsFEJIYttizB+LEXOIxilmMZze8Ll+7h3UcHVgZZWovJ/DHE fqbmo3C/Z0Dx6RqayCFs4RPzr60E4y0FRFY00aGblAIX+5OzChpMYEggRpmWIRszq+ Wc8B9b0mw5MFe9INHJqtxZitApnz+ZERmvY7utXw4CG4PP739LJRGauLT7VvdPK0+q lAiL4e/wAmDeJIDECZ/EgV171VN4drAwHG7FJncSebVbyXa4OV34SFXzVKNXwMGnl0 fJwbdLBkfbT6w== Date: Tue, 5 Mar 2024 15:28:24 -0800 From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH v2] f2fs: add a proc entry show disk map Message-ID: References: <20240305001709.637722-1-jaegeuk@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240305001709.637722-1-jaegeuk@kernel.org> This patch adds the disk map of block address ranges configured by multiple partitions. Signed-off-by: Jaegeuk Kim --- from v1: - add more layout information fs/f2fs/sysfs.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 10f308b3128f..a568ce96cf56 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -1492,6 +1492,50 @@ static int __maybe_unused discard_plist_seq_show(struct seq_file *seq, return 0; } +static int __maybe_unused disk_map_seq_show(struct seq_file *seq, + void *offset) +{ + struct super_block *sb = seq->private; + struct f2fs_sb_info *sbi = F2FS_SB(sb); + int i; + + seq_printf(seq, "Address Layout : %5luB Block address (# of Segments)\n", + F2FS_BLKSIZE); + seq_printf(seq, " SB : %12s\n", "0/1024B"); + seq_printf(seq, " seg0_blkaddr : 0x%010x\n", SEG0_BLKADDR(sbi)); + seq_printf(seq, " Checkpoint : 0x%010x (%10d)\n", + le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr), 2); + seq_printf(seq, " SIT : 0x%010x (%10d)\n", + SIT_I(sbi)->sit_base_addr, + le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_sit)); + seq_printf(seq, " NAT : 0x%010x (%10d)\n", + NM_I(sbi)->nat_blkaddr, + le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_nat)); + seq_printf(seq, " SSA : 0x%010x (%10d)\n", + SM_I(sbi)->ssa_blkaddr, + le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_ssa)); + seq_printf(seq, " Main : 0x%010x (%10d)\n", + SM_I(sbi)->main_blkaddr, + le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_main)); + seq_printf(seq, " # of Sections : %12d\n", + le32_to_cpu(F2FS_RAW_SUPER(sbi)->section_count)); + seq_printf(seq, " Segs/Sections : %12d\n", + SEGS_PER_SEC(sbi)); + seq_printf(seq, " Section size : %12d MB\n", + SEGS_PER_SEC(sbi) << 1); + + if (!f2fs_is_multi_device(sbi)) + return 0; + + seq_puts(seq, "\nDisk Map for multi devices:\n"); + for (i = 0; i < sbi->s_ndevs; i++) + seq_printf(seq, "Disk:%2d (zoned=%d): 0x%010x - 0x%010x on %s\n", + i, bdev_is_zoned(FDEV(i).bdev), + FDEV(i).start_blk, FDEV(i).end_blk, + FDEV(i).path); + return 0; +} + int __init f2fs_init_sysfs(void) { int ret; @@ -1573,6 +1617,8 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi) victim_bits_seq_show, sb); proc_create_single_data("discard_plist_info", 0444, sbi->s_proc, discard_plist_seq_show, sb); + proc_create_single_data("disk_map", 0444, sbi->s_proc, + disk_map_seq_show, sb); return 0; put_feature_list_kobj: kobject_put(&sbi->s_feature_list_kobj); -- 2.44.0.278.ge034bb2e1d-goog