Dan Williams: imsm: set array size at Create/Assemble
Martin F. Krafft
madduck at alioth.debian.org
Thu May 7 12:11:41 UTC 2009
Module: mdadm
Branch: debian/experimental
Commit: da9b4a62af80edbbcc96196ab5d887308516ba70
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=da9b4a62af80edbbcc96196ab5d887308516ba70
Author: Dan Williams <dan.j.williams at intel.com>
Date: Sun Apr 12 00:58:28 2009 -0700
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 at intel.com>
---
mdadm.h | 3 +++
super-ddf.c | 1 +
super-intel.c | 3 +++
sysfs.c | 14 ++++++++++++++
4 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/mdadm.h b/mdadm.h
index f580e3e..c33ec24 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 6455dee..6a87055 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 3befc3d..b41ab3b 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 2dad7d3..48d1f54 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;
More information about the pkg-mdadm-commits
mailing list