[PATCH 22/34] imsm: update array size information in metadata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---

 super-intel.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index dc4f308..72b6cf5 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -5672,6 +5672,7 @@ static void imsm_process_update(struct supertype *st,
 			/* update one device only
 			 */
 			if (devices_to_reshape) {
+				int used_disks;
 				dprintf("process_update(): modifying "\
 					"subdev: %i\n", id->index);
 				devices_to_reshape--;
@@ -5688,6 +5689,28 @@ static void imsm_process_update(struct supertype *st,
 				 */
 				newmap = get_imsm_map(newdev, 1);
 				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;

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux