aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ae16794bef20..a36a7435edf5 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -43,12 +43,7 @@
43 * miss any bits. 43 * miss any bits.
44 */ 44 */
45 45
46#include <linux/module.h>
47#include <linux/slab.h>
48#include <linux/highmem.h>
49#include <linux/bitops.h>
50#include <linux/kthread.h> 46#include <linux/kthread.h>
51#include <asm/atomic.h>
52#include "raid6.h" 47#include "raid6.h"
53 48
54#include <linux/raid/bitmap.h> 49#include <linux/raid/bitmap.h>
@@ -275,7 +270,7 @@ static int grow_buffers(struct stripe_head *sh, int num)
275 return 0; 270 return 0;
276} 271}
277 272
278static void raid5_build_block (struct stripe_head *sh, int i); 273static void raid5_build_block(struct stripe_head *sh, int i);
279 274
280static void init_stripe(struct stripe_head *sh, sector_t sector, int pd_idx, int disks) 275static void init_stripe(struct stripe_head *sh, sector_t sector, int pd_idx, int disks)
281{ 276{
@@ -1151,7 +1146,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
1151 release_stripe(sh); 1146 release_stripe(sh);
1152} 1147}
1153 1148
1154static void raid5_end_write_request (struct bio *bi, int error) 1149static void raid5_end_write_request(struct bio *bi, int error)
1155{ 1150{
1156 struct stripe_head *sh = bi->bi_private; 1151 struct stripe_head *sh = bi->bi_private;
1157 raid5_conf_t *conf = sh->raid_conf; 1152 raid5_conf_t *conf = sh->raid_conf;
@@ -1183,7 +1178,7 @@ static void raid5_end_write_request (struct bio *bi, int error)
1183 1178
1184static sector_t compute_blocknr(struct stripe_head *sh, int i); 1179static sector_t compute_blocknr(struct stripe_head *sh, int i);
1185 1180
1186static void raid5_build_block (struct stripe_head *sh, int i) 1181static void raid5_build_block(struct stripe_head *sh, int i)
1187{ 1182{
1188 struct r5dev *dev = &sh->dev[i]; 1183 struct r5dev *dev = &sh->dev[i];
1189 1184
@@ -1221,10 +1216,10 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
1221 set_bit(MD_RECOVERY_INTR, &mddev->recovery); 1216 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
1222 } 1217 }
1223 set_bit(Faulty, &rdev->flags); 1218 set_bit(Faulty, &rdev->flags);
1224 printk (KERN_ALERT 1219 printk(KERN_ALERT
1225 "raid5: Disk failure on %s, disabling device.\n" 1220 "raid5: Disk failure on %s, disabling device.\n"
1226 "raid5: Operation continuing on %d devices.\n", 1221 "raid5: Operation continuing on %d devices.\n",
1227 bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded); 1222 bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded);
1228 } 1223 }
1229} 1224}
1230 1225
@@ -1320,8 +1315,8 @@ static sector_t raid5_compute_sector(sector_t r_sector, unsigned int raid_disks,
1320 *dd_idx = (*pd_idx + 2 + *dd_idx) % raid_disks; 1315 *dd_idx = (*pd_idx + 2 + *dd_idx) % raid_disks;
1321 break; 1316 break;
1322 default: 1317 default:
1323 printk (KERN_CRIT "raid6: unsupported algorithm %d\n", 1318 printk(KERN_CRIT "raid6: unsupported algorithm %d\n",
1324 conf->algorithm); 1319 conf->algorithm);
1325 } 1320 }
1326 break; 1321 break;
1327 } 1322 }
@@ -1396,8 +1391,8 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i)
1396 } 1391 }
1397 break; 1392 break;
1398 default: 1393 default:
1399 printk (KERN_CRIT "raid6: unsupported algorithm %d\n", 1394 printk(KERN_CRIT "raid6: unsupported algorithm %d\n",
1400 conf->algorithm); 1395 conf->algorithm);
1401 } 1396 }
1402 break; 1397 break;
1403 } 1398 }
@@ -1405,7 +1400,7 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i)
1405 chunk_number = stripe * data_disks + i; 1400 chunk_number = stripe * data_disks + i;
1406 r_sector = (sector_t)chunk_number * sectors_per_chunk + chunk_offset; 1401 r_sector = (sector_t)chunk_number * sectors_per_chunk + chunk_offset;
1407 1402
1408 check = raid5_compute_sector (r_sector, raid_disks, data_disks, &dummy1, &dummy2, conf); 1403 check = raid5_compute_sector(r_sector, raid_disks, data_disks, &dummy1, &dummy2, conf);
1409 if (check != sh->sector || dummy1 != dd_idx || dummy2 != sh->pd_idx) { 1404 if (check != sh->sector || dummy1 != dd_idx || dummy2 != sh->pd_idx) {
1410 printk(KERN_ERR "compute_blocknr: map not correct\n"); 1405 printk(KERN_ERR "compute_blocknr: map not correct\n");
1411 return 0; 1406 return 0;
@@ -4012,6 +4007,13 @@ static int run(mddev_t *mddev)
4012 return -EIO; 4007 return -EIO;
4013 } 4008 }
4014 4009
4010 if (mddev->chunk_size < PAGE_SIZE) {
4011 printk(KERN_ERR "md/raid5: chunk_size must be at least "
4012 "PAGE_SIZE but %d < %ld\n",
4013 mddev->chunk_size, PAGE_SIZE);
4014 return -EINVAL;
4015 }
4016
4015 if (mddev->reshape_position != MaxSector) { 4017 if (mddev->reshape_position != MaxSector) {
4016 /* Check that we can continue the reshape. 4018 /* Check that we can continue the reshape.
4017 * Currently only disks can change, it must 4019 * Currently only disks can change, it must
@@ -4289,7 +4291,7 @@ static int stop(mddev_t *mddev)
4289} 4291}
4290 4292
4291#ifdef DEBUG 4293#ifdef DEBUG
4292static void print_sh (struct seq_file *seq, struct stripe_head *sh) 4294static void print_sh(struct seq_file *seq, struct stripe_head *sh)
4293{ 4295{
4294 int i; 4296 int i;
4295 4297
@@ -4305,7 +4307,7 @@ static void print_sh (struct seq_file *seq, struct stripe_head *sh)
4305 seq_printf(seq, "\n"); 4307 seq_printf(seq, "\n");
4306} 4308}
4307 4309
4308static void printall (struct seq_file *seq, raid5_conf_t *conf) 4310static void printall(struct seq_file *seq, raid5_conf_t *conf)
4309{ 4311{
4310 struct stripe_head *sh; 4312 struct stripe_head *sh;
4311 struct hlist_node *hn; 4313 struct hlist_node *hn;
@@ -4323,7 +4325,7 @@ static void printall (struct seq_file *seq, raid5_conf_t *conf)
4323} 4325}
4324#endif 4326#endif
4325 4327
4326static void status (struct seq_file *seq, mddev_t *mddev) 4328static void status(struct seq_file *seq, mddev_t *mddev)
4327{ 4329{
4328 raid5_conf_t *conf = (raid5_conf_t *) mddev->private; 4330 raid5_conf_t *conf = (raid5_conf_t *) mddev->private;
4329 int i; 4331 int i;