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

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