diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-07-11 19:27:31 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-07-11 19:27:31 -0400 |
commit | 736603ab297506f4396cb5af592004499950fcfd (patch) | |
tree | 80d1f84702e1bfaca5d60482540b8294acd30bd3 | |
parent | 4db9c54a53135b7c1c1f403f1aeaf9fc0d7738b8 (diff) |
jbd2: Add commit time into the commit block
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>
-rw-r--r-- | fs/jbd2/commit.c | 3 | ||||
-rw-r--r-- | 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 a2ed72f7ceee..92b6ac3df8ab 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -112,6 +112,7 @@ static int journal_submit_commit_record(journal_t *journal, | |||
112 | struct buffer_head *bh; | 112 | struct buffer_head *bh; |
113 | int ret; | 113 | int ret; |
114 | int barrier_done = 0; | 114 | int barrier_done = 0; |
115 | struct timespec now = current_kernel_time(); | ||
115 | 116 | ||
116 | if (is_journal_aborted(journal)) | 117 | if (is_journal_aborted(journal)) |
117 | return 0; | 118 | return 0; |
@@ -126,6 +127,8 @@ static int journal_submit_commit_record(journal_t *journal, | |||
126 | tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); | 127 | tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); |
127 | tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK); | 128 | tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK); |
128 | tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid); | 129 | tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid); |
130 | tmp->h_commit_sec = cpu_to_be64(now.tv_sec); | ||
131 | tmp->h_commit_nsec = cpu_to_be32(now.tv_nsec); | ||
129 | 132 | ||
130 | if (JBD2_HAS_COMPAT_FEATURE(journal, | 133 | if (JBD2_HAS_COMPAT_FEATURE(journal, |
131 | JBD2_FEATURE_COMPAT_CHECKSUM)) { | 134 | JBD2_FEATURE_COMPAT_CHECKSUM)) { |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index d147f0f90360..ec9cadf58227 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -168,6 +168,8 @@ struct commit_header { | |||
168 | unsigned char h_chksum_size; | 168 | unsigned char h_chksum_size; |
169 | unsigned char h_padding[2]; | 169 | unsigned char h_padding[2]; |
170 | __be32 h_chksum[JBD2_CHECKSUM_BYTES]; | 170 | __be32 h_chksum[JBD2_CHECKSUM_BYTES]; |
171 | __be64 h_commit_sec; | ||
172 | __be32 h_commit_nsec; | ||
171 | }; | 173 | }; |
172 | 174 | ||
173 | /* | 175 | /* |