]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix problem with add a device to a 1.x array created with older mdadm.
authorNeil Brown <neilb@suse.de>
Mon, 20 Aug 2007 04:14:25 +0000 (14:14 +1000)
committerNeil Brown <neilb@suse.de>
Mon, 20 Aug 2007 04:14:25 +0000 (14:14 +1000)
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).

ANNOUNCE-2.6.3 [new file with mode: 0644]
ChangeLog
crc32.c [new file with mode: 0644]
crc32.h [new file with mode: 0644]
super-ddf.c [new file with mode: 0644]
super1.c

diff --git a/ANNOUNCE-2.6.3 b/ANNOUNCE-2.6.3
new file mode 100644 (file)
index 0000000..e69de29
index 10ddcf00a1e57905c8eda8589e455a4f1d898d0a..71d19f42673bf20ac811ea3e32db6539aaebf777 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 Changes Prior to this release
     -   allow --write-behind to be set for --grow.
+    -   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).
 
 Changes Prior to 2.6.2 release
     -   --fail detached and --remove faulty can be used to fail and
diff --git a/crc32.c b/crc32.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/crc32.h b/crc32.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/super-ddf.c b/super-ddf.c
new file mode 100644 (file)
index 0000000..e69de29
index 0ff11fb12726fc963b44836db6b06e9a5b86f6f6..cf46a2f33c5b7a71bf96102bacea9db19cc69550 100644 (file)
--- 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;