From: NeilBrown Date: Mon, 4 Mar 2013 23:36:21 +0000 (+1100) Subject: Create: default to bitmap=internal for large arrays. X-Git-Tag: mdadm-3.3-rc1~102 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=748952f73e34f9963ea82347f4d71d67dcb1096a Create: default to bitmap=internal for large arrays. Here, "large" means components are 100G or more. It is usually beneficial to have write-intent bitmaps on such arrays. They can be suppressed with --bitmap=none Signed-off-by: NeilBrown --- diff --git a/Build.c b/Build.c index 5c97d630..317404af 100644 --- a/Build.c +++ b/Build.c @@ -154,6 +154,8 @@ int Build(char *mddev, struct mddev_dev *devlist, goto abort; } + if (s->bitmap_file && strcmp(s->bitmap_file, "none") == 0) + s->bitmap_file = NULL; if (s->bitmap_file && s->level <= 0) { pr_err("bitmaps not meaningful with level %s\n", map_num(pers, s->level)?:"given"); diff --git a/Create.c b/Create.c index a4aab41f..b7e4c2ea 100644 --- a/Create.c +++ b/Create.c @@ -506,6 +506,17 @@ int Create(struct supertype *st, char *mddev, pr_err("size set to %lluK\n", s->size); } } + + if (!s->bitmap_file && + s->level >= 1 && + (s->write_behind || s->size > 100*1024*1024ULL)) { + if (c->verbose > 0) + pr_err("automatically enabling write-intent bitmap on large array\n"); + s->bitmap_file = "internal"; + } + if (s->bitmap_file && strcmp(s->bitmap_file, "none") == 0) + s->bitmap_file = NULL; + if (!have_container && s->level > 0 && ((maxsize-s->size)*100 > maxsize)) { if (c->runstop != 1 || c->verbose >= 0) pr_err("largest drive (%s) exceeds size (%lluK) by more than 1%%\n", diff --git a/mdadm.8.in b/mdadm.8.in index 1c06533c..39034704 100644 --- a/mdadm.8.in +++ b/mdadm.8.in @@ -686,6 +686,12 @@ slash ('/') if it is a real file (not 'internal' or 'none'). Note: external bitmaps are only known to work on ext2 and ext3. Storing bitmap files on other filesystems may result in serious problems. +When creating an array on devices which are 100G or larger, +.I mdadm +automatically adds an internal bitmap as it will usually be +beneficial. This can be suppressed with +.B "\-\-bitmap=none". + .TP .BR \-\-bitmap\-chunk= Set the chunksize of the bitmap. Each bit corresponds to that many @@ -1932,6 +1938,15 @@ setting. .\".B \-\-size .\"is given, the apparent size of the smallest drive given is used. +If the array type supports a write-intent bitmap, and if the devices +in the array exceed 100G is size, an internal write-intent bitmap +will automatically be added unless some other option is explicitly +requested with the +.B \-\-bitmap +option. In any case space for a bitmap will be reserved so that one +can be added layer with +.BR "\-\-grow \-\-bitmap=internal" . + If the metadata type supports it (currently only 1.x metadata), space will be allocated to store a bad block list. This allows a modest number of bad blocks to be recorded, allowing the drive to remain in diff --git a/mdadm.c b/mdadm.c index 214afa31..c4c5f294 100644 --- a/mdadm.c +++ b/mdadm.c @@ -1079,12 +1079,6 @@ int main(int argc, char *argv[]) case O(BUILD,Bitmap): case O(CREATE,'b'): case O(CREATE,Bitmap): /* here we create the bitmap */ - if (strcmp(optarg, "none") == 0) { - pr_err("'--bitmap none' only" - " supported for --grow\n"); - exit(2); - } - /* FALL THROUGH */ case O(GROW,'b'): case O(GROW,Bitmap): if (strcmp(optarg, "internal")== 0 ||