dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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