diff options
| -rw-r--r-- | drivers/md/md.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index afff038ecf6f..64b35cbf3159 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -695,6 +695,17 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version | |||
| 695 | rdev->data_offset = 0; | 695 | rdev->data_offset = 0; |
| 696 | rdev->sb_size = MD_SB_BYTES; | 696 | rdev->sb_size = MD_SB_BYTES; |
| 697 | 697 | ||
| 698 | if (sb->state & (1<<MD_SB_BITMAP_PRESENT)) { | ||
| 699 | if (sb->level != 1 && sb->level != 4 | ||
| 700 | && sb->level != 5 && sb->level != 6 | ||
| 701 | && sb->level != 10) { | ||
| 702 | /* FIXME use a better test */ | ||
| 703 | printk(KERN_WARNING | ||
| 704 | "md: bitmaps not supported for this level.\n"); | ||
| 705 | goto abort; | ||
| 706 | } | ||
| 707 | } | ||
| 708 | |||
| 698 | if (sb->level == LEVEL_MULTIPATH) | 709 | if (sb->level == LEVEL_MULTIPATH) |
| 699 | rdev->desc_nr = -1; | 710 | rdev->desc_nr = -1; |
| 700 | else | 711 | else |
| @@ -793,16 +804,8 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 793 | mddev->max_disks = MD_SB_DISKS; | 804 | mddev->max_disks = MD_SB_DISKS; |
| 794 | 805 | ||
| 795 | if (sb->state & (1<<MD_SB_BITMAP_PRESENT) && | 806 | if (sb->state & (1<<MD_SB_BITMAP_PRESENT) && |
| 796 | mddev->bitmap_file == NULL) { | 807 | mddev->bitmap_file == NULL) |
| 797 | if (mddev->level != 1 && mddev->level != 4 | ||
| 798 | && mddev->level != 5 && mddev->level != 6 | ||
| 799 | && mddev->level != 10) { | ||
| 800 | /* FIXME use a better test */ | ||
| 801 | printk(KERN_WARNING "md: bitmaps not supported for this level.\n"); | ||
| 802 | return -EINVAL; | ||
| 803 | } | ||
| 804 | mddev->bitmap_offset = mddev->default_bitmap_offset; | 808 | mddev->bitmap_offset = mddev->default_bitmap_offset; |
| 805 | } | ||
| 806 | 809 | ||
| 807 | } else if (mddev->pers == NULL) { | 810 | } else if (mddev->pers == NULL) { |
| 808 | /* Insist on good event counter while assembling */ | 811 | /* Insist on good event counter while assembling */ |
| @@ -1059,6 +1062,18 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) | |||
| 1059 | bdevname(rdev->bdev,b)); | 1062 | bdevname(rdev->bdev,b)); |
| 1060 | return -EINVAL; | 1063 | return -EINVAL; |
| 1061 | } | 1064 | } |
| 1065 | if ((le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET)) { | ||
| 1066 | if (sb->level != cpu_to_le32(1) && | ||
| 1067 | sb->level != cpu_to_le32(4) && | ||
| 1068 | sb->level != cpu_to_le32(5) && | ||
| 1069 | sb->level != cpu_to_le32(6) && | ||
| 1070 | sb->level != cpu_to_le32(10)) { | ||
| 1071 | printk(KERN_WARNING | ||
| 1072 | "md: bitmaps not supported for this level.\n"); | ||
| 1073 | return -EINVAL; | ||
| 1074 | } | ||
| 1075 | } | ||
| 1076 | |||
| 1062 | rdev->preferred_minor = 0xffff; | 1077 | rdev->preferred_minor = 0xffff; |
| 1063 | rdev->data_offset = le64_to_cpu(sb->data_offset); | 1078 | rdev->data_offset = le64_to_cpu(sb->data_offset); |
| 1064 | atomic_set(&rdev->corrected_errors, le32_to_cpu(sb->cnt_corrected_read)); | 1079 | atomic_set(&rdev->corrected_errors, le32_to_cpu(sb->cnt_corrected_read)); |
| @@ -1142,14 +1157,9 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 1142 | mddev->max_disks = (4096-256)/2; | 1157 | mddev->max_disks = (4096-256)/2; |
| 1143 | 1158 | ||
| 1144 | if ((le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET) && | 1159 | if ((le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET) && |
| 1145 | mddev->bitmap_file == NULL ) { | 1160 | mddev->bitmap_file == NULL ) |
| 1146 | if (mddev->level != 1 && mddev->level != 5 && mddev->level != 6 | ||
| 1147 | && mddev->level != 10) { | ||
| 1148 | printk(KERN_WARNING "md: bitmaps not supported for this level.\n"); | ||
| 1149 | return -EINVAL; | ||
| 1150 | } | ||
| 1151 | mddev->bitmap_offset = (__s32)le32_to_cpu(sb->bitmap_offset); | 1161 | mddev->bitmap_offset = (__s32)le32_to_cpu(sb->bitmap_offset); |
| 1152 | } | 1162 | |
| 1153 | if ((le32_to_cpu(sb->feature_map) & MD_FEATURE_RESHAPE_ACTIVE)) { | 1163 | if ((le32_to_cpu(sb->feature_map) & MD_FEATURE_RESHAPE_ACTIVE)) { |
| 1154 | mddev->reshape_position = le64_to_cpu(sb->reshape_position); | 1164 | mddev->reshape_position = le64_to_cpu(sb->reshape_position); |
| 1155 | mddev->delta_disks = le32_to_cpu(sb->delta_disks); | 1165 | mddev->delta_disks = le32_to_cpu(sb->delta_disks); |
