linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH] Fix bitmap offset calculations
Date: Wed, 25 Mar 2015 13:15:02 +1100	[thread overview]
Message-ID: <20150325131502.1a947967@notabene.brown> (raw)
In-Reply-To: <20150324162905.GA16104@shrek.lan>

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

On Tue, 24 Mar 2015 11:29:05 -0500 Goldwyn Rodrigues <rgoldwyn@suse.de> wrote:

> The calculations of bitmap offset is incorrect with respect to bits to bytes
> conversion.
> 
> Also, remove an irrelevant duplicate message.
> 
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> ---
> diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
> index ac79fef..e98db04 100644
> --- a/drivers/md/bitmap.c
> +++ b/drivers/md/bitmap.c
> @@ -575,7 +575,9 @@ re_read:
>  
>  		sector_div(bm_blocks,
>  			   bitmap->mddev->bitmap_info.chunksize >> 9);
> -		bm_blocks = bm_blocks << 3;
> +		/* bits to bytes */
> +		bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t);
> +		/* to 4k blocks */
>  		bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096);
>  		bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3);
>  		pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__,
> @@ -672,9 +674,6 @@ out:
>  			goto out_no_sb;
>  		}
>  		bitmap->cluster_slot = md_cluster_ops->slot_number(bitmap->mddev);
> -		pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__,
> -			bitmap->cluster_slot,
> -			(unsigned long long)bitmap->mddev->bitmap_info.offset);
>  		goto re_read;
>  	}
>  

Applied, thanks.

NeilBrown

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2015-03-25  2:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 16:29 [PATCH] Fix bitmap offset calculations Goldwyn Rodrigues
2015-03-25  2:15 ` NeilBrown [this message]
2015-04-01 13:58   ` Alireza Haghdoost
2015-04-01 14:14     ` Goldwyn Rodrigues

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=20150325131502.1a947967@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=rgoldwyn@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 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).