From dfd4d8ee426fb71a369f494f95fe95b114a33c7c Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 9 Aug 2005 04:25:47 +0000 Subject: Add write-behind support Currently this includes --write-behind to set level of write-behind supported --write-mostly to flag devices as write-mostly. Signed-off-by: Neil Brown --- Create.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Create.c') diff --git a/Create.c b/Create.c index 735b8d7..87a9a2e 100644 --- a/Create.c +++ b/Create.c @@ -35,7 +35,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, int chunk, int level, int layout, unsigned long size, int raiddisks, int sparedisks, int subdevs, mddev_dev_t devlist, int runstop, int verbose, int force, - char *bitmap_file, int bitmap_chunk, int delay) + char *bitmap_file, int bitmap_chunk, int write_behind, int delay) { /* * Create a new raid array. @@ -351,7 +351,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, fprintf(stderr, Name ": internal bitmaps not supported by this kernel.\n"); return 1; } - if (!st->ss->add_internal_bitmap(super, bitmap_chunk, delay, + if (!st->ss->add_internal_bitmap(super, bitmap_chunk, delay, write_behind, size ? size : maxsize)) { fprintf(stderr, Name ": Given bitmap chunk size not supported.\n"); return 1; @@ -382,7 +382,8 @@ int Create(struct supertype *st, char *mddev, int mdfd, bitmap_chunk = DEFAULT_BITMAP_CHUNK; st->ss->uuid_from_super(uuid, super); - if (CreateBitmap(bitmap_file, force, (char*)uuid, bitmap_chunk, delay, + if (CreateBitmap(bitmap_file, force, (char*)uuid, bitmap_chunk, + delay, write_behind, array.size*2ULL /* FIXME wrong for raid10 */)) { return 1; } @@ -416,14 +417,18 @@ int Create(struct supertype *st, char *mddev, int mdfd, } disk.raid_disk = disk.number; if (disk.raid_disk < raiddisks) - disk.state = 6; /* active and in sync */ + disk.state = (1<writemostly) + disk.state |= (1<devname, "missing")==0) { disk.major = 0; disk.minor = 0; - disk.state = 1; /* faulty */ + disk.state = (1<devname, O_RDONLY|O_EXCL, 0); if (fd < 0) { -- cgit