From da9b4a62af80edbbcc96196ab5d887308516ba70 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 12 Apr 2009 00:58:28 -0700 Subject: [PATCH] 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 --- mdadm.h | 3 +++ super-ddf.c | 1 + super-intel.c | 3 +++ sysfs.c | 14 ++++++++++++++ 4 files changed, 21 insertions(+) diff --git a/mdadm.h b/mdadm.h index f580e3e8..c33ec248 100644 --- a/mdadm.h +++ b/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; diff --git a/super-ddf.c b/super-ddf.c index 6455deee..6a870556 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -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]); diff --git a/super-intel.c b/super-intel.c index 3befc3d0..b41ab3b1 100644 --- a/super-intel.c +++ b/super-intel.c @@ -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; diff --git a/sysfs.c b/sysfs.c index 2dad7d3f..48d1f542 100644 --- a/sysfs.c +++ b/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; -- 2.39.2