From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: cmm@us.ibm.com, tytso@mit.edu, sandeen@redhat.com,
frederic.bohe@bull.net
Cc: linux-ext4@vger.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: [PATCH 5/6] ext4: Call journal commit callback without holding j_list_lock
Date: Fri, 31 Oct 2008 22:20:58 +0530 [thread overview]
Message-ID: <1225471859-19718-5-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1225471859-19718-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/jbd2/checkpoint.c | 6 ++++--
fs/jbd2/commit.c | 16 ++++++++++------
include/linux/jbd2.h | 9 +++++++--
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
index 9203c33..cbe7227 100644
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -716,7 +716,8 @@ void __jbd2_journal_insert_checkpoint(struct journal_head *jh,
* Called with j_list_lock held.
*/
-void __jbd2_journal_drop_transaction(journal_t *journal, transaction_t *transaction)
+void ___jbd2_journal_drop_transaction(journal_t *journal,
+ transaction_t *transaction, int free)
{
assert_spin_locked(&journal->j_list_lock);
if (transaction->t_cpnext) {
@@ -742,5 +743,6 @@ void __jbd2_journal_drop_transaction(journal_t *journal, transaction_t *transact
J_ASSERT(journal->j_running_transaction != transaction);
jbd_debug(1, "Dropping transaction %d, all done\n", transaction->t_tid);
- kfree(transaction);
+ if (free)
+ kfree(transaction);
}
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index ebc667b..35f016c 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -338,7 +338,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
int space_left = 0;
int first_tag = 0;
int tag_flag;
- int i;
+ int i, to_free = 0;
int tag_bytes = journal_tag_bytes(journal);
struct buffer_head *cbh = NULL; /* For transactional checksums */
__u32 crc32_sum = ~0;
@@ -974,12 +974,11 @@ void jbd2_journal_commit_transaction(journal_t *journal)
journal->j_committing_transaction = NULL;
spin_unlock(&journal->j_state_lock);
- if (journal->j_commit_callback)
- journal->j_commit_callback(journal, commit_transaction);
-
if (commit_transaction->t_checkpoint_list == NULL &&
commit_transaction->t_checkpoint_io_list == NULL) {
- __jbd2_journal_drop_transaction(journal, commit_transaction);
+ ___jbd2_journal_drop_transaction(journal,
+ commit_transaction, 0);
+ to_free = 1;
} else {
if (journal->j_checkpoint_transactions == NULL) {
journal->j_checkpoint_transactions = commit_transaction;
@@ -998,11 +997,16 @@ void jbd2_journal_commit_transaction(journal_t *journal)
}
spin_unlock(&journal->j_list_lock);
+ if (journal->j_commit_callback)
+ journal->j_commit_callback(journal, commit_transaction);
+
trace_mark(jbd2_end_commit, "dev %s transaction %d head %d",
- journal->j_devname, journal->j_commit_sequence,
+ journal->j_devname, commit_transaction->t_tid,
journal->j_tail_sequence);
jbd_debug(1, "JBD: commit %d complete, head %d\n",
journal->j_commit_sequence, journal->j_tail_sequence);
+ if (to_free)
+ kfree(commit_transaction);
wake_up(&journal->j_wait_done_commit);
}
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 973db89..0ff7209 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1146,8 +1146,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
int jbd2_log_do_checkpoint(journal_t *journal);
void __jbd2_log_wait_for_space(journal_t *journal);
-extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);
-extern int jbd2_cleanup_journal_tail(journal_t *);
+extern void ___jbd2_journal_drop_transaction(journal_t *, transaction_t *, int);
+extern int jbd2_cleanup_journal_tail(journal_t *);
/* Debugging code only: */
@@ -1217,6 +1217,11 @@ static inline int jbd_space_needed(journal_t *journal)
t_outstanding_credits;
return nblocks;
}
+static inline void __jbd2_journal_drop_transaction(journal_t *journal,
+ transaction_t *transaction)
+{
+ return ___jbd2_journal_drop_transaction(journal, transaction, 1);
+}
/*
* Definitions which augment the buffer_head layer
--
1.6.0.3.514.g2f91b
next prev parent reply other threads:[~2008-10-31 16:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-31 16:50 [PATCH 1/6] ext4: Add blocks added during resize to bitmap Aneesh Kumar K.V
2008-10-31 16:50 ` [PATCH 2/6] ext4: Use EXT4_GROUP_INFO_NEED_INIT_BIT during resize Aneesh Kumar K.V
2008-10-31 16:50 ` [PATCH 3/6] ext4: cleanup mballoc header files Aneesh Kumar K.V
2008-10-31 16:50 ` [PATCH 4/6] ext4: sparse annotate the group info semaphore Aneesh Kumar K.V
2008-10-31 16:50 ` Aneesh Kumar K.V [this message]
2008-10-31 16:50 ` [PATCH 6/6] ext4: don't use the block freed but not yet committed during buddy initialization Aneesh Kumar K.V
2008-11-03 2:43 ` Theodore Tso
2008-11-03 2:42 ` [PATCH 5/6] ext4: Call journal commit callback without holding j_list_lock Theodore Tso
2008-11-03 2:33 ` [PATCH 1/6] ext4: Add blocks added during resize to bitmap 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=1225471859-19718-5-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=cmm@us.ibm.com \
--cc=frederic.bohe@bull.net \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--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.