2000-11-27 04:12:29

by NeilBrown

[permalink] [raw]
Subject: [PATCH] (test11-ac4) unbelievably silly (fatal) typo in raid5.c


Alan,
raid5 rebuild has been fatally flawed ever since it got into 2.4, and
my recent testing has been looking at speed more than correctness, so
I didn't notice until now.

raid5_sync_request is handed a block number in 1K units and needs to
convert to 512byte sector units.
I could have used (block_nr*2)
I could have used (block_nr<<1)
but instead I used (block_nr<<2) !!!! :-(

Please apply the following patch.

Thanks,
NeilBrown

--- ./drivers/md/raid5.c 2000/11/27 02:46:45 1.1
+++ ./drivers/md/raid5.c 2000/11/27 02:47:37 1.2
@@ -1516,8 +1516,8 @@
raid5_conf_t *conf = (raid5_conf_t *) mddev->private;
struct stripe_head *sh;
int sectors_per_chunk = conf->chunk_size >> 9;
- unsigned long stripe = (block_nr<<2)/sectors_per_chunk;
- int chunk_offset = (block_nr<<2) % sectors_per_chunk;
+ unsigned long stripe = (block_nr<<1)/sectors_per_chunk;
+ int chunk_offset = (block_nr<<1) % sectors_per_chunk;
int dd_idx, pd_idx;
unsigned long first_sector;
int raid_disks = conf->raid_disks;