From 005debfc11b4cbe653503667423df98b64e5be0e Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 20 Aug 2007 14:14:25 +1000 Subject: Fix problem with add a device to a 1.x array created with older mdadm. When adding new disk to an array, don't reserve so much bitmap space that the disk cannot store the required data. (Needed when 1.x array was created with older mdadm). --- super1.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'super1.c') diff --git a/super1.c b/super1.c index 0ff11fb..cf46a2f 100644 --- a/super1.c +++ b/super1.c @@ -917,12 +917,16 @@ static int write_init_super1(struct supertype *st, void *sbv, break; case 1: sb->super_offset = __cpu_to_le64(0); + if (4*2 + bm_space + __le64_to_cpu(sb->size) > dsize) + bm_space = dsize - __le64_to_cpu(sb->size) - 4*2; sb->data_offset = __cpu_to_le64(bm_space + 4*2); sb->data_size = __cpu_to_le64(dsize - bm_space - 4*2); break; case 2: sb_offset = 4*2; sb->super_offset = __cpu_to_le64(4*2); + if (4*2 + 4*2 + bm_space + __le64_to_cpu(sb->size) > dsize) + bm_space = dsize - __le64_to_cpu(sb->size) - 4*2 - 4*2; sb->data_offset = __cpu_to_le64(4*2 + 4*2 + bm_space); sb->data_size = __cpu_to_le64(dsize - 4*2 - 4*2 - bm_space ); break; -- cgit