diff options
author | NeilBrown <neilb@suse.de> | 2010-07-07 13:09:23 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-07-07 13:31:33 +0200 |
commit | 50526e9090d0c118b065840719bc9601be8af8b8 (patch) | |
tree | cfc8f8af64759242fd7acea1e461e88bc1811bd7 | |
parent | Improve --re-add documentation (diff) | |
download | mdadm-50526e9090d0c118b065840719bc9601be8af8b8.tar.xz mdadm-50526e9090d0c118b065840719bc9601be8af8b8.zip |
super-0.90: don't write bitmap larger than 60K
The 4K superblock can be as close as 64K from the end
of the device. As the bitmap (with header) lives after
the superblock (with 0.90 metadata) there could be as
little as 60K of space.
So limit the bitmaps to 59.5K, and only write 60K including
the header.
The bug fixed here means that bitmaps cannot be created
on devices which are exact multiples of 64K in size
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | super0.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -962,7 +962,7 @@ static int add_internal_bitmap0(struct supertype *st, int *chunkp, * size is in sectors, chunk is in bytes !!! */ unsigned long long bits; - unsigned long long max_bits = 60*1024*8; + unsigned long long max_bits = (60*1024 - sizeof(bitmap_super_t))*8; unsigned long long min_chunk; int chunk = *chunkp; mdp_super_t *sb = st->sb; @@ -1048,7 +1048,7 @@ static int write_bitmap0(struct supertype *st, int fd) memset(buf, 0xff, 4096); memcpy(buf, ((char*)sb)+MD_SB_BYTES, sizeof(bitmap_super_t)); - towrite = 64*1024; + towrite = 60*1024; while (towrite > 0) { n = towrite; if (n > 4096) |