]> git.neil.brown.name Git - mdadm.git/commitdiff
Create: default to bitmap=internal for large arrays.
authorNeilBrown <neilb@suse.de>
Mon, 4 Mar 2013 23:36:21 +0000 (10:36 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 4 Mar 2013 23:36:21 +0000 (10:36 +1100)
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>
Build.c
Create.c
mdadm.8.in
mdadm.c

diff --git a/Build.c b/Build.c
index 5c97d63072d04f10078e172857594eaf0aa2624b..317404af2e3d1b802a2fa59e1ce591c1ca6f66c9 100644 (file)
--- 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");
index a4aab41f24ff8f8919a10be8ffc2437e8055cf7b..b7e4c2eaf511901e6a735be512c92c037658ac58 100644 (file)
--- 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",
index 1c06533cbfb9f2fd5229016dfa7014175487075e..39034704a5aa56cdd20916ec163755041ea31637 100644 (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
diff --git a/mdadm.c b/mdadm.c
index 214afa310d4f6e8ed2d148d3e70f91e17e5aa012..c4c5f2948d950104983cb74f61abdf08bc83dd06 100644 (file)
--- 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 ||