summaryrefslogtreecommitdiffstats
path: root/bitmap.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 /bitmap.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 'bitmap.c')
-rw-r--r--bitmap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bitmap.c b/bitmap.c
index fdf8884..b647939 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -115,6 +115,15 @@ unsigned long long bitmap_bits(unsigned long long array_size,
return (array_size * 512 + chunksize - 1) / chunksize;
}
+unsigned long bitmap_sectors(struct bitmap_super_s *bsb)
+{
+ unsigned long long bits = bitmap_bits(__le64_to_cpu(bsb->sync_size),
+ __le32_to_cpu(bsb->chunksize));
+ int bits_per_sector = 8*512;
+ return (bits + bits_per_sector - 1) / bits_per_sector;
+}
+
+
bitmap_info_t *bitmap_fd_read(int fd, int brief)
{
/* Note: fd might be open O_DIRECT, so we must be