Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210610112440.3438139-5-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

Zhang Yi and committed by
Theodore Ts'o
214eb5a4 235d6806

+2 -11
+2 -11
fs/jbd2/checkpoint.c
··· 91 91 int ret = 0; 92 92 struct buffer_head *bh = jh2bh(jh); 93 93 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)) { 96 95 JBUFFER_TRACE(jh, "remove from checkpoint list"); 97 96 ret = __jbd2_journal_remove_checkpoint(jh) + 1; 98 97 } ··· 227 228 * OK, we need to start writing disk blocks. Take one transaction 228 229 * and write it. 229 230 */ 230 - result = 0; 231 231 spin_lock(&journal->j_list_lock); 232 232 if (!journal->j_checkpoint_transactions) 233 233 goto out; ··· 293 295 goto restart; 294 296 } 295 297 if (!buffer_dirty(bh)) { 296 - if (unlikely(buffer_write_io_error(bh)) && !result) 297 - result = -EIO; 298 298 BUFFER_TRACE(bh, "remove from checkpoint"); 299 299 if (__jbd2_journal_remove_checkpoint(jh)) 300 300 /* The transaction was released; we're done */ ··· 352 356 spin_lock(&journal->j_list_lock); 353 357 goto restart2; 354 358 } 355 - if (unlikely(buffer_write_io_error(bh)) && !result) 356 - result = -EIO; 357 359 358 360 /* 359 361 * Now in whatever state the buffer currently is, we ··· 363 369 } 364 370 out: 365 371 spin_unlock(&journal->j_list_lock); 366 - if (result < 0) 367 - jbd2_journal_abort(journal, result); 368 - else 369 - result = jbd2_cleanup_journal_tail(journal); 372 + result = jbd2_cleanup_journal_tail(journal); 370 373 371 374 return (result < 0) ? result : 0; 372 375 }