Skip to contentSkip to conversation

imsm: correct offset for 4k disks in --examine output

PATCH In review Oleksandr Shchirskyi 2 participants 4 messages Jun 18, 2021 – Jul 16, 2021 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 imsm: correct offset for 4k disks in --examine output

"Sector Offset" field in Examine output was always printed in 512 byte sectors. Update it to support 4096 sector size.

---
 super-intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
super-intel.c +1 -1
index 54699129..caeb6db3 100644
@@ -1663,7 +1663,7 @@ static void print_imsm_dev(struct intel_super *super,
 		   (unsigned long long)sz * 512 / super->sector_size,
 	       human_size(sz * 512));
 	printf("  Sector Offset : %llu\n",
-		pba_of_lba0(map));
+		pba_of_lba0(map) * 512 / super->sector_size);
 	printf("    Num Stripes : %llu\n",
 		num_data_stripes(map));
 	printf("     Chunk Size : %u KiB",
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/3 Remove Spare drives line from details for external metadata

Arrays with external metadata do not have spare disks directly assigned to volumes; spare disks belong to containers and are moved to arrays when the array is degraded/reshaping. Thus, the display of zero spare disks in volume details is incorrect and can be confusing.

---
 Detail.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Detail.c +2 -1
index cd26fb0f..ad56344f 100644
@@ -548,7 +548,8 @@ int Detail(char *dev, struct context *c)
 			       array.working_disks);
 		if (array.raid_disks) {
 			printf("    Failed Devices : %d\n", array.failed_disks);
-			printf("     Spare Devices : %d\n", array.spare_disks);
+			if (!external)
+				printf("     Spare Devices : %d\n", array.spare_disks);
 		}
 		printf("\n");
 		if (array.level == 5) {
Signature · 1 line
2.27.0
#2 lore raw

PATCH 3/3 Don't associate spares with other arrays during RAID Examine

In reply to Oleksandr Shchirskyi

Spares in imsm belong to containers, not volumes, and must go into a separate container when assembling the RAID.
Remove association spares with other arrays and make Examine print separate containers for spares.
Auto assemble without config file already works like this. So make creating a config file and assembling from it consistent with auto assemble.
With this change, mdadm -Es will add this line to output if spares are found:
ARRAY metadata=imsm UUID=00000000:00000000:00000000:00000000

---
 Examine.c     |  2 +-
 super-intel.c | 74 +++++++++++++--------------------------------------
 2 files changed, 20 insertions(+), 56 deletions(-)
Examine.c +1 -1
index 4381cd56..9574a3cc 100644
@@ -166,7 +166,7 @@ int Examine(struct mddev_dev *devlist,
 			int newline = 0;
 
 			ap->st->ss->brief_examine_super(ap->st, c->verbose > 0);
-			if (ap->spares)
+			if (ap->spares && !ap->st->ss->external)
 				newline += printf("   spares=%d", ap->spares);
 			if (c->verbose > 0) {
 				newline += printf("   devices");
super-intel.c +19 -55

124 lines not on this page · raw message

Signature · 1 line
2.27.0