imsm: set array size at Create/Assemble
imsm arrays round down the effective array size to the closest 1 megabyte boundary so teach get_info_super_imsm and sysfs_set_array to set 'md/array_size' if available (and make sure ddf uses the default size). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
da18878954
commit
da9b4a62af
3
mdadm.h
3
mdadm.h
|
@ -146,6 +146,9 @@ struct mdinfo {
|
|||
unsigned long long component_size; /* same as array.size, except in
|
||||
* sectors and up to 64bits.
|
||||
*/
|
||||
unsigned long long custom_array_size; /* size for non-default sized
|
||||
* arrays (in sectors)
|
||||
*/
|
||||
int reshape_active;
|
||||
unsigned long long reshape_progress;
|
||||
unsigned long long resync_start;
|
||||
|
|
|
@ -1374,6 +1374,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info)
|
|||
__be32_to_cpu(*(__u32*)(vc->conf.guid+16));
|
||||
info->array.utime = DECADE + __be32_to_cpu(vc->conf.timestamp);
|
||||
info->array.chunk_size = 512 << vc->conf.chunk_shift;
|
||||
info->custom_array_size = 0;
|
||||
|
||||
if (cd >= 0 && cd < ddf->mppe) {
|
||||
info->data_offset = __be64_to_cpu(vc->lba_offset[cd]);
|
||||
|
|
|
@ -1203,6 +1203,9 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info)
|
|||
info->array.utime = 0;
|
||||
info->array.chunk_size = __le16_to_cpu(map->blocks_per_strip) << 9;
|
||||
info->array.state = !dev->vol.dirty;
|
||||
info->custom_array_size = __le32_to_cpu(dev->size_high);
|
||||
info->custom_array_size <<= 32;
|
||||
info->custom_array_size |= __le32_to_cpu(dev->size_low);
|
||||
|
||||
info->disk.major = 0;
|
||||
info->disk.minor = 0;
|
||||
|
|
14
sysfs.c
14
sysfs.c
|
@ -506,6 +506,20 @@ int sysfs_set_array(struct mdinfo *info, int vers)
|
|||
rv |= sysfs_set_num(info, NULL, "chunk_size", info->array.chunk_size);
|
||||
rv |= sysfs_set_num(info, NULL, "layout", info->array.layout);
|
||||
rv |= sysfs_set_num(info, NULL, "component_size", info->component_size/2);
|
||||
if (info->custom_array_size) {
|
||||
int rc;
|
||||
|
||||
rc = sysfs_set_num(info, NULL, "array_size",
|
||||
info->custom_array_size/2);
|
||||
if (rc && errno == ENOENT) {
|
||||
fprintf(stderr, Name ": This kernel does not "
|
||||
"have the md/array_size attribute, "
|
||||
"the array may be larger than expected\n");
|
||||
rc = 0;
|
||||
}
|
||||
rv |= rc;
|
||||
}
|
||||
|
||||
if (info->array.level > 0)
|
||||
rv |= sysfs_set_num(info, NULL, "resync_start", info->resync_start);
|
||||
return rv;
|
||||
|
|
Loading…
Reference in New Issue