]> www.infradead.org Git - linux.git/commitdiff
jbd2: remove unnecessary "should_sleep" in kjournald2
authorKemeng Shi <shikemeng@huaweicloud.com>
Tue, 14 May 2024 11:24:38 +0000 (19:24 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 27 Jun 2024 14:20:26 +0000 (10:20 -0400)
We only need to sleep if no running transaction is expired. Simply remove
unnecessary "should_sleep".

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20240514112438.1269037-10-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/jbd2/journal.c

index c7869b187380512cd1b4a0867a04c38b1677cf87..8d782a88aee1079bbd2ff5a90eceb67be0722860 100644 (file)
@@ -220,15 +220,12 @@ loop:
                 * so we don't sleep
                 */
                DEFINE_WAIT(wait);
-               int should_sleep = 1;
 
                prepare_to_wait(&journal->j_wait_commit, &wait,
                                TASK_INTERRUPTIBLE);
                transaction = journal->j_running_transaction;
-               if (transaction && time_after_eq(jiffies,
-                                               transaction->t_expires))
-                       should_sleep = 0;
-               if (should_sleep) {
+               if (transaction == NULL ||
+                   time_before(jiffies, transaction->t_expires)) {
                        write_unlock(&journal->j_state_lock);
                        schedule();
                        write_lock(&journal->j_state_lock);