All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shli@kernel.org>
To: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Cc: linux-raid@vger.kernel.org, aleksey.obitotskiy@intel.com,
	pawel.baldysiak@intel.com, artur.paszkiewicz@intel.com
Subject: Re: [PATCH] raid10: record correct address of bad block
Date: Wed, 17 Aug 2016 09:52:54 -0700	[thread overview]
Message-ID: <20160817165254.GA35041@kernel.org> (raw)
In-Reply-To: <1470992633-8903-1-git-send-email-tomasz.majchrzak@intel.com>

On Fri, Aug 12, 2016 at 11:03:53AM +0200, Tomasz Majchrzak wrote:
> For failed write request record block address on a device, not block
> address in an array.
> 
> Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
> ---
>  drivers/md/raid10.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index cfa96b5..d18b26d 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2449,6 +2449,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
>  
>  	int block_sectors;
>  	sector_t sector;
> +	sector_t data_offset;
>  	int sectors;
>  	int sect_to_write = r10_bio->sectors;
>  	int ok = 1;
> @@ -2462,6 +2463,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
>  	sectors = ((r10_bio->sector + block_sectors)
>  		   & ~(sector_t)(block_sectors - 1))
>  		- sector;
> +	data_offset = choose_data_offset(r10_bio, rdev);
>  
>  	while (sect_to_write) {
>  		struct bio *wbio;
> @@ -2471,13 +2473,12 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
>  		wbio = bio_clone_mddev(bio, GFP_NOIO, mddev);
>  		bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors);
>  		wbio->bi_iter.bi_sector = (r10_bio->devs[i].addr+
> -				   choose_data_offset(r10_bio, rdev) +
> -				   (sector - r10_bio->sector));
> +				   data_offset + (sector - r10_bio->sector));
>  		wbio->bi_bdev = rdev->bdev;
>  		if (submit_bio_wait(WRITE, wbio) < 0)
>  			/* Failure! */
> -			ok = rdev_set_badblocks(rdev, sector,
> -						sectors, 0)
> +			ok = rdev_set_badblocks(rdev, wbio->bi_iter.bi_sector -
> +						data_offset, sectors, 0)

bi_iter is immutable after submit_bio, so please not use it

Thanks,
Shaohua

      reply	other threads:[~2016-08-17 16:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12  9:03 [PATCH] raid10: record correct address of bad block Tomasz Majchrzak
2016-08-17 16:52 ` Shaohua Li [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=20160817165254.GA35041@kernel.org \
    --to=shli@kernel.org \
    --cc=aleksey.obitotskiy@intel.com \
    --cc=artur.paszkiewicz@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=pawel.baldysiak@intel.com \
    --cc=tomasz.majchrzak@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 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.