summaryrefslogtreecommitdiffstats
path: root/Create.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-08-09 04:25:47 +0000
committerNeil Brown <neilb@suse.de>2005-08-09 04:25:47 +0000
commitdfd4d8ee426fb71a369f494f95fe95b114a33c7c (patch)
tree616d0864cc8cb08085cb72b6ad5ccc545cd8b6a5 /Create.c
parent586ed40547a380b9f8bd58aa87c12fbaf6eabf65 (diff)
downloadmdadm-dfd4d8ee426fb71a369f494f95fe95b114a33c7c.tar.gz
mdadm-dfd4d8ee426fb71a369f494f95fe95b114a33c7c.tar.xz
mdadm-dfd4d8ee426fb71a369f494f95fe95b114a33c7c.zip
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 <neilb@cse.unsw.edu.au>
Diffstat (limited to 'Create.c')
-rw-r--r--Create.c15
1 files changed, 10 insertions, 5 deletions
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<<MD_DISK_ACTIVE) |
+ (1<<MD_DISK_SYNC);
else
disk.state = 0;
+ if (dv->writemostly)
+ disk.state |= (1<<MD_DISK_WRITEMOSTLY);
+
if (dnum == insert_point ||
strcasecmp(dv->devname, "missing")==0) {
disk.major = 0;
disk.minor = 0;
- disk.state = 1; /* faulty */
+ disk.state = (1<<MD_DISK_FAULTY);
} else {
fd = open(dv->devname, O_RDONLY|O_EXCL, 0);
if (fd < 0) {