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 <neilb@suse.de>
This commit is contained in:
NeilBrown 2013-03-05 10:36:21 +11:00
parent 8af530b07f
commit 748952f73e
4 changed files with 28 additions and 6 deletions

View File

@ -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");

View File

@ -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",

View File

@ -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

View File

@ -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 ||