summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-10-13 16:15:16 +1100
committerNeilBrown <neilb@suse.de>2008-10-13 16:15:16 +1100
commit2a528478c75b6659188fc2ce0d9543124992fe6c (patch)
treebb190fc4b4429525c568f698b15b03c19d164657 /super1.c
parente5669f40047ba0a8354418d0af5f7e7d862aaea4 (diff)
downloadmdadm-2a528478c75b6659188fc2ce0d9543124992fe6c.tar.gz
mdadm-2a528478c75b6659188fc2ce0d9543124992fe6c.tar.xz
mdadm-2a528478c75b6659188fc2ce0d9543124992fe6c.zip
Manage: allow adding device that is just large enough to v1.x array.
When adding a device to an array, we check that it is large enough. Currently the check makes sure there is also room for a reasonably sized bitmap. But if the array doesn't have a bitmap, then this test might be too restrictive. So when adding, only insist there is enough space for the current bitmap. When Creating, still require room for the standard sized bitmap. This resolved Debian Bug 500309
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/super1.c b/super1.c
index fe915f8..e1d0219 100644
--- a/super1.c
+++ b/super1.c
@@ -1214,10 +1214,21 @@ static struct supertype *match_metadata_desc1(char *arg)
*/
static __u64 avail_size1(struct supertype *st, __u64 devsize)
{
+ struct mdp_superblock_1 *super = st->sb;
if (devsize < 24)
return 0;
- devsize -= choose_bm_space(devsize);
+ if (super == NULL)
+ /* creating: allow suitable space for bitmap */
+ devsize -= choose_bm_space(devsize);
+#ifndef MDASSEMBLE
+ else if (__le32_to_cpu(super->feature_map)&MD_FEATURE_BITMAP_OFFSET) {
+ /* hot-add. allow for actual size of bitmap */
+ struct bitmap_super_s *bsb;
+ bsb = (struct bitmap_super_s *)(((char*)super)+1024);
+ devsize -= bitmap_sectors(bsb);
+ }
+#endif
switch(st->minor_version) {
case -1: /* no specified. Now time to set default */