diff options
author | NeilBrown <neilb@suse.de> | 2009-05-12 15:25:55 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-05-12 15:25:55 +1000 |
commit | c8b4de0cccfba18818416f62687e4094a5b83922 (patch) | |
tree | c433c9be537b65ddbdff135cd25824a7cc09cdc8 /Create.c | |
parent | c7b474474c793e9a82bd0d84868fdf7367c89696 (diff) | |
download | mdadm-2.tar.gz |
Create: add --reserve-space support to reserve space at the start of each devicemdadm-2
This only works for 1.x metadata.
The idea is to reserve some space at the start of each device for
storing a boot loader.
As a boot loader will need sector 0, metadata 1.1 doesn't make sense.
The number given to reserve-space will be in kilobytes, though a
suffix of M can give Megabytes (or G gigabytes, but 2 is the limit).
When a spare is added to an array, we preserve the amount of reserved
space.
It is not yet possible to hot-add an internal bitmap to a 1.1 or 1.2
array with reserved space.
This option is not yet documented.
In future, we might copy the content of the reserved space from one
drive to any new spare that is added.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Create.c')
-rw-r--r-- | Create.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -37,7 +37,8 @@ int Create(struct supertype *st, char *mddev, int mdfd, char *name, char *homehost, int *uuid, int subdevs, mddev_dev_t devlist, int runstop, int verbose, int force, int assume_clean, - char *bitmap_file, int bitmap_chunk, int write_behind, int delay) + char *bitmap_file, int bitmap_chunk, int write_behind, int delay, + unsigned long reserve_space) { /* * Create a new raid array. @@ -235,7 +236,8 @@ int Create(struct supertype *st, char *mddev, int mdfd, */ int i; char *name = "default"; - if (level >= 1 && ldsize > (0x7fffffffULL<<10)) + if (reserve_space || + (level >= 1 && ldsize > (0x7fffffffULL<<10))) name = "default/large"; for(i=0; !st && superlist[i]; i++) st = superlist[i]->match_metadata_desc(name); @@ -251,7 +253,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, st->ss->major, st->minor_version); } - freesize = st->ss->avail_size(st, ldsize >> 9); + freesize = st->ss->avail_size(st, ldsize >> 9, reserve_space); if (freesize == 0) { fprintf(stderr, Name ": %s is too small: %luK\n", dname, (unsigned long)(ldsize>>10)); @@ -450,7 +452,8 @@ int Create(struct supertype *st, char *mddev, int mdfd, name += 2; } } - if (!st->ss->init_super(st, &info.array, size, name, homehost, uuid)) + if (!st->ss->init_super(st, &info.array, size, name, homehost, + uuid, reserve_space)) return 1; if (bitmap_file && vers < 9003) { |