xfs
[Top] [All Lists]

[PATCH] jbd2: Optimize jbd2_log_do_checkpoint() a bit

To: linux-fsdevel@xxxxxxxxxxxxxxx
Subject: [PATCH] jbd2: Optimize jbd2_log_do_checkpoint() a bit
From: Jan Kara <jack@xxxxxxx>
Date: Fri, 10 Oct 2014 16:23:24 +0200
Cc: linux-ext4@xxxxxxxxxxxxxxx, Dave Chinner <david@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, cluster-devel@xxxxxxxxxx, Steven Whitehouse <swhiteho@xxxxxxxxxx>, Mark Fasheh <mfasheh@xxxxxxxx>, Joel Becker <jlbec@xxxxxxxxxxxx>, ocfs2-devel@xxxxxxxxxxxxxx, reiserfs-devel@xxxxxxxxxxxxxxx, Jeff Mahoney <jeffm@xxxxxxx>, Dave Kleikamp <shaggy@xxxxxxxxxx>, jfs-discussion@xxxxxxxxxxxxxxxxxxxxx, tytso@xxxxxxx, viro@xxxxxxxxxxxxxxxxxx, Jan Kara <jack@xxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1412951028-4085-1-git-send-email-jack@xxxxxxx>
References: <1412951028-4085-1-git-send-email-jack@xxxxxxx>
When we discover written out buffer in transaction checkpoint list we
don't have to recheck validity of a transaction. Either this is the last
buffer in a transaction - and then we are done - or this isn't and then
we can just take another buffer from the checkpoint list without
dropping j_list_lock.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 fs/jbd2/checkpoint.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
index 993a187527f3..3722e2e53638 100644
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -343,12 +343,15 @@ restart:
                if (!buffer_dirty(bh)) {
                        if (unlikely(buffer_write_io_error(bh)) && !result)
                                result = -EIO;
-                       get_bh(bh);
                        BUFFER_TRACE(bh, "remove from checkpoint");
-                       __jbd2_journal_remove_checkpoint(jh);
-                       spin_unlock(&journal->j_list_lock);
-                       __brelse(bh);
-                       goto retry;
+                       if (__jbd2_journal_remove_checkpoint(jh)) {
+                               /*
+                                * This was the last buffer attached to the
+                                * transaction. We are done.
+                                */
+                               goto out;
+                       }
+                       continue;
                }
                /*
                 * Important: we are about to write the buffer, and
-- 
1.8.1.4

<Prev in Thread] Current Thread [Next in Thread>