]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix error message when adding a device that is too small.
authorNeil Brown <neilb@suse.de>
Mon, 20 Aug 2007 04:14:28 +0000 (14:14 +1000)
committerNeil Brown <neilb@suse.de>
Mon, 20 Aug 2007 04:14:28 +0000 (14:14 +1000)
We were multiplying MD_RESERVED_SECTORS by 1024 instead of 512,
so lots of 'is it too small' checks were wrong.

ChangeLog
super0.c

index 71d19f42673bf20ac811ea3e32db6539aaebf777..6a525f0dcd8314a761e274feaa88261c08b6fd28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@ Changes Prior to this release
     -   When adding new disk to an array, don't reserve so much bitmap
         space that the disk cannot store the required data. (Needed when
        1.x array was created with older mdadm).
+    -   When adding a drive that was a little too small, we did not get
+       the correct error message.
 
 Changes Prior to 2.6.2 release
     -   --fail detached and --remove faulty can be used to fail and
index 30da8aa22c95dc28d5caf844ef972cff3019fb4d..0396c2cd81b4e26074de176c00444d1f818e45c9 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -624,7 +624,7 @@ static int store_super0(struct supertype *st, int fd, void *sbv)
        if (!get_dev_size(fd, NULL, &dsize))
                return 1;
 
-       if (dsize < MD_RESERVED_SECTORS*2*512)
+       if (dsize < MD_RESERVED_SECTORS*512)
                return 2;
 
        offset = MD_NEW_SIZE_SECTORS(dsize>>9);
@@ -731,7 +731,7 @@ static int load_super0(struct supertype *st, int fd, void **sbp, char *devname)
        if (!get_dev_size(fd, devname, &dsize))
                return 1;
 
-       if (dsize < MD_RESERVED_SECTORS*512 * 2) {
+       if (dsize < MD_RESERVED_SECTORS*512) {
                if (devname)
                        fprintf(stderr, Name
                            ": %s is too small for md: size is %llu sectors.\n",
@@ -835,7 +835,7 @@ static struct supertype *match_metadata_desc0(char *arg)
 
 static __u64 avail_size0(struct supertype *st, __u64 devsize)
 {
-       if (devsize < MD_RESERVED_SECTORS*2)
+       if (devsize < MD_RESERVED_SECTORS)
                return 0ULL;
        return MD_NEW_SIZE_SECTORS(devsize);
 }
@@ -893,7 +893,7 @@ void locate_bitmap0(struct supertype *st, int fd, void *sbv)
        if (!get_dev_size(fd, NULL, &dsize))
                return;
 
-       if (dsize < MD_RESERVED_SECTORS*512 * 2)
+       if (dsize < MD_RESERVED_SECTORS*512)
                return;
 
        offset = MD_NEW_SIZE_SECTORS(dsize>>9);
@@ -920,8 +920,8 @@ int write_bitmap0(struct supertype *st, int fd, void *sbv)
                return 1;
 
 
-       if (dsize < MD_RESERVED_SECTORS*512 * 2)
-       return -1;
+       if (dsize < MD_RESERVED_SECTORS*512)
+               return -1;
 
        offset = MD_NEW_SIZE_SECTORS(dsize>>9);