X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=super-intel.c;h=ddf4de90100c1e3d4dcf79c751c0cd4e1368194f;hb=1b17b4e4ff57a4f7dcbc87c5a03f2d9c87f6cb2f;hp=b5868e93126304ff2bb5989872ac91d8ae00e0c3;hpb=ca0748fa494425dc025441a8622088126e25e61d;p=thirdparty%2Fmdadm.git diff --git a/super-intel.c b/super-intel.c index b5868e93..ddf4de90 100644 --- a/super-intel.c +++ b/super-intel.c @@ -74,14 +74,17 @@ /* Define all supported attributes that have to be accepted by mdadm */ -#define MPB_ATTRIB_SUPPORTED MPB_ATTRIB_CHECKSUM_VERIFY | \ +#define MPB_ATTRIB_SUPPORTED (MPB_ATTRIB_CHECKSUM_VERIFY | \ MPB_ATTRIB_2TB | \ MPB_ATTRIB_2TB_DISK | \ MPB_ATTRIB_RAID0 | \ MPB_ATTRIB_RAID1 | \ MPB_ATTRIB_RAID10 | \ MPB_ATTRIB_RAID5 | \ - MPB_ATTRIB_EXP_STRIPE_SIZE + MPB_ATTRIB_EXP_STRIPE_SIZE) + +/* Define attributes that are unused but not harmful */ +#define MPB_ATTRIB_IGNORED (MPB_ATTRIB_NEVER_USE) #define MPB_SECTOR_CNT 2210 #define IMSM_RESERVED_SECTORS 4096 @@ -1141,11 +1144,14 @@ void examine_migr_rec_imsm(struct intel_super *super) static int imsm_check_attributes(__u32 attributes) { int ret_val = 1; - __u32 not_supported = (MPB_ATTRIB_SUPPORTED)^0xffffffff; + __u32 not_supported = MPB_ATTRIB_SUPPORTED^0xffffffff; + + not_supported &= ~MPB_ATTRIB_IGNORED; not_supported &= attributes; if (not_supported) { - fprintf(stderr, Name "(IMSM): Unsupported attributes : %x\n", not_supported); + fprintf(stderr, Name "(IMSM): Unsupported attributes : %x\n", + (unsigned)__le32_to_cpu(not_supported)); if (not_supported & MPB_ATTRIB_CHECKSUM_VERIFY) { dprintf("\t\tMPB_ATTRIB_CHECKSUM_VERIFY \n"); not_supported ^= MPB_ATTRIB_CHECKSUM_VERIFY; @@ -2268,7 +2274,8 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info, info->disk.major = dl->major; info->disk.minor = dl->minor; info->disk.number = dl->index; - info->disk.raid_disk = dl->index; + info->disk.raid_disk = get_imsm_disk_slot(map_to_analyse, + dl->index); } info->data_offset = __le32_to_cpu(map_to_analyse->pba_of_lba0); @@ -4330,7 +4337,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, devname); return 1; } - set_imsm_ord_tbl_ent(map, dk->number, dl->index); + set_imsm_ord_tbl_ent(map, dk->raid_disk, dl->index); dl->disk.status = CONFIGURED_DISK; /* if we are creating the first raid device update the family number */ @@ -4915,6 +4922,15 @@ static int is_raid_level_supported(const struct imsm_orom *orom, int level, int return 0; } +static int imsm_default_chunk(const struct imsm_orom *orom) +{ + /* up to 512 if the plaform supports it, otherwise the platform max. + * 128 if no platform detected + */ + int fs = max(7, orom ? fls(orom->sss) : 0); + + return min(512, (1 << fs)); +} #define pr_vrb(fmt, arg...) (void) (verbose && fprintf(stderr, Name fmt, ##arg)) /* @@ -4943,15 +4959,16 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout, level, raiddisks, raiddisks > 1 ? "s" : ""); return 0; } - if (super->orom && level != 1) { - if (chunk && (*chunk == 0 || *chunk == UnSet)) - *chunk = imsm_orom_default_chunk(super->orom); - else if (chunk && !imsm_orom_has_chunk(super->orom, *chunk)) { - pr_vrb(": platform does not support a chunk size of: " - "%d\n", *chunk); - return 0; - } + + if (chunk && (*chunk == 0 || *chunk == UnSet)) + *chunk = imsm_default_chunk(super->orom); + + if (super->orom && chunk && !imsm_orom_has_chunk(super->orom, *chunk)) { + pr_vrb(": platform does not support a chunk size of: " + "%d\n", *chunk); + return 0; } + if (layout != imsm_level_to_layout(level)) { if (level == 5) pr_vrb(": imsm raid 5 only supports the left-asymmetric layout\n"); @@ -5301,9 +5318,8 @@ static void default_geometry_imsm(struct supertype *st, int *level, int *layout, if (level && layout && *layout == UnSet) *layout = imsm_level_to_layout(*level); - if (chunk && (*chunk == UnSet || *chunk == 0) && - super && super->orom) - *chunk = imsm_orom_default_chunk(super->orom); + if (chunk && (*chunk == UnSet || *chunk == 0)) + *chunk = imsm_default_chunk(super->orom); } static void handle_missing(struct intel_super *super, struct imsm_dev *dev);