summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bitmap.c b/bitmap.c
index 33deab1..75492f7 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -341,6 +341,17 @@ int CreateBitmap(char *filename, int force, char uuid[16],
return rv;
}
+ if (chunksize == UnSet) {
+ /* We don't want more than 2^21 chunks, as 2^11 fill up one
+ * 4K page (2 bytes per chunk), and 2^10 address of those
+ * fill up a 4K indexing page. 2^20 might be safer...
+ */
+ chunksize = DEFAULT_BITMAP_CHUNK;
+ /* <<21 for 2^21 chunks, >>9 to convert bytes to sectors */
+ while (array_size > (chunksize << (21-9)))
+ chunksize <<= 1;
+ }
+
memset(&sb, 0, sizeof(sb));
sb.magic = BITMAP_MAGIC;
sb.version = major;