From: "majianpeng" <majianpeng@gmail.com>
To: NeilBrown <neilb@suse.de>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: Re: [PATCH] md/raid1:combine code in fix_read_error andfix_sync_read_error.
Date: Tue, 10 Apr 2012 09:17:41 +0800 [thread overview]
Message-ID: <201204100917374847627@gmail.com> (raw)
In-Reply-To: 20120410094706.1f45aaec@notabene.brown
Thanks,Neil.I did not notice the data buff is the same when write and read.
------------------
majianpeng
2012-04-10
-------------------------------------------------------------
发件人:NeilBrown
发送日期:2012-04-10 07:47:15
收件人:majianpeng
抄送:linux-raid
主题:Re: [PATCH] md/raid1:combine code in fix_read_error andfix_sync_read_error.
On Fri, 6 Apr 2012 15:15:38 +0800 "majianpeng" <majianpeng@gmail.com> wrote:
> >From d8d5044e65ed2bea15e135918699777c49b6f224 Mon Sep 17 00:00:00 2001
> From: majianpeng <majianpeng@gmail.com>
> Date: Fri, 6 Apr 2012 15:07:33 +0800
> Subject: [PATCH] md/raid1:combine code in fix_read_error and
> fix_sync_read_error.
>
your explanation for the patch is, again, too short.
I don't agree with this patch, I'd rather leave it as it is.
I want to perform all the writes before any reads.
If a read fails, I cannot be certain what the contents of the buffer are, so
I don't want to risk writing it anywhere.
Thanks,
NeilBrown
>
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
> drivers/md/raid1.c | 36 ++++++++----------------------------
> 1 files changed, 8 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index d35e4c9..a9a4361 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1603,7 +1603,6 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
> int d = r1_bio->read_disk;
> int success = 0;
> struct md_rdev *rdev;
> - int start;
>
> if (s > (PAGE_SIZE>>9))
> s = PAGE_SIZE >> 9;
> @@ -1661,7 +1660,6 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
> continue;
> }
>
> - start = d;
> /* write it back and re-read */
> while (d != r1_bio->read_disk) {
> if (d == 0)
> @@ -1675,21 +1673,12 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
> WRITE) == 0) {
> r1_bio->bios[d]->bi_end_io = NULL;
> rdev_dec_pending(rdev, mddev);
> - }
> - }
> - d = start;
> - while (d != r1_bio->read_disk) {
> - if (d == 0)
> - d = conf->raid_disks * 2;
> - d--;
> - if (r1_bio->bios[d]->bi_end_io != end_sync_read)
> - continue;
> - rdev = conf->mirrors[d].rdev;
> - if (r1_sync_page_io(rdev, sect, s,
> - bio->bi_io_vec[idx].bv_page,
> - READ) != 0)
> + } else if (r1_sync_page_io(rdev, sect, s,
> + bio->bi_io_vec[idx].bv_page, READ))
> atomic_add(s, &rdev->corrected_errors);
> +
> }
> +
> sectors -= s;
> sect += s;
> idx ++;
> @@ -1841,7 +1830,6 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
> int s = sectors;
> int d = read_disk;
> int success = 0;
> - int start;
> struct md_rdev *rdev;
>
> if (s > (PAGE_SIZE>>9))
> @@ -1878,19 +1866,8 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
> md_error(mddev, rdev);
> break;
> }
> +
> /* write it back and re-read */
> - start = d;
> - while (d != read_disk) {
> - if (d==0)
> - d = conf->raid_disks * 2;
> - d--;
> - rdev = conf->mirrors[d].rdev;
> - if (rdev &&
> - test_bit(In_sync, &rdev->flags))
> - r1_sync_page_io(rdev, sect, s,
> - conf->tmppage, WRITE);
> - }
> - d = start;
> while (d != read_disk) {
> char b[BDEVNAME_SIZE];
> if (d==0)
> @@ -1900,6 +1877,9 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
> if (rdev &&
> test_bit(In_sync, &rdev->flags)) {
> if (r1_sync_page_io(rdev, sect, s,
> + conf->tmppage, WRITE) == 0)
> + continue;
> + else if (r1_sync_page_io(rdev, sect, s,
> conf->tmppage, READ)) {
> atomic_add(s, &rdev->corrected_errors);
> printk(KERN_INFO
prev parent reply other threads:[~2012-04-10 1:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-06 7:15 [PATCH] md/raid1:combine code in fix_read_error and fix_sync_read_error majianpeng
2012-04-09 23:47 ` NeilBrown
2012-04-10 1:17 ` majianpeng [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=201204100917374847627@gmail.com \
--to=majianpeng@gmail.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.