]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
[PATCH] md: Assorted little md fixes
authorNeilBrown <neilb@suse.de>
Fri, 3 Feb 2006 11:03:41 +0000 (03:03 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 3 Feb 2006 16:32:00 +0000 (08:32 -0800)
- 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>
drivers/md/md.c
drivers/md/raid0.c
drivers/md/raid10.c
drivers/md/raid5.c
drivers/md/raid6main.c

index 8f161743e18f2d6e1dab930e567de975879a6798..67bb0d0467671dabe3bbd692c8518b3c81e151de 100644 (file)
@@ -1081,7 +1081,7 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
                mddev->size = le64_to_cpu(sb->size)/2;
                mddev->events = le64_to_cpu(sb->events);
                mddev->bitmap_offset = 0;
-               mddev->default_bitmap_offset = 1024;
+               mddev->default_bitmap_offset = 1024 >> 9;
                
                mddev->recovery_cp = le64_to_cpu(sb->resync_offset);
                memcpy(mddev->uuid, sb->set_uuid, 16);
@@ -1162,7 +1162,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
        sb->cnt_corrected_read = atomic_read(&rdev->corrected_errors);
 
        sb->raid_disks = cpu_to_le32(mddev->raid_disks);
-       sb->size = cpu_to_le64(mddev->size);
+       sb->size = cpu_to_le64(mddev->size<<1);
 
        if (mddev->bitmap && mddev->bitmap_file == NULL) {
                sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset);
index d03f99cf4b7dfa936af326eef8ceb0586709fd5a..678f4dbbea1d5c22082d13fb1afd321465b61f28 100644 (file)
@@ -372,7 +372,7 @@ out_free_conf:
        kfree(conf);
        mddev->private = NULL;
 out:
-       return 1;
+       return -ENOMEM;
 }
 
 static int raid0_stop (mddev_t *mddev)
index 9130d051b474d64c4816644be4bc89d3b397f37a..ab90a6d1202043f7d332fe5f613be414845f1107 100644 (file)
@@ -565,6 +565,8 @@ rb_out:
 
        if (disk >= 0 && (rdev=rcu_dereference(conf->mirrors[disk].rdev))!= NULL)
                atomic_inc(&conf->mirrors[disk].rdev->nr_pending);
+       else
+               disk = -1;
        rcu_read_unlock();
 
        return disk;
index 25976bfb6f9c19b841aa432dff67c0c24a425435..2dba305daf3c887799453caefae8d5a36535de4b 100644 (file)
@@ -350,7 +350,8 @@ static void shrink_stripes(raid5_conf_t *conf)
        while (drop_one_stripe(conf))
                ;
 
-       kmem_cache_destroy(conf->slab_cache);
+       if (conf->slab_cache)
+               kmem_cache_destroy(conf->slab_cache);
        conf->slab_cache = NULL;
 }
 
index ed2abb2e2e2d43a5f22b2a5b51c3ebdd093cbf69..cd477ebf2ee44d8b963ec3157a5674300e1e85f5 100644 (file)
@@ -366,7 +366,8 @@ static void shrink_stripes(raid6_conf_t *conf)
        while (drop_one_stripe(conf))
                ;
 
-       kmem_cache_destroy(conf->slab_cache);
+       if (conf->slab_cache)
+               kmem_cache_destroy(conf->slab_cache);
        conf->slab_cache = NULL;
 }