From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 001 of 4] md: Fix innocuous bug in raid6 stripe_to_pdidx
Date: Tue, 14 Nov 2006 11:22:28 +1100 [thread overview]
Message-ID: <1061114002228.31156@suse.de> (raw)
In-Reply-To: 20061114111600.31061.patches@notabene
stripe_to_pdidx finds the index of the parity disk for a given
stripe.
It assumes raid5 in that it uses "disks-1" to determine the number
of data disks.
This is incorrect for raid6 but fortunately the two usages cancel each
other out. The only way that 'data_disks' affects the calculation of
pd_idx in raid5_compute_sector is when it is divided into the
sector number. But as that sector number is calculated by multiplying
in the wrong value of 'data_disks' the division produces the right
value.
So it is innocuous but needs to be fixed.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/raid5.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
--- .prev/drivers/md/raid5.c 2006-11-14 10:05:00.000000000 +1100
+++ ./drivers/md/raid5.c 2006-11-14 10:33:41.000000000 +1100
@@ -1355,8 +1355,10 @@ static int stripe_to_pdidx(sector_t stri
int pd_idx, dd_idx;
int chunk_offset = sector_div(stripe, sectors_per_chunk);
- raid5_compute_sector(stripe*(disks-1)*sectors_per_chunk
- + chunk_offset, disks, disks-1, &dd_idx, &pd_idx, conf);
+ raid5_compute_sector(stripe * (disks - conf->max_degraded)
+ *sectors_per_chunk + chunk_offset,
+ disks, disks - conf->max_degraded,
+ &dd_idx, &pd_idx, conf);
return pd_idx;
}
next prev parent reply other threads:[~2006-11-14 0:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-14 0:22 [PATCH 000 of 4] md: Various fixes for new cache-bypassing-reads in raid5/6 NeilBrown
2006-11-14 0:22 ` NeilBrown [this message]
2006-11-14 0:22 ` [PATCH 002 of 4] md: Fix newly introduced read-corruption with raid6 NeilBrown
2006-11-14 0:22 ` [PATCH 003 of 4] md: Misc fixes for aligned-read handling NeilBrown
2006-11-14 0:22 ` [PATCH 004 of 4] md: Fix a couple more bugs in raid5/6 aligned reads NeilBrown
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=1061114002228.31156@suse.de \
--to=neilb@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.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).