Skip to content

Commit 214eb5a

Browse files
zhangyi089tytso
authored andcommitted
jbd2: remove redundant buffer io error checks
Now that __jbd2_journal_remove_checkpoint() can detect buffer io error and mark journal checkpoint error, then we abort the journal later before updating log tail to ensure the filesystem works consistently. So we could remove other redundant buffer io error checkes. Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 235d680 commit 214eb5a

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

fs/jbd2/checkpoint.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
9191
int ret = 0;
9292
struct buffer_head *bh = jh2bh(jh);
9393

94-
if (jh->b_transaction == NULL && !buffer_locked(bh) &&
95-
!buffer_dirty(bh) && !buffer_write_io_error(bh)) {
94+
if (!jh->b_transaction && !buffer_locked(bh) && !buffer_dirty(bh)) {
9695
JBUFFER_TRACE(jh, "remove from checkpoint list");
9796
ret = __jbd2_journal_remove_checkpoint(jh) + 1;
9897
}
@@ -228,7 +227,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
228227
* OK, we need to start writing disk blocks. Take one transaction
229228
* and write it.
230229
*/
231-
result = 0;
232230
spin_lock(&journal->j_list_lock);
233231
if (!journal->j_checkpoint_transactions)
234232
goto out;
@@ -295,8 +293,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
295293
goto restart;
296294
}
297295
if (!buffer_dirty(bh)) {
298-
if (unlikely(buffer_write_io_error(bh)) && !result)
299-
result = -EIO;
300296
BUFFER_TRACE(bh, "remove from checkpoint");
301297
if (__jbd2_journal_remove_checkpoint(jh))
302298
/* The transaction was released; we're done */
@@ -356,8 +352,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
356352
spin_lock(&journal->j_list_lock);
357353
goto restart2;
358354
}
359-
if (unlikely(buffer_write_io_error(bh)) && !result)
360-
result = -EIO;
361355

362356
/*
363357
* Now in whatever state the buffer currently is, we
@@ -369,10 +363,7 @@ int jbd2_log_do_checkpoint(journal_t *journal)
369363
}
370364
out:
371365
spin_unlock(&journal->j_list_lock);
372-
if (result < 0)
373-
jbd2_journal_abort(journal, result);
374-
else
375-
result = jbd2_cleanup_journal_tail(journal);
366+
result = jbd2_cleanup_journal_tail(journal);
376367

377368
return (result < 0) ? result : 0;
378369
}

0 commit comments

Comments
 (0)