]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix bugs related to raid10 and the new offset layout.
authorNeil Brown <neilb@suse.de>
Thu, 19 Oct 2006 06:38:29 +0000 (16:38 +1000)
committerNeil Brown <neilb@suse.de>
Thu, 19 Oct 2006 06:38:29 +0000 (16:38 +1000)
Need to mask of bits above the bottom 16 when calculating number of
copies.

ChangeLog
Create.c
util.c

index 9fd831faaccf829633cca6c5613e2519786ec465..1aaa1ee6d8ff9d8567c1b185b75309da666d430c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@ Changes Prior to this release
        initramfs, but device doesn't yet exist in /dev.
     -   When --assemble --scan is run, if all arrays that could be found
        have already been started, don't report an error.
+    -   Fix a couple of bugs related to raid10 and the new 'offset' layout.
 
 Changes Prior to 2.5.4 release
     -   When creating devices in /dev/md/ create matching symlinks
index ff87df09e65586c061b8a1e6eadf37bc3f2f2078..e0cc7972b791a98331675b25da3f00ab59f53509 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -363,7 +363,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
                 * which is array.size * raid_disks / ncopies;
                 * .. but convert to sectors.
                 */
-               int ncopies = (layout>>8) * (layout & 255);
+               int ncopies = ((layout>>8) & 255) * (layout & 255);
                bitmapsize = (unsigned long long)size * raiddisks / ncopies * 2;
 /*             printf("bms=%llu as=%d rd=%d nc=%d\n", bitmapsize, size, raiddisks, ncopies);*/
        } else
diff --git a/util.c b/util.c
index 97707d0df2f7584ffdfe23c18bd4a3ab2a7f93ef..8d06848e60866df42e7ff28d9e0d9858c36c5daf 100644 (file)
--- a/util.c
+++ b/util.c
@@ -179,7 +179,7 @@ int enough(int level, int raid_disks, int layout,
                /* This is the tricky one - we need to check
                 * which actual disks are present.
                 */
-               copies = (layout&255)* (layout>>8);
+               copies = (layout&255)* ((layout>>8) & 255);
                first=0;
                do {
                        /* there must be one of the 'copies' form 'first' */