dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0068-imsm-support-the-Array-Creation-Time-field-in-metada.patch

2792dd
From e48aed3c81a75fa3f761fb5b84e5d16f2baee709 Mon Sep 17 00:00:00 2001
2792dd
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
2792dd
Date: Tue, 17 Mar 2020 10:20:12 +0100
2792dd
Subject: [RHEL7.9 PATCH 68/77] imsm: support the Array Creation Time field in
2792dd
 metadata
2792dd
2792dd
Also present its value in --examine and --examine --export.
2792dd
2792dd
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
2792dd
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2792dd
---
2792dd
 super-intel.c | 11 +++++++++--
2792dd
 1 file changed, 9 insertions(+), 2 deletions(-)
2792dd
2792dd
diff --git a/super-intel.c b/super-intel.c
2792dd
index 6680df2..8840fff 100644
2792dd
--- a/super-intel.c
2792dd
+++ b/super-intel.c
2792dd
@@ -260,8 +260,9 @@ struct imsm_super {
2792dd
 					 * (starts at 1)
2792dd
 					 */
2792dd
 	__u16 filler1;			/* 0x4E - 0x4F */
2792dd
-#define IMSM_FILLERS 34
2792dd
-	__u32 filler[IMSM_FILLERS];	/* 0x50 - 0xD7 RAID_MPB_FILLERS */
2792dd
+	__u64 creation_time;		/* 0x50 - 0x57 Array creation time */
2792dd
+#define IMSM_FILLERS 32
2792dd
+	__u32 filler[IMSM_FILLERS];	/* 0x58 - 0xD7 RAID_MPB_FILLERS */
2792dd
 	struct imsm_disk disk[1];	/* 0xD8 diskTbl[numDisks] */
2792dd
 	/* here comes imsm_dev[num_raid_devs] */
2792dd
 	/* here comes BBM logs */
2792dd
@@ -2014,6 +2015,7 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
2792dd
 	__u32 sum;
2792dd
 	__u32 reserved = imsm_reserved_sectors(super, super->disks);
2792dd
 	struct dl *dl;
2792dd
+	time_t creation_time;
2792dd
 
2792dd
 	strncpy(str, (char *)mpb->sig, MPB_SIG_LEN);
2792dd
 	str[MPB_SIG_LEN-1] = '\0';
2792dd
@@ -2022,6 +2024,9 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
2792dd
 	printf("    Orig Family : %08x\n", __le32_to_cpu(mpb->orig_family_num));
2792dd
 	printf("         Family : %08x\n", __le32_to_cpu(mpb->family_num));
2792dd
 	printf("     Generation : %08x\n", __le32_to_cpu(mpb->generation_num));
2792dd
+	creation_time = __le64_to_cpu(mpb->creation_time);
2792dd
+	printf("  Creation Time : %.24s\n",
2792dd
+		creation_time ? ctime(&creation_time) : "Unknown");
2792dd
 	printf("     Attributes : ");
2792dd
 	if (imsm_check_attributes(mpb->attributes))
2792dd
 		printf("All supported\n");
2792dd
@@ -2126,6 +2131,7 @@ static void export_examine_super_imsm(struct supertype *st)
2792dd
 	printf("MD_LEVEL=container\n");
2792dd
 	printf("MD_UUID=%s\n", nbuf+5);
2792dd
 	printf("MD_DEVICES=%u\n", mpb->num_disks);
2792dd
+	printf("MD_CREATION_TIME=%llu\n", __le64_to_cpu(mpb->creation_time));
2792dd
 }
2792dd
 
2792dd
 static void detail_super_imsm(struct supertype *st, char *homehost,
2792dd
@@ -5762,6 +5768,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
2792dd
 		sum += __gen_imsm_checksum(mpb);
2792dd
 		mpb->family_num = __cpu_to_le32(sum);
2792dd
 		mpb->orig_family_num = mpb->family_num;
2792dd
+		mpb->creation_time = __cpu_to_le64((__u64)time(NULL));
2792dd
 	}
2792dd
 	super->current_disk = dl;
2792dd
 	return 0;
2792dd
-- 
2792dd
2.7.5
2792dd