From: NeilBrown Date: Thu, 4 Dec 2008 04:47:57 +0000 (+1100) Subject: Change 'size' argument to validate_geometry to be sectors, not K X-Git-Tag: mdadm-3.0-devel3~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e46273ebe4ce6dee3ecbb640027cd3c3eca9a921;p=thirdparty%2Fmdadm.git Change 'size' argument to validate_geometry to be sectors, not K That way it is the same a *freesize, and generally less confusing. Signed-off-by: NeilBrown --- diff --git a/Create.c b/Create.c index f69cfd9a..7ea39c4f 100644 --- a/Create.c +++ b/Create.c @@ -240,7 +240,7 @@ int Create(struct supertype *st, char *mddev, } if (st && ! st->ss->validate_geometry(st, level, layout, raiddisks, - chunk, size, NULL, NULL, verbose>=0)) + chunk, size*2, NULL, NULL, verbose>=0)) return 1; /* now look at the subdevs */ @@ -276,7 +276,7 @@ int Create(struct supertype *st, char *mddev, st = superlist[i]->match_metadata_desc(name); if (st && !st->ss->validate_geometry (st, level, layout, raiddisks, - chunk, size, dname, &freesize, + chunk, size*2, dname, &freesize, verbose > 0)) st = NULL; } @@ -293,7 +293,7 @@ int Create(struct supertype *st, char *mddev, } else { if (!st->ss->validate_geometry(st, level, layout, raiddisks, - chunk, size, dname, + chunk, size*2, dname, &freesize, verbose > 0)) { @@ -356,7 +356,7 @@ int Create(struct supertype *st, char *mddev, /* size is meaningful */ if (!st->ss->validate_geometry(st, level, layout, raiddisks, - chunk, minsize, + chunk, minsize*2, NULL, NULL, 0)) { fprintf(stderr, Name ": devices too large for RAID level %d\n", level); return 1; diff --git a/mdadm.h b/mdadm.h index 05b79baf..b0966e6f 100644 --- a/mdadm.h +++ b/mdadm.h @@ -532,6 +532,7 @@ extern struct superswitch { * added to validate changing size and new devices. If there are * inter-device dependencies, it should record sufficient details * so these can be validated. + * Both 'size' and '*freesize' are in sectors. chunk is bytes. */ int (*validate_geometry)(struct supertype *st, int level, int layout, int raiddisks, diff --git a/super-intel.c b/super-intel.c index 99419ffd..f78957f1 100644 --- a/super-intel.c +++ b/super-intel.c @@ -2295,7 +2295,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level, * 'raiddisks' device extents of size 'size' at a given * offset */ - unsigned long long minsize = size*2 /* convert to blocks */; + unsigned long long minsize = size; unsigned long long start_offset = ~0ULL; int dcnt = 0; if (minsize == 0) diff --git a/super0.c b/super0.c index ab4232b0..5d17073b 100644 --- a/super0.c +++ b/super0.c @@ -1057,7 +1057,7 @@ static int validate_geometry0(struct supertype *st, int level, return 0; if (raiddisks > MD_SB_DISKS) return 0; - if (size > (0x7fffffffULL<<10)) + if (size > (0x7fffffffULL<<9)) return 0; if (!subdev) return 1; @@ -1078,7 +1078,7 @@ static int validate_geometry0(struct supertype *st, int level, if (ldsize < MD_RESERVED_SECTORS * 512) return 0; - if (size > (0x7fffffffULL<<10)) + if (size > (0x7fffffffULL<<9)) return 0; *freesize = MD_NEW_SIZE_SECTORS(ldsize >> 9); return 1;