All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Noll <maan@systemlinux.org>
To: Dan Williams <dan.j.williams@intel.com>
Cc: neilb@suse.de, linux-raid@vger.kernel.org,
	ed.ciechanowski@intel.com, jacek.danecki@intel.com
Subject: Re: [PATCH 1/3] md: add 'size' as a personality method
Date: Fri, 6 Mar 2009 17:15:51 +0100	[thread overview]
Message-ID: <20090306161551.GI32416@skl-net.de> (raw)
In-Reply-To: <20090306002448.9882.88409.stgit@dwillia2-linux.ch.intel.com>

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

On 17:24, Dan Williams wrote:
> +raid10_size(mddev_t *mddev, sector_t sectors, int raid_disks)
> +{
> +	sector_t size;
> +	int chunk_shift;
> +	conf_t *conf = mddev_to_conf(mddev);
> +	int chunk_size = mddev->chunk_size;
> +
> +	if (!raid_disks)
> +		raid_disks = mddev->raid_disks;
> +	if (!sectors)
> +		sectors = mddev->dev_sectors;
> +
> +	chunk_shift = ffz(~chunk_size) - 9;
> +	size = sectors >> chunk_shift;
> +	sector_div(size, conf->far_copies);
> +	size = size * raid_disks;
> +	sector_div(size, conf->near_copies);
> +
> +	return size << chunk_shift;
> +}

Is there a reason you are recomputing chunk_shift instead of using
conf->chunk_shift.

> +static sector_t
> +raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks)
> +{
> +	raid5_conf_t *conf = mddev_to_conf(mddev);
> +	int chunk_size = mddev->chunk_size;
> +
> +	if (!sectors)
> +		sectors = mddev->dev_sectors;
> +	if (!raid_disks)
> +		raid_disks = conf->previous_raid_disks;
> +
> +	sectors &= ~(chunk_size / 512 - 1);

Don't we need a cast to sector_t here?

Andre
-- 
The only person who always got his work done by Friday was Robinson Crusoe

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2009-03-06 16:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06  0:24 [PATCH 0/3] Support setting the array size from userspace Dan Williams
2009-03-06  0:24 ` [PATCH 1/3] md: add 'size' as a personality method Dan Williams
2009-03-06 16:15   ` Andre Noll [this message]
2009-03-06 17:55     ` Dan Williams
2009-03-06  0:24 ` [PATCH 2/3] md: centralize ->array_sectors modifications Dan Williams
2009-03-06  0:24 ` [PATCH 3/3] md: 'array_size' sysfs attribute Dan Williams
2009-03-06 16:15   ` Andre Noll
2009-03-06 18:20     ` Dan Williams
2009-03-07  6:28     ` Dan Williams
2009-03-09 10:12       ` Andre Noll

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=20090306161551.GI32416@skl-net.de \
    --to=maan@systemlinux.org \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=jacek.danecki@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.