[PATCH 3/3] imsm: fix: report aligned component size value

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

 



OROM can create array with chunk size not aligned.
To resolve this problem in mdadm ,metadata handler has to report
component size aligned value for mdadm operations
while metadata value stays unchanged.

Do not correct alignment for raid1 and in error case.

Correction allows check in analyse_change() (Grow.c:905) to pass.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

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

diff --git a/super-intel.c b/super-intel.c
index 9e9d6a9..fd044cb 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1745,6 +1745,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
 	struct imsm_map *map_to_analyse = map;
 	struct dl *dl;
 	char *devname;
+	unsigned int component_size_alligment;
 	int map_disks = info->array.raid_disks;
 
 	if (prev_map)
@@ -1824,6 +1825,21 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
 	info->data_offset	  = __le32_to_cpu(map_to_analyse->pba_of_lba0);
 	info->component_size	  =
 		__le32_to_cpu(map_to_analyse->blocks_per_member);
+
+	/* check component size aligment
+	 */
+	component_size_alligment =
+		info->component_size % (info->array.chunk_size/512);
+
+	if (component_size_alligment &&
+	    (info->array.level != 1) && (info->array.level != UnSet)) {
+		dprintf("imsm: reported component size alligned from %llu ",
+			info->component_size);
+		info->component_size -= component_size_alligment;
+		dprintf("to %llu (%i).\n",
+			info->component_size, component_size_alligment);
+	}
+
 	memset(info->uuid, 0, sizeof(info->uuid));
 	info->recovery_start = MaxSector;
 

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