Skip to content

Commit b078553

Browse files
Kemeng Shitytso
authored andcommitted
jbd2: remove unnecessary "should_sleep" in kjournald2
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>
1 parent 136d3e0 commit b078553

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

fs/jbd2/journal.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,12 @@ static int kjournald2(void *arg)
220220
* so we don't sleep
221221
*/
222222
DEFINE_WAIT(wait);
223-
int should_sleep = 1;
224223

225224
prepare_to_wait(&journal->j_wait_commit, &wait,
226225
TASK_INTERRUPTIBLE);
227226
transaction = journal->j_running_transaction;
228-
if (transaction && time_after_eq(jiffies,
229-
transaction->t_expires))
230-
should_sleep = 0;
231-
if (should_sleep) {
227+
if (transaction == NULL ||
228+
time_before(jiffies, transaction->t_expires)) {
232229
write_unlock(&journal->j_state_lock);
233230
schedule();
234231
write_lock(&journal->j_state_lock);

0 commit comments

Comments
 (0)