All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mingming Cao <cmm@us.ibm.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH, RFC] jbd2: Add commit time into the commit block
Date: Tue, 25 Mar 2008 11:57:49 -0700	[thread overview]
Message-ID: <1206471469.3617.5.camel@localhost.localdomain> (raw)
In-Reply-To: <1205629144-25994-1-git-send-email-tytso@mit.edu>

On Sat, 2008-03-15 at 20:59 -0400, Theodore Ts'o wrote:
> 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.
> 
Sounds good. Added to the patch queue after fix the compile error.

Shouldn't this a JBD2 INCOMPAT feature?

> 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);
					~~~~~~~~~~~~~~
					Should be now.ntv_sec, 

Attached is the updated patch.


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

Index: linux-2.6.25-rc6/fs/jbd2/commit.c
===================================================================
--- linux-2.6.25-rc6.orig/fs/jbd2/commit.c	2008-03-25 11:36:37.000000000 -0700
+++ linux-2.6.25-rc6/fs/jbd2/commit.c	2008-03-25 11:50:08.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_be32(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.25-rc6/include/linux/jbd2.h
===================================================================
--- linux-2.6.25-rc6.orig/include/linux/jbd2.h	2008-03-16 16:32:14.000000000 -0700
+++ linux-2.6.25-rc6/include/linux/jbd2.h	2008-03-25 11:46:46.000000000 -0700
@@ -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;
 };
 
 /*




  parent reply	other threads:[~2008-03-25 18:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-03-25 20:38   ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1206471469.3617.5.camel@localhost.localdomain \
    --to=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.