linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH, RFC] jbd2: Add commit time into the commit block
@ 2008-03-16  0:59 Theodore Ts'o
  2008-03-16  1:23 ` Andreas Dilger
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Theodore Ts'o @ 2008-03-16  0:59 UTC (permalink / raw)
  To: linux-ext4; +Cc: Theodore Ts'o

Carlo Wood has demonstrated that it's possible to recover deleted
files from the journal.  Something that will make this easier is if we
can put the time of the commit into commit block.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 fs/jbd2/commit.c     |    3 +++
 include/linux/jbd2.h |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index e013978..7c5fbd5 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -112,6 +112,7 @@ static int journal_submit_commit_record(journal_t *journal,
 	struct buffer_head *bh;
 	int ret;
 	int barrier_done = 0;
+	struct timespec now = current_kernel_time();
 
 	if (is_journal_aborted(journal))
 		return 0;
@@ -126,6 +127,8 @@ static int journal_submit_commit_record(journal_t *journal,
 	tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
 	tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK);
 	tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
+	tmp->h_commit_sec = cpu_to_be32(now->tv_sec);
+	tmp->h_commit_nsec = cpu_to_be32(now->tv_nsec);
 
 	if (JBD2_HAS_COMPAT_FEATURE(journal,
 				    JBD2_FEATURE_COMPAT_CHECKSUM)) {
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 2cbf6fd..7cbeb2b 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -170,6 +170,8 @@ struct commit_header {
 	unsigned char   h_chksum_size;
 	unsigned char 	h_padding[2];
 	__be32 		h_chksum[JBD2_CHECKSUM_BYTES];
+	__be32		h_commit_sec;
+	__be32		h_commit_nsec;
 };
 
 /*
-- 
1.5.4.1.144.gdfee-dirty


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-03-25 20:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-16  0:59 [PATCH, RFC] jbd2: Add commit time into the commit block Theodore Ts'o
2008-03-16  1:23 ` Andreas Dilger
2008-03-16  1:26 ` Andreas Dilger
2008-03-16  3:10   ` Theodore Tso
2008-03-16 15:16     ` Andreas Dilger
2008-03-16 18:52       ` Theodore Tso
2008-03-25 18:57 ` Mingming Cao
2008-03-25 20:38   ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).