linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: majianpeng <majianpeng@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [RFC PATCH V1] raid5: Add R5_ReadNoMerge flag which prevent bio from merging at block layer
Date: Mon, 16 Jul 2012 15:48:22 +1000	[thread overview]
Message-ID: <20120716154822.2774ff5e@notabene.brown> (raw)
In-Reply-To: <201207131913329371733@gmail.com>

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

On Fri, 13 Jul 2012 19:13:35 +0800 majianpeng <majianpeng@gmail.com> wrote:

> Because bios will merge at block-layer,so bios-error may caused by other
> bio which be merged into to the same request.
> Using this flag,it will find exactly error-sector and not do redundant
> operation like re-write and re-read.
> 
> V0->V1:Using REQ_FLUSH instead REQ_NOMERGE avoid bio merging at block
> layer.
> 
> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
> ---
>  drivers/md/raid5.c |   14 ++++++++++++--
>  drivers/md/raid5.h |    1 +
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 04348d7..059989f6 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -640,6 +640,9 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
>  			else
>  				bi->bi_sector = (sh->sector
>  						 + rdev->data_offset);
> +			if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags))
> +				bi->bi_rw |= REQ_FLUSH;
> +
>  			bi->bi_flags = 1 << BIO_UPTODATE;
>  			bi->bi_idx = 0;
>  			bi->bi_io_vec[0].bv_len = STRIPE_SIZE;
> @@ -1739,7 +1742,9 @@ static void raid5_end_read_request(struct bio * bi, int error)
>  			atomic_add(STRIPE_SECTORS, &rdev->corrected_errors);
>  			clear_bit(R5_ReadError, &sh->dev[i].flags);
>  			clear_bit(R5_ReWrite, &sh->dev[i].flags);
> -		}
> +		} else if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags))
> +			clear_bit(R5_ReadNoMerge, &sh->dev[i].flags);
> +
>  		if (atomic_read(&rdev->read_errors))
>  			atomic_set(&rdev->read_errors, 0);
>  	} else {
> @@ -1784,7 +1789,11 @@ static void raid5_end_read_request(struct bio * bi, int error)
>  		else
>  			retry = 1;
>  		if (retry)
> -			set_bit(R5_ReadError, &sh->dev[i].flags);
> +			if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) {
> +				set_bit(R5_ReadError, &sh->dev[i].flags);
> +				clear_bit(R5_ReadNoMerge, &sh->dev[i].flags);
> +			} else
> +				set_bit(R5_ReadNoMerge, &sh->dev[i].flags);
>  		else {
>  			clear_bit(R5_ReadError, &sh->dev[i].flags);
>  			clear_bit(R5_ReWrite, &sh->dev[i].flags);
> @@ -4504,6 +4513,7 @@ static int  retry_aligned_read(struct r5conf *conf, struct bio *raid_bio)
>  			return handled;
>  		}
>  
> +		set_bit(R5_ReadNoMerge, &sh->dev[dd_idx].flags);
>  		handle_stripe(sh);
>  		release_stripe(sh);
>  		handled++;
> diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
> index 2164021..6767d07 100644
> --- a/drivers/md/raid5.h
> +++ b/drivers/md/raid5.h
> @@ -273,6 +273,7 @@ enum r5dev_flags {
>  	R5_Wantwrite,
>  	R5_Overlap,	/* There is a pending overlapping request
>  			 * on this block */
> +	R5_ReadNoMerge, /* prevent bio from merging in block-layer */
>  	R5_ReadError,	/* seen a read error here recently */
>  	R5_ReWrite,	/* have tried to over-write the readerror */
>  


Thanks, I've applied this.

We should probably do a similar thing in fix_read_error and
fix_sync_read_error in RAID1 and RAID10...

Thanks,
NeilBrown


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

  reply	other threads:[~2012-07-16  5:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-13 11:13 [RFC PATCH V1] raid5: Add R5_ReadNoMerge flag which prevent bio from merging at block layer majianpeng
2012-07-16  5:48 ` NeilBrown [this message]
2012-07-16  6:57   ` majianpeng
2012-07-21  4:35   ` majianpeng

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=20120716154822.2774ff5e@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=majianpeng@gmail.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).