linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "NeilBrown" <neilb@suse.de>
Cc: linux-raid@vger.kernel.org, Andre Noll <maan@systemlinux.org>
Subject: Re: [PATCH 2/6] md: Fix a bug in super_1_sync().
Date: Mon, 25 May 2009 19:49:30 +1000 (EST)	[thread overview]
Message-ID: <0fe21d52863495891c4d62bbbe61a36c.squirrel@neil.brown.name> (raw)
In-Reply-To: <1243243657-21855-3-git-send-email-maan@systemlinux.org>

On Mon, May 25, 2009 7:27 pm, Andre Noll wrote:
> The new_chunk fields of both struct mddev_s and struct mdp_superblock_1
> are measured in bytes. However, in super_1_sync(), mddev->new_chunk
> is converted to sectors before it assigned to sb->new_chunk.
>
> This results in a too small number being stored in the in-memory
> image of the superblock which could confuse the reshape process.
>
> Signed-off-by: Andre Noll <maan@systemlinux.org>
> ---
>  drivers/md/md.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 48bdbdf..66e32e4 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -1402,7 +1402,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t
> *rdev)
>  		sb->new_layout = cpu_to_le32(mddev->new_layout);
>  		sb->delta_disks = cpu_to_le32(mddev->delta_disks);
>  		sb->new_level = cpu_to_le32(mddev->new_level);
> -		sb->new_chunk = cpu_to_le32(mddev->new_chunk>>9);
> +		sb->new_chunk = cpu_to_le32(mddev->new_chunk);

I think the current code is correct.
For v1.x metadata, the chunk size (both chunksize and new_chunk) is
stored in sectors.  in 0.90 it is stored in bytes. (in DDF, it is stored
as the base-2 log of sectors, but that is not relevant for the kernel).

So as mddev->new_chunk is (still) in bytes, we need to shift by 9.
??

I'll sort through the rest of the patches tomorrow, but that look fine.

Thanks,
NeilBrown



  reply	other threads:[~2009-05-25  9:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-25  9:27 [PATCH 0/6] md: More sector_t conversions -- intro Andre Noll
2009-05-25  9:27 ` [PATCH 1/6] md: Make mddev->chunk_size sector-based Andre Noll
2009-05-25 23:02   ` Neil Brown
2009-05-25  9:27 ` [PATCH 2/6] md: Fix a bug in super_1_sync() Andre Noll
2009-05-25  9:49   ` NeilBrown [this message]
2009-05-25 13:40     ` Andre Noll
2009-05-25  9:27 ` [PATCH 3/6] md: Convert mddev->new_chunk to sectors Andre Noll
2009-05-25  9:27 ` [PATCH 4/6] md: convert conf->chunk_size and conf->prev_chunk " Andre Noll
2009-05-25 23:14   ` Neil Brown
2009-05-25  9:27 ` [PATCH 5/6] md/raid5: Use is_power_of_2() in raid5_reconfig()/raid6_reconfig() Andre Noll
2009-05-25  9:27 ` [PATCH 6/6] md/raid5: Kill outdated comment Andre Noll
2009-05-25 23:49 ` [PATCH 0/6] md: More sector_t conversions -- intro Neil Brown
2009-05-26  2:40   ` Neil Brown
2009-05-27  8:02   ` 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=0fe21d52863495891c4d62bbbe61a36c.squirrel@neil.brown.name \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=maan@systemlinux.org \
    /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).