[PATCH] md: Calculate correct array size for raid10 in new offset mode
authorNeilBrown <neilb@suse.de>
Mon, 26 Jun 2006 07:27:50 +0000 (00:27 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 26 Jun 2006 16:58:39 +0000 (09:58 -0700)
The size calculation made assumtion which the new offset mode didn't
follow.  This gets the size right in all cases.

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/raid10.c

index 4db34edfd87f833589f21c6f774f1bd8209893cf..7f636283a1ba3dfcb78aa52f925fbc65fc9525a7 100644 (file)
@@ -2060,7 +2060,13 @@ static int run(mddev_t *mddev)
        /*
         * Ok, everything is just fine now
         */
-       size = conf->stride * conf->raid_disks;
+       if (conf->far_offset) {
+               size = mddev->size >> (conf->chunk_shift-1);
+               size *= conf->raid_disks;
+               size <<= conf->chunk_shift;
+               sector_div(size, conf->far_copies);
+       } else
+               size = conf->stride * conf->raid_disks;
        sector_div(size, conf->near_copies);
        mddev->array_size = size/2;
        mddev->resync_max_sectors = size;