jbd2: Add commit time into the commit block From: "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" --- fs/jbd2/commit.c | 3 +++ include/linux/jbd2.h | 2 ++ 2 files changed, 5 insertions(+) Index: linux-2.6.26-rc9/fs/jbd2/commit.c =================================================================== --- linux-2.6.26-rc9.orig/fs/jbd2/commit.c 2008-07-11 16:04:30.000000000 -0700 +++ linux-2.6.26-rc9/fs/jbd2/commit.c 2008-07-11 16:05:00.000000000 -0700 @@ -112,6 +112,7 @@ static int journal_submit_commit_record( 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( 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_be64(now.tv_sec); + tmp->h_commit_nsec = cpu_to_be32(now.tv_nsec); if (JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM)) { Index: linux-2.6.26-rc9/include/linux/jbd2.h =================================================================== --- linux-2.6.26-rc9.orig/include/linux/jbd2.h 2008-07-11 16:04:30.000000000 -0700 +++ linux-2.6.26-rc9/include/linux/jbd2.h 2008-07-11 16:05:00.000000000 -0700 @@ -168,6 +168,8 @@ struct commit_header { unsigned char h_chksum_size; unsigned char h_padding[2]; __be32 h_chksum[JBD2_CHECKSUM_BYTES]; + __be64 h_commit_sec; + __be32 h_commit_nsec; }; /*