]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: FIX: Use metadata information for restore_stripes() and save_stripes()
authorAdam Kwolek <adam.kwolek@intel.com>
Thu, 9 Jun 2011 03:00:55 +0000 (13:00 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 9 Jun 2011 03:00:55 +0000 (13:00 +1000)
For raid0 reshape imsm uses degraded raid4 for this operation.
Using real raid level (raid0) for stripe calculation causes no need
for parity calculation and can speed up reshape process.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index 8cd5958066fbb967ff3c7232c678c108dbeaeb86..a459fb0d3a50b6ebb0f8bb337dbdfc64c54d0c66 100644 (file)
@@ -7697,6 +7697,8 @@ int save_backup_imsm(struct supertype *st,
        int i;
        struct imsm_map *map_dest = get_imsm_map(dev, 0);
        int new_disks = map_dest->num_members;
+       int dest_layout = 0;
+       int dest_chunk;
 
        targets = malloc(new_disks * sizeof(int));
        if (!targets)
@@ -7715,15 +7717,19 @@ int save_backup_imsm(struct supertype *st,
        if (open_backup_targets(info, new_disks, targets))
                goto abort;
 
+       if (map_dest->raid_level != 0)
+               dest_layout = ALGORITHM_LEFT_ASYMMETRIC;
+       dest_chunk = __le16_to_cpu(map_dest->blocks_per_strip) * 512;
+
        if (restore_stripes(targets, /* list of dest devices */
                            target_offsets, /* migration record offsets */
                            new_disks,
-                           info->new_chunk,
-                           info->new_level,
-                           info->new_layout,
-                           -1,         /* source backup file descriptor */
-                           0,          /* input buf offset
-                                        * always 0 buf is already offset */
+                           dest_chunk,
+                           map_dest->raid_level,
+                           dest_layout,
+                           -1,    /* source backup file descriptor */
+                           0,     /* input buf offset
+                                   * always 0 buf is already offseted */
                            0,
                            length,
                            buf) != 0) {
@@ -8686,6 +8692,7 @@ static int imsm_manage_reshape(
        unsigned long long start; /* [bytes] */
        unsigned long long start_buf_shift; /* [bytes] */
        int degraded = 0;
+       int source_layout = 0;
 
        if (!fds || !offsets || !sra)
                goto abort;
@@ -8740,6 +8747,8 @@ static int imsm_manage_reshape(
        }
 
        max_position = sra->component_size * ndata;
+       if (map_src->raid_level != 0)
+               source_layout = ALGORITHM_LEFT_ASYMMETRIC;
 
        while (__le32_to_cpu(migr_rec->curr_migr_unit) <
               __le32_to_cpu(migr_rec->num_migr_units)) {
@@ -8796,8 +8805,8 @@ static int imsm_manage_reshape(
                                start_buf_shift, next_step_filler);
 
                        if (save_stripes(fds, offsets, map_src->num_members,
-                                        chunk, sra->array.level,
-                                        sra->array.layout, 0, NULL, start_src,
+                                        chunk, map_src->raid_level,
+                                        source_layout, 0, NULL, start_src,
                                         copy_length +
                                         next_step_filler + start_buf_shift,
                                         buf)) {