All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Yi <yi.zhang@huawei.com>
To: <linux-ext4@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<jack@suse.cz>, <tytso@mit.edu>
Cc: <adilger.kernel@dilger.ca>, <david@fromorbit.com>,
	<hch@infradead.org>, <yi.zhang@huawei.com>
Subject: [RFC PATCH v4 4/8] jbd2: remove redundant buffer io error checks
Date: Thu, 10 Jun 2021 19:24:36 +0800	[thread overview]
Message-ID: <20210610112440.3438139-5-yi.zhang@huawei.com> (raw)
In-Reply-To: <20210610112440.3438139-1-yi.zhang@huawei.com>

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>
---
 fs/jbd2/checkpoint.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
index d27c10f4502f..75a4f622afaf 100644
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -91,8 +91,7 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
 	int ret = 0;
 	struct buffer_head *bh = jh2bh(jh);
 
-	if (jh->b_transaction == NULL && !buffer_locked(bh) &&
-	    !buffer_dirty(bh) && !buffer_write_io_error(bh)) {
+	if (!jh->b_transaction && !buffer_locked(bh) && !buffer_dirty(bh)) {
 		JBUFFER_TRACE(jh, "remove from checkpoint list");
 		ret = __jbd2_journal_remove_checkpoint(jh) + 1;
 	}
@@ -228,7 +227,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
 	 * OK, we need to start writing disk blocks.  Take one transaction
 	 * and write it.
 	 */
-	result = 0;
 	spin_lock(&journal->j_list_lock);
 	if (!journal->j_checkpoint_transactions)
 		goto out;
@@ -295,8 +293,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
 			goto restart;
 		}
 		if (!buffer_dirty(bh)) {
-			if (unlikely(buffer_write_io_error(bh)) && !result)
-				result = -EIO;
 			BUFFER_TRACE(bh, "remove from checkpoint");
 			if (__jbd2_journal_remove_checkpoint(jh))
 				/* The transaction was released; we're done */
@@ -356,8 +352,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
 			spin_lock(&journal->j_list_lock);
 			goto restart2;
 		}
-		if (unlikely(buffer_write_io_error(bh)) && !result)
-			result = -EIO;
 
 		/*
 		 * Now in whatever state the buffer currently is, we
@@ -369,10 +363,7 @@ int jbd2_log_do_checkpoint(journal_t *journal)
 	}
 out:
 	spin_unlock(&journal->j_list_lock);
-	if (result < 0)
-		jbd2_journal_abort(journal, result);
-	else
-		result = jbd2_cleanup_journal_tail(journal);
+	result = jbd2_cleanup_journal_tail(journal);
 
 	return (result < 0) ? result : 0;
 }
-- 
2.31.1


  parent reply	other threads:[~2021-06-10 11:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 11:24 [RFC PATCH v4 0/8] ext4, jbd2: fix 3 issues about bdev_try_to_free_page() Zhang Yi
2021-06-10 11:24 ` [RFC PATCH v4 1/8] jbd2: remove the out label in __jbd2_journal_remove_checkpoint() Zhang Yi
2021-06-24 14:35   ` Theodore Ts'o
2021-06-10 11:24 ` [RFC PATCH v4 2/8] jbd2: ensure abort the journal if detect IO error when writing original buffer back Zhang Yi
2021-06-24 14:35   ` Theodore Ts'o
2021-06-10 11:24 ` [RFC PATCH v4 3/8] jbd2: don't abort the journal when freeing buffers Zhang Yi
2021-06-24 14:35   ` Theodore Ts'o
2021-06-10 11:24 ` Zhang Yi [this message]
2021-06-24 14:35   ` [RFC PATCH v4 4/8] jbd2: remove redundant buffer io error checks Theodore Ts'o
2021-06-10 11:24 ` [RFC PATCH v4 5/8] jbd2,ext4: add a shrinker to release checkpointed buffers Zhang Yi
2021-06-10 16:12   ` Jan Kara
2021-06-16 22:25   ` [RFC PATCH v4 5/8] jbd2, ext4: " kernel test robot
2021-06-24 14:56   ` [RFC PATCH v4 5/8] jbd2,ext4: " Theodore Ts'o
2021-06-10 11:24 ` [RFC PATCH v4 6/8] jbd2: simplify journal_clean_one_cp_list() Zhang Yi
2021-06-24 14:56   ` Theodore Ts'o
2021-06-10 11:24 ` [RFC PATCH v4 7/8] ext4: remove bdev_try_to_free_page() callback Zhang Yi
2021-06-24 14:56   ` Theodore Ts'o
2021-06-10 11:24 ` [RFC PATCH v4 8/8] fs: remove bdev_try_to_free_page callback Zhang Yi
2021-06-24 14:56   ` Theodore Ts'o
2021-06-17  9:48 ` [RFC PATCH v4 0/8] ext4, jbd2: fix 3 issues about bdev_try_to_free_page() Christoph Hellwig
2021-06-21 15:25   ` Christoph Hellwig
2021-06-22  8:24     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210610112440.3438139-5-yi.zhang@huawei.com \
    --to=yi.zhang@huawei.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.