summaryrefslogtreecommitdiffstats
path: root/super0.c
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 /super0.c
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.
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c12
1 files changed, 6 insertions, 6 deletions
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);