diff options
-rw-r--r-- | Build.c | 4 | ||||
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Create.c | 3 | ||||
-rw-r--r-- | Grow.c | 2 | ||||
-rw-r--r-- | bitmap.c | 11 | ||||
-rw-r--r-- | mdadm.8 | 5 | ||||
-rw-r--r-- | mdadm.c | 1 |
7 files changed, 20 insertions, 9 deletions
@@ -204,16 +204,18 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout, bitmap_fd = open(bitmap_file, O_RDWR); if (bitmap_fd < 0) { int major = BITMAP_MAJOR_HI; +#if 0 if (bitmap_chunk == UnSet) { fprintf(stderr, Name ": %s cannot be openned.", bitmap_file); return 1; } +#endif if (vers < 9003) { major = BITMAP_MAJOR_HOSTENDIAN; #ifdef __BIG_ENDIAN fprintf(stderr, Name ": Warning - bitmaps created on this kernel are not portable\n" - " between different architectured. Consider upgrading the Linux kernel.\n"); + " between different architectures. Consider upgrading the Linux kernel.\n"); #endif } bitmapsize = size>>9; /* FIXME wrong for RAID10 */ @@ -5,6 +5,9 @@ Changes Prior to this release DegradedArray) generates an Email. - Assume "DEVICE partitions" if no DEVICE line is given. - Support new 'offset' layout for raid10. + - When creating a bitmap file, choose a chunksize to limit number + of bitmap chunks to 2 million. More than this can cause kmalloc + failure. Changes Prior to 2.4.1 release - Honour --write-mostly when adding to an array without persistent @@ -432,9 +432,6 @@ int Create(struct supertype *st, char *mddev, int mdfd, if (bitmap_file) { int uuid[4]; - if (bitmap_chunk == UnSet) - bitmap_chunk = DEFAULT_BITMAP_CHUNK; - st->ss->uuid_from_super(uuid, super); if (CreateBitmap(bitmap_file, force, (char*)uuid, bitmap_chunk, delay, write_behind, @@ -329,8 +329,6 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int int d; int max_devs = st->max_devs; void *super = NULL; - if (chunk == UnSet) - chunk = DEFAULT_BITMAP_CHUNK; /* try to load a superblock */ for (d=0; d<max_devs; d++) { @@ -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; @@ -447,11 +447,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. - .TP .BR --bitmap-chunk= Set the chunksize of the bitmap. Each bit corresponds to that many -Kilobytes of storage. Default is 4 when using a file based bitmap. +Kilobytes of storage. +When using a file based bitmap, the default is to use the smallest +size that is atleast 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 @@ -1020,7 +1020,6 @@ int main(int argc, char *argv[]) } break; case BUILD: - if (bitmap_chunk == UnSet) bitmap_chunk = DEFAULT_BITMAP_CHUNK; if (delay == 0) delay = DEFAULT_BITMAP_DELAY; if (write_behind && !bitmap_file) { fprintf(stderr, Name ": write-behind mode requires a bitmap.\n"); |