summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-08-20 14:14:28 +1000
committerNeil Brown <neilb@suse.de>2007-08-20 14:14:28 +1000
commiteb6dae98500dd087548b593c9b7e3db7b3cff9b2 (patch)
tree486d41d10a25a1272a8d93b009a46a0e703bf774
parent005debfc11b4cbe653503667423df98b64e5be0e (diff)
downloadmdadm-eb6dae98500dd087548b593c9b7e3db7b3cff9b2.tar.gz
mdadm-eb6dae98500dd087548b593c9b7e3db7b3cff9b2.tar.xz
mdadm-eb6dae98500dd087548b593c9b7e3db7b3cff9b2.zip
Fix error message when adding a device that is too small.
We were multiplying MD_RESERVED_SECTORS by 1024 instead of 512, so lots of 'is it too small' checks were wrong.
-rw-r--r--ChangeLog2
-rw-r--r--super0.c12
2 files changed, 8 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 71d19f4..6a525f0 100644
--- 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
diff --git a/super0.c b/super0.c
index 30da8aa..0396c2c 100644
--- 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);