diff options
author | Josef Bacik <jbacik@redhat.com> | 2008-04-17 10:38:59 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-04-17 10:38:59 -0400 |
commit | 9fc7c63a1d6e9920038ced782390a54888ed70a6 (patch) | |
tree | d378eb9089fe1618e180a4bfe38f3fc6d4d1a6c5 /fs/jbd2/commit.c | |
parent | 33ae0cdd3eaba219e7c2f0647b6db4be540e2130 (diff) |
jbd2: fix the way the b_modified flag is cleared
Currently at the start of a journal commit we loop through all of the buffers
on the committing transaction and clear the b_modified flag (the flag that is
set when a transaction modifies the buffer) under the j_list_lock.
The problem is that everywhere else this flag is modified only under the jbd2
lock buffer flag, so it will race with a running transaction who could
potentially set it, and have it unset by the committing transaction.
This is also a big waste, you can have several thousands of buffers that you
are clearing the modified flag on when you may not need to. This patch
removes this code and instead clears the b_modified flag upon entering
do_get_write_access/journal_get_create_access, so if that transaction does
indeed use the buffer then it will be accounted for properly, and if it does
not then we know we didn't use it.
That will be important for the next patch in this series. Tested thoroughly
by myself using postmark/iozone/bonnie++.
Cc: <linux-ext4@vger.kernel.org>
Cc: Jan Kara <jack@ucw.cz>
Signed-off-by: Josef Bacik <jbacik@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index a8173081f831..988fbec1143c 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -520,22 +520,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
520 | jbd_debug (3, "JBD: commit phase 2\n"); | 520 | jbd_debug (3, "JBD: commit phase 2\n"); |
521 | 521 | ||
522 | /* | 522 | /* |
523 | * First, drop modified flag: all accesses to the buffers | ||
524 | * will be tracked for a new trasaction only -bzzz | ||
525 | */ | ||
526 | spin_lock(&journal->j_list_lock); | ||
527 | if (commit_transaction->t_buffers) { | ||
528 | new_jh = jh = commit_transaction->t_buffers->b_tnext; | ||
529 | do { | ||
530 | J_ASSERT_JH(new_jh, new_jh->b_modified == 1 || | ||
531 | new_jh->b_modified == 0); | ||
532 | new_jh->b_modified = 0; | ||
533 | new_jh = new_jh->b_tnext; | ||
534 | } while (new_jh != jh); | ||
535 | } | ||
536 | spin_unlock(&journal->j_list_lock); | ||
537 | |||
538 | /* | ||
539 | * Now start flushing things to disk, in the order they appear | 523 | * Now start flushing things to disk, in the order they appear |
540 | * on the transaction lists. Data blocks go first. | 524 | * on the transaction lists. Data blocks go first. |
541 | */ | 525 | */ |