linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Maciej Naruszewicz <maciej.naruszewicz@intel.com>
Cc: linux-raid@vger.kernel.org, maciej.patelczyk@intel.com
Subject: Re: [PATCH 6/6] Add MD_ARRAY_SIZE for --examine --export
Date: Tue, 2 Oct 2012 16:42:45 +1000	[thread overview]
Message-ID: <20121002164245.498f4043@notabene.brown> (raw)
In-Reply-To: <20120926114422.328.64275.stgit@gklab-128-174.igk.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1677 bytes --]

On Wed, 26 Sep 2012 13:44:22 +0200 Maciej Naruszewicz
<maciej.naruszewicz@intel.com> wrote:

> An additional pair of key=value for --examine --export.
> 
> Signed-off-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com>
> ---
>  super1.c |   19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/super1.c b/super1.c
> index b04945f..0df5bee 100644
> --- a/super1.c
> +++ b/super1.c
> @@ -495,6 +495,7 @@ static void export_examine_super1(struct supertype *st)
>  	struct mdp_superblock_1 *sb = st->sb;
>  	int i;
>  	int len = 32;
> +	int layout;
>  
>  	printf("MD_LEVEL=%s\n", map_num(pers, __le32_to_cpu(sb->level)));
>  	printf("MD_DEVICES=%d\n", __le32_to_cpu(sb->raid_disks));
> @@ -506,6 +507,24 @@ static void export_examine_super1(struct supertype *st)
>  		}
>  	if (len)
>  		printf("MD_NAME=%.*s\n", len, sb->set_name);
> +	if (__le32_to_cpu(sb->level) > 0) {
> +		int ddsks = 0, ddsks_denom = 1;
> +		switch(__le32_to_cpu(sb->level)) {
> +			case 1: ddsks=1;break;
> +			case 4:
> +			case 5: ddsks = __le32_to_cpu(sb->raid_disks)-1; break;
> +			case 6: ddsks = __le32_to_cpu(sb->raid_disks)-2; break;
> +			case 10:
> +				layout = __le32_to_cpu(sb->layout);
> +				ddsks = __le32_to_cpu(sb->raid_disks);
> +				ddsks_denom = (layout&255) * ((layout>>8)&255);
> +			}
> +		if (ddsks) {
> +			long long asize = __le64_to_cpu(sb->size);
> +			asize = (asize << 9) * ddsks / ddsks_denom;
> +			printf("MD_ARRAY_SIZE=%s\n",human_size_brief(asize,JEDEC));
> +		}
> +	}
>  	printf("MD_UUID=");
>  	for (i=0; i<16; i++) {
>  		if ((i&3)==0 && i != 0) printf(":");


Applied,
thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2012-10-02  6:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26 11:42 [mdadm,v1 PATCH 0/6] Extend mdadm [...] --export Maciej Naruszewicz
2012-09-26 11:42 ` [PATCH 1/6] imsm: Add --export option for --detail-platform Maciej Naruszewicz
2012-10-02  6:28   ` NeilBrown
2012-09-26 11:42 ` [PATCH 2/6] imsm: Add --controller-path " Maciej Naruszewicz
2012-10-02  6:36   ` NeilBrown
2012-10-02 10:54     ` Maciej Naruszewicz
2012-09-26 11:42 ` [PATCH 3/6] Fix return code " Maciej Naruszewicz
2012-10-02  6:38   ` NeilBrown
2012-09-26 11:44 ` [PATCH 4/6] Synchronize size calculation in human_size and human_size_brief Maciej Naruszewicz
2012-10-02  6:40   ` NeilBrown
2012-09-26 11:44 ` [PATCH 5/6] Display size with human_size_brief with a chosen prefix Maciej Naruszewicz
2012-10-02  6:41   ` NeilBrown
2012-09-26 11:44 ` [PATCH 6/6] Add MD_ARRAY_SIZE for --examine --export Maciej Naruszewicz
2012-10-02  6:42   ` NeilBrown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121002164245.498f4043@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=maciej.naruszewicz@intel.com \
    --cc=maciej.patelczyk@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).