]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: update array size information in metadata
authorAdam Kwolek <adam.kwolek@intel.com>
Thu, 6 Jan 2011 07:29:15 +0000 (18:29 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 6 Jan 2011 07:29:15 +0000 (18:29 +1100)
When disks are added size has to increase in metadata.
This size should be used by common code to set size in md when reshape will be finished.

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

index ffb03437697e55ede723d916862bf545b8d13df2..c52aea87d38ae7459d6710bbcc21e560445d4256 100644 (file)
@@ -5646,6 +5646,7 @@ static void imsm_process_update(struct supertype *st,
                        void **sp = update->space_list;
                        struct imsm_dev *newdev;
                        struct imsm_map *newmap, *oldmap;
+                       int used_disks;
 
                        if (!sp)
                                continue;
@@ -5678,6 +5679,28 @@ static void imsm_process_update(struct supertype *st,
                                memcpy(newmap, oldmap, sizeof_imsm_map(oldmap));
                        }
 
+                       /* calculate new size
+                        */
+                       used_disks = imsm_num_data_members(newdev, 0);
+                       if (used_disks) {
+                               unsigned long long array_blocks;
+
+                               array_blocks =
+                                       newmap->blocks_per_member
+                                       * used_disks;
+                               /* round array size down to closest MB
+                                */
+                               array_blocks = (array_blocks
+                                               >> SECT_PER_MB_SHIFT)
+                                       << SECT_PER_MB_SHIFT;
+                               newdev->size_low =
+                                       __cpu_to_le32(
+                                               (__u32)array_blocks);
+                               newdev->size_high =
+                                       __cpu_to_le32(
+                                               (__u32)(array_blocks >> 32));
+                       }
+
                        sp = (void **)id->dev;
                        id->dev = newdev;
                        *sp = tofree;