From 05b9274a1b3ccfb767600a500b19eb27f2b0db50 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 4 May 2011 13:47:43 +1000 Subject: [PATCH] FORMAT CHANGE add timestamp to group_head in write cluster This allows exact preservation of time stamp during roll forward Signed-off-by: NeilBrown --- include/lafs/layout.h | 3 +++ lib/lafs_cluster_flush.c | 1 + lib/lafs_print_cluster.c | 1 + 3 files changed, 5 insertions(+) diff --git a/include/lafs/layout.h b/include/lafs/layout.h index 36a3a42..2e7fb63 100644 --- a/include/lafs/layout.h +++ b/include/lafs/layout.h @@ -81,6 +81,9 @@ struct miniblock { struct group_head { u32 inum; u32 fsnum; + u64 timestamp; /* If non-zero, the ctime and mtime + * of the file should be set to this. + */ u16 truncatenum_and_flag; u16 group_size_words; /* 4byte words */ union { diff --git a/lib/lafs_cluster_flush.c b/lib/lafs_cluster_flush.c index ac31718..7118900 100644 --- a/lib/lafs_cluster_flush.c +++ b/lib/lafs_cluster_flush.c @@ -147,6 +147,7 @@ static void cluster_addhead(struct lafs_cluster *wc, struct lafs_ino *ino, *headstart = gh; gh->inum = __cpu_to_le32(ino->inum); gh->fsnum = __cpu_to_le32(ino->filesys->inum); + gh->timestamp = 0; tnf = ((ino->generation<<8) | (ino->trunc_gen & 0xff)) & 0x7fff; if (cnum) diff --git a/lib/lafs_print_cluster.c b/lib/lafs_print_cluster.c index c1e4124..bddf1d8 100644 --- a/lib/lafs_print_cluster.c +++ b/lib/lafs_print_cluster.c @@ -63,6 +63,7 @@ void lafs_print_cluster(struct cluster_head *head, int blocksize, printf(" Group[%d]:\n", i); printf(" Inum : %d\n", (int)le32_to_cpu(gh->inum)); printf(" FSnum : %d\n", (int)le32_to_cpu(gh->fsnum)); + printf(" Tstamp : %llu\n", (unsigned long long)__le64_to_cpu(gh->timestamp)); printf(" Flag : %s\n", (__le16_to_cpu(gh->truncatenum_and_flag) & 0x8000) ? "old":"new"); printf(" TRnum : %d\n", (int)__le16_to_cpu(gh->truncatenum_and_flag) & 0x7fff); printf(" Size : %d words\n", (int)__le16_to_cpu(gh->group_size_words)); -- 2.43.0