dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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