]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: getinfo_super_imsm_volume() doesn't fill all disk information
authorNeilBrown <neilb@suse.de>
Thu, 14 Jul 2011 05:42:10 +0000 (15:42 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 14 Jul 2011 05:42:10 +0000 (15:42 +1000)
getinfo_super_imsm_volume doesn't correctly set info.disk fields
because it doesn't know which disk to set them from.
It should be the last disk passed to add_to_super.

So add a field 'current_disk' to record this disk in add_to_super, and
use it in getinfo_super.

This allows us to remove a hack in Create.c

Signed-off-by: NeilBrown <neilb@suse.de>
Create.c
super-intel.c

index 48115db800a730a29968f1e1ae78e0c8bfd50e1c..8d88aa12be5d6b0bae5b495073982967f99eb0da 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -856,15 +856,6 @@ int Create(struct supertype *st, char *mddev,
                                        /* getinfo_super might have lost these ... */
                                        inf->disk.major = major(stb.st_rdev);
                                        inf->disk.minor = minor(stb.st_rdev);
-                                       /* FIXME the following should not be needed
-                                        * as getinfo_super is suppose to set
-                                        * them.  However it doesn't for imsm,
-                                        * so we have this hack for now
-                                        */
-                                       if (st->ss == &super_imsm) {
-                                               inf->disk.number = dnum;
-                                               inf->disk.raid_disk = dnum;
-                                       }
                                }
                                break;
                        case 2:
index 70cf9939362e6d09090a7a2ae14747252df60e5e..b5868e93126304ff2bb5989872ac91d8ae00e0c3 100644 (file)
@@ -341,7 +341,7 @@ struct intel_super {
                struct extent *e; /* for determining freespace @ create */
                int raiddisk; /* slot to fill in autolayout */
                enum action action;
-       } *disks;
+       } *disks, *current_disk;
        struct dl *disk_mgmt_list; /* list of disks to add/remove while mdmon
                                      active */
        struct dl *missing; /* disks removed while we weren't looking */
@@ -2201,7 +2201,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
        if (prev_map)
                map_to_analyse = prev_map;
 
-       dl = super->disks;
+       dl = super->current_disk;
 
        info->container_member    = super->current_vol;
        info->array.raid_disks    = map->num_members;
@@ -2263,11 +2263,12 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
                info->new_chunk = info->array.chunk_size;
                info->delta_disks = 0;
        }
-       info->disk.major = 0;
-       info->disk.minor = 0;
+
        if (dl) {
                info->disk.major = dl->major;
                info->disk.minor = dl->minor;
+               info->disk.number = dl->index;
+               info->disk.raid_disk = dl->index;
        }
 
        info->data_offset         = __le32_to_cpu(map_to_analyse->pba_of_lba0);
@@ -4349,7 +4350,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
                mpb->family_num = __cpu_to_le32(sum);
                mpb->orig_family_num = mpb->family_num;
        }
-
+       super->current_disk = dl;
        return 0;
 }