From: Jan Kara <jack@suse.cz>
To: 丁定华 <dingdinghua85@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-ext4@vger.kernel.org
Subject: Re: Should we discard jbddirty bit if BH_Freed is set?
Date: Tue, 2 Feb 2010 23:02:01 +0100 [thread overview]
Message-ID: <20100202220200.GM7056@quack.suse.cz> (raw)
In-Reply-To: <7bb361261001292241t7dda80d8sc5f467677ad34954@mail.gmail.com>
> From eb6567de576ac4a9337c3971a2d0549af64e15f0 Mon Sep 17 00:00:00 2001
> From: dingdinghua <dingdinghua@nrchpc.ac.cn>
> Date: Sat, 30 Jan 2010 14:23:28 +0800
> Subject: [PATCH] Jbd2: delay discarding buffers in journal_unmap_buffer
>
> We should delay discarding buffers until we know that "add to orphan"
> operation has definitely been committed, otherwise the log space of
> committing transation may be freed and reused before truncate get
> committed, updates may get lost if crash happens.
Thanks for the patch. For us to be able to merge the patch, we need a
Signed-off-by signature from you. Please add it in the next round of
submission.
> diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
> index 1bc74b6..c5d1c7c 100644
> --- a/fs/jbd2/commit.c
> +++ b/fs/jbd2/commit.c
> @@ -936,8 +936,10 @@ restart_loop:
> * behind for writeback and gets reallocated for another
> * use in a different page. */
> if (buffer_freed(bh)) {
> - clear_buffer_freed(bh);
> - clear_buffer_jbddirty(bh);
> + if (!jh->b_next_transaction) {
> + clear_buffer_freed(bh);
> + clear_buffer_jbddirty(bh);
> + }
> }
When can merge the 'if' here. Also the comment above this code
needs updating after your change.
> if (buffer_jbddirty(bh)) {
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index a051270..0d019f1 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -1788,11 +1788,8 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
> * running transaction if that is set, but nothing
> * else. */
> set_buffer_freed(bh);
> - if (jh->b_next_transaction) {
> - J_ASSERT(jh->b_next_transaction ==
> - journal->j_running_transaction);
> - jh->b_next_transaction = NULL;
> - }
> + if (journal->j_running_transaction && buffer_jbddirty(bh))
> + jh->b_next_transaction = journal->j_running_transaction;
Also here you have to update the comment above set_buffer_freed to match
the new reality.
Otherwise I'm fine with the patch.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2010-02-02 22:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <7bb361261001261832wb4f9ac2u96fdb6460aa45fa2@mail.gmail.com>
2010-01-27 12:23 ` Should we discard jbddirty bit if BH_Freed is set? Jan Kara
2010-01-28 1:23 ` 丁定华
2010-01-28 12:53 ` Jan Kara
2010-01-29 1:43 ` 丁定华
2010-01-30 6:41 ` 丁定华
2010-02-02 22:02 ` Jan Kara [this message]
2010-01-27 2:39 丁定华
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=20100202220200.GM7056@quack.suse.cz \
--to=jack@suse.cz \
--cc=dingdinghua85@gmail.com \
--cc=linux-ext4@vger.kernel.org \
/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 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).