super1: make sure max_dev grows enough when adding a device to an array.

There was a few kernel releases where the kernel would shrink max_dev
to be just enough to hold the current number of devices.
More recent kernels never shrink it.
However to be as compatible as possible, if we notice that
max_dev is too small to successfully add a device, increase it.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2009-03-09 09:59:39 +11:00
parent bc8544484f
commit 9df04a4f3d
1 changed files with 3 additions and 0 deletions

View File

@ -795,6 +795,9 @@ static void add_to_super1(struct supertype *st, mdu_disk_info_t *dk)
*rp = 0xffff;
else
*rp = 0xfffe;
if (dk->number >= __le32_to_cpu(sb->max_dev) &&
__le32_to_cpu(sb->max_dev) < 384)
sb->max_dev = __cpu_to_le32(dk->number+1);
}
static void locate_bitmap1(struct supertype *st, int fd);