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 */
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
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,
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++) {
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;
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
}
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");