From b8ab2a50aba72c7316d92d0fb414167844673136 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 17 Nov 2009 13:15:34 +1100 Subject: Set default bitmap-chunksize for internal bitmaps to at least 64Meg A small bitmap-chunksize hurts performance without helping resync speed much - particularly on internal bitmaps. So set the default to at least 64Meg. Signed-off-by: NeilBrown --- mdadm.8 | 4 ++-- super0.c | 9 +++++++-- super1.c | 9 +++++++-- tests/05r1-grow-internal | 2 +- tests/05r1-grow-internal-1 | 2 +- tests/05r1-internalbitmap | 2 +- tests/05r1-internalbitmap-v1a | 2 +- tests/05r1-internalbitmap-v1b | 2 +- tests/05r1-internalbitmap-v1c | 2 +- tests/05r1-re-add | 2 +- tests/05r5-internalbitmap | 2 +- tests/06update-uuid | 4 ++-- tests/06wrmostly | 2 +- 13 files changed, 27 insertions(+), 17 deletions(-) diff --git a/mdadm.8 b/mdadm.8 index fb20383..3b6ffa0 100644 --- a/mdadm.8 +++ b/mdadm.8 @@ -614,8 +614,8 @@ When using a file based bitmap, the default is to use the smallest size that is at-least 4 and requires no more than 2^21 chunks. When using an .B internal -bitmap, the chunksize is automatically determined to make best use of -available space. +bitmap, the chunksize defaults to 64Meg, or larger if necessary to +fit the bitmap into the available space. .TP .BR \-W ", " \-\-write\-mostly diff --git a/super0.c b/super0.c index f9e6a6d..955e832 100644 --- a/super0.c +++ b/super0.c @@ -970,9 +970,14 @@ static int add_internal_bitmap0(struct supertype *st, int *chunkp, min_chunk *= 2; bits = (bits+1)/2; } - if (chunk == UnSet) + if (chunk == UnSet) { + /* A chunk size less than a few Megabytes gives poor + * performance without increasing resync noticeably + */ chunk = min_chunk; - else if (chunk < min_chunk) + if (chunk < 64*1024*1024) + chunk = 64*1024*1024; + } else if (chunk < min_chunk) return 0; /* chunk size too small */ sb->state |= (1< /dev/null 01234567:89abcdef:fedcba98:76543210 || { } mdadm -S /dev/md0 -mdadm -CR --assume-clean -e1.2 -b internal $md0 -l5 -n3 $dev0 $dev1 $dev2 +mdadm -CR --assume-clean -e1.2 -b internal --bitmap-chunk=4 $md0 -l5 -n3 $dev0 $dev1 $dev2 mdadm -S /dev/md0 mdadm -A /dev/md0 --update=uuid --uuid=0123456789abcdef:fedcba9876543210 $dev0 $dev1 $dev2 no_errors diff --git a/tests/06wrmostly b/tests/06wrmostly index a4d730e..2a3fae6 100644 --- a/tests/06wrmostly +++ b/tests/06wrmostly @@ -8,7 +8,7 @@ testdev $md0 1 $mdsize1 1 mdadm -S $md0 -mdadm -CR $md0 -l1 -n3 --write-behind --bitmap=internal $dev0 $dev1 --write-mostly $dev2 +mdadm -CR $md0 -l1 -n3 --write-behind --bitmap=internal --bitmap-chunk=4 $dev0 $dev1 --write-mostly $dev2 testdev $md0 1 $mdsize1 1 mdadm -S $md0 -- cgit v1.2.1