diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-09-16 05:58:42 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-09-16 05:58:42 +0200 |
commit | 301406c9fdb98bbdc0d04ab4e4dec0692977e777 (patch) | |
tree | f294479df031e1b8b3681927041617950af5f013 /super-intel.c | |
parent | Allow metadata handlers to communicate desired safemode delay via mdinfo (diff) | |
download | mdadm-301406c9fdb98bbdc0d04ab4e4dec0692977e777.tar.xz mdadm-301406c9fdb98bbdc0d04ab4e4dec0692977e777.zip |
imsm: use ->getinfo_super() in ->container_content()
* allows container_content() to pick up the safemode_delay
* removes some duplicate code
* fixes an endian bug setting info->array.chunk_size
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/super-intel.c b/super-intel.c index 709923a7..55f748d0 100644 --- a/super-intel.c +++ b/super-intel.c @@ -644,13 +644,24 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info) info->array.md_minor = -1; info->array.ctime = 0; info->array.utime = 0; - info->array.chunk_size = __le16_to_cpu(map->blocks_per_strip * 512); + info->array.chunk_size = __le16_to_cpu(map->blocks_per_strip) << 9; + info->array.state = !dev->vol.dirty; + + info->disk.major = 0; + info->disk.minor = 0; info->data_offset = __le32_to_cpu(map->pba_of_lba0); info->component_size = __le32_to_cpu(map->blocks_per_member); + memset(info->uuid, 0, sizeof(info->uuid)); - info->disk.major = 0; - info->disk.minor = 0; + if (map->map_state == IMSM_T_STATE_UNINITIALIZED || + dev->vol.dirty || dev->vol.migr_state) + info->resync_start = 0; + else + info->resync_start = ~0ULL; + + strncpy(info->name, (char *) dev->volume, MAX_RAID_SERIAL_LEN); + info->name[MAX_RAID_SERIAL_LEN] = 0; sprintf(info->text_version, "/%s/%d", devnum2devname(st->container_dev), @@ -2106,7 +2117,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st) for (i = 0; i < mpb->num_raid_devs; i++) { struct imsm_dev *dev = get_imsm_dev(super, i); - struct imsm_vol *vol = &dev->vol; struct imsm_map *map = get_imsm_map(dev, 0); struct mdinfo *this; int slot; @@ -2115,32 +2125,8 @@ static struct mdinfo *container_content_imsm(struct supertype *st) memset(this, 0, sizeof(*this)); this->next = rest; - this->array.level = get_imsm_raid_level(map); - this->array.raid_disks = map->num_members; - this->array.layout = imsm_level_to_layout(this->array.level); - this->array.md_minor = -1; - this->array.ctime = 0; - this->array.utime = 0; - this->array.chunk_size = __le16_to_cpu(map->blocks_per_strip) << 9; - this->array.state = !vol->dirty; - this->container_member = i; - if (map->map_state == IMSM_T_STATE_UNINITIALIZED || - dev->vol.dirty || dev->vol.migr_state) - this->resync_start = 0; - else - this->resync_start = ~0ULL; - - strncpy(this->name, (char *) dev->volume, MAX_RAID_SERIAL_LEN); - this->name[MAX_RAID_SERIAL_LEN] = 0; - - sprintf(this->text_version, "/%s/%d", - devnum2devname(st->container_dev), - this->container_member); - - memset(this->uuid, 0, sizeof(this->uuid)); - - this->component_size = __le32_to_cpu(map->blocks_per_member); - + super->current_vol = i; + getinfo_super_imsm_volume(st, this); for (slot = 0 ; slot < map->num_members; slot++) { struct mdinfo *info_d; struct dl *d; |