aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-02-03 06:03:41 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-03 11:32:00 -0500
commit29fc7e3e70a05e9eea28afb6707a39c1a53e2f66 (patch)
tree4e8bc28c717116ade3cd723a921f3260656327aa /drivers
parent284ae7cab0f7335c9e0aa8992b28415ef1a54c7c (diff)
[PATCH] md: Assorted little md fixes
- version-1 superblock + The default_bitmap_offset is in sectors, not bytes. + the 'size' field in the superblock is in sectors, not KB - raid0_run should return a negative number on error, not '1' - raid10_read_balance should not return a valid 'disk' number if ->rdev turned out to be NULL - kmem_cache_destroy doesn't like being passed a NULL. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/md/raid0.c2
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/md/raid5.c3
-rw-r--r--drivers/md/raid6main.c3
5 files changed, 9 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8f161743e18f..67bb0d046767 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1081,7 +1081,7 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
1081 mddev->size = le64_to_cpu(sb->size)/2; 1081 mddev->size = le64_to_cpu(sb->size)/2;
1082 mddev->events = le64_to_cpu(sb->events); 1082 mddev->events = le64_to_cpu(sb->events);
1083 mddev->bitmap_offset = 0; 1083 mddev->bitmap_offset = 0;
1084 mddev->default_bitmap_offset = 1024; 1084 mddev->default_bitmap_offset = 1024 >> 9;
1085 1085
1086 mddev->recovery_cp = le64_to_cpu(sb->resync_offset); 1086 mddev->recovery_cp = le64_to_cpu(sb->resync_offset);
1087 memcpy(mddev->uuid, sb->set_uuid, 16); 1087 memcpy(mddev->uuid, sb->set_uuid, 16);
@@ -1162,7 +1162,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1162 sb->cnt_corrected_read = atomic_read(&rdev->corrected_errors); 1162 sb->cnt_corrected_read = atomic_read(&rdev->corrected_errors);
1163 1163
1164 sb->raid_disks = cpu_to_le32(mddev->raid_disks); 1164 sb->raid_disks = cpu_to_le32(mddev->raid_disks);
1165 sb->size = cpu_to_le64(mddev->size); 1165 sb->size = cpu_to_le64(mddev->size<<1);
1166 1166
1167 if (mddev->bitmap && mddev->bitmap_file == NULL) { 1167 if (mddev->bitmap && mddev->bitmap_file == NULL) {
1168 sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset); 1168 sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset);
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index d03f99cf4b7d..678f4dbbea1d 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -372,7 +372,7 @@ out_free_conf:
372 kfree(conf); 372 kfree(conf);
373 mddev->private = NULL; 373 mddev->private = NULL;
374out: 374out:
375 return 1; 375 return -ENOMEM;
376} 376}
377 377
378static int raid0_stop (mddev_t *mddev) 378static int raid0_stop (mddev_t *mddev)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 9130d051b474..ab90a6d12020 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -565,6 +565,8 @@ rb_out:
565 565
566 if (disk >= 0 && (rdev=rcu_dereference(conf->mirrors[disk].rdev))!= NULL) 566 if (disk >= 0 && (rdev=rcu_dereference(conf->mirrors[disk].rdev))!= NULL)
567 atomic_inc(&conf->mirrors[disk].rdev->nr_pending); 567 atomic_inc(&conf->mirrors[disk].rdev->nr_pending);
568 else
569 disk = -1;
568 rcu_read_unlock(); 570 rcu_read_unlock();
569 571
570 return disk; 572 return disk;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 25976bfb6f9c..2dba305daf3c 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -350,7 +350,8 @@ static void shrink_stripes(raid5_conf_t *conf)
350 while (drop_one_stripe(conf)) 350 while (drop_one_stripe(conf))
351 ; 351 ;
352 352
353 kmem_cache_destroy(conf->slab_cache); 353 if (conf->slab_cache)
354 kmem_cache_destroy(conf->slab_cache);
354 conf->slab_cache = NULL; 355 conf->slab_cache = NULL;
355} 356}
356 357
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c
index ed2abb2e2e2d..cd477ebf2ee4 100644
--- a/drivers/md/raid6main.c
+++ b/drivers/md/raid6main.c
@@ -366,7 +366,8 @@ static void shrink_stripes(raid6_conf_t *conf)
366 while (drop_one_stripe(conf)) 366 while (drop_one_stripe(conf))
367 ; 367 ;
368 368
369 kmem_cache_destroy(conf->slab_cache); 369 if (conf->slab_cache)
370 kmem_cache_destroy(conf->slab_cache);
370 conf->slab_cache = NULL; 371 conf->slab_cache = NULL;
371} 372}
372 373