linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Adam Kwolek <adam.kwolek@intel.com>
Cc: linux-raid@vger.kernel.org, ed.ciechanowski@intel.com,
	marcin.labun@intel.com, dan.j.williams@intel.com
Subject: Re: [PATCH 5/8] Move code to get_data_disks() function
Date: Mon, 3 Oct 2011 09:58:29 +1100	[thread overview]
Message-ID: <20111003095829.0ffbac67@notabene.brown> (raw)
In-Reply-To: <20110927120513.4890.6242.stgit@gklab-128-013.igk.intel.com>

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

On Tue, 27 Sep 2011 14:05:13 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:

> Move code to function for code reuse.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>

Applied, thanks.

NeilBrown



> ---
> 
>  mdadm.h |    1 +
>  util.c  |   10 ++++++++--
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/mdadm.h b/mdadm.h
> index 8f3e786..4bbf660 100644
> --- a/mdadm.h
> +++ b/mdadm.h
> @@ -1165,6 +1165,7 @@ extern unsigned long long get_component_size(int fd);
>  extern void remove_partitions(int fd);
>  extern int test_partition(int fd);
>  extern int test_partition_from_id(dev_t id);
> +extern int get_data_disks(int level, int layout, int raid_disks);
>  extern unsigned long long calc_array_size(int level, int raid_disks, int layout,
>  				   int chunksize, unsigned long long devsize);
>  extern int flush_metadata_updates(struct supertype *st);
> diff --git a/util.c b/util.c
> index 0ea7e0d..50c98c1 100644
> --- a/util.c
> +++ b/util.c
> @@ -703,6 +703,12 @@ void print_r10_layout(int layout)
>  unsigned long long calc_array_size(int level, int raid_disks, int layout,
>  				   int chunksize, unsigned long long devsize)
>  {
> +	devsize &= ~(unsigned long long)((chunksize>>9)-1);
> +	return get_data_disks(level, layout, raid_disks) * devsize;
> +}
> +
> +int get_data_disks(int level, int layout, int raid_disks)
> +{
>  	int data_disks = 0;
>  	switch (level) {
>  	case 0: data_disks = raid_disks; break;
> @@ -713,8 +719,8 @@ unsigned long long calc_array_size(int level, int raid_disks, int layout,
>  	case 10: data_disks = raid_disks / (layout & 255) / ((layout>>8)&255);
>  		break;
>  	}
> -	devsize &= ~(unsigned long long)((chunksize>>9)-1);
> -	return data_disks * devsize;
> +
> +	return data_disks;
>  }
>  
>  #if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)


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

  reply	other threads:[~2011-10-02 22:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 12:04 [PATCH 0/8] Reshape restart after filesystem pivot Adam Kwolek
2011-09-27 12:04 ` [PATCH 1/8] Do not continue reshape during initrd phase Adam Kwolek
2011-10-02 22:19   ` NeilBrown
2011-09-27 12:04 ` [PATCH 2/8] Add continue option to grow command Adam Kwolek
2011-10-02 22:27   ` NeilBrown
2011-09-27 12:04 ` [PATCH 3/8] Do not restart reshape if it is started already Adam Kwolek
2011-10-02 22:41   ` NeilBrown
2011-09-27 12:05 ` [PATCH 4/8] Set correct reshape restart position Adam Kwolek
2011-10-02 22:56   ` NeilBrown
2011-09-27 12:05 ` [PATCH 5/8] Move code to get_data_disks() function Adam Kwolek
2011-10-02 22:58   ` NeilBrown [this message]
2011-09-27 12:05 ` [PATCH 6/8] Verify reshape restart position Adam Kwolek
2011-10-02 23:06   ` NeilBrown
2011-09-27 12:05 ` [PATCH 7/8] Manual update for --continue option Adam Kwolek
2011-09-27 12:05 ` [PATCH 8/8] " Adam Kwolek
2011-10-02 23:09   ` NeilBrown

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=20111003095829.0ffbac67@notabene.brown \
    --to=neilb@suse.de \
    --cc=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=marcin.labun@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).