All of lore.kernel.org
 help / color / mirror / Atom feed
From: yangerkun <yangerkun@huawei.com>
To: <tytso@mit.edu>, <jack@suse.cz>
Cc: <linux-ext4@vger.kernel.org>, <yangerkun@huawei.com>,
	<yukuai3@huawei.com>
Subject: [PATCH 1/2] ext4: avoid recheck extent for EXT4_EX_FORCE_CACHE
Date: Sat, 4 Sep 2021 12:49:45 +0800	[thread overview]
Message-ID: <20210904044946.2102404-2-yangerkun@huawei.com> (raw)
In-Reply-To: <20210904044946.2102404-1-yangerkun@huawei.com>

Buffer with verified means that it has been checked before. No need
verify and call set_buffer_verified again.

Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 fs/ext4/extents.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index cbf37b2cf871..8559e288472f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -505,13 +505,16 @@ __read_extent_tree_block(const char *function, unsigned int line,
 		if (err < 0)
 			goto errout;
 	}
-	if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE))
-		return bh;
-	err = __ext4_ext_check(function, line, inode,
-			       ext_block_hdr(bh), depth, pblk);
-	if (err)
-		goto errout;
-	set_buffer_verified(bh);
+	if (buffer_verified(bh)) {
+		if (!(flags & EXT4_EX_FORCE_CACHE))
+			return bh;
+	} else {
+		err = __ext4_ext_check(function, line, inode,
+				       ext_block_hdr(bh), depth, pblk);
+		if (err)
+			goto errout;
+		set_buffer_verified(bh);
+	}
 	/*
 	 * If this is a leaf block, cache all of its entries
 	 */
-- 
2.31.1


  reply	other threads:[~2021-09-04  4:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04  4:49 [PATCH 0/2] bugfix for read_extent_tree_block yangerkun
2021-09-04  4:49 ` yangerkun [this message]
2021-10-01  9:04   ` [PATCH 1/2] ext4: avoid recheck extent for EXT4_EX_FORCE_CACHE Jan Kara
2021-09-04  4:49 ` [PATCH 2/2] ext4: check magic even the extent block bh is verified yangerkun
2021-10-01  9:18   ` Jan Kara
2021-10-01 14:09     ` Theodore Ts'o
2021-10-14  7:21       ` yangerkun
2021-10-25  1:10         ` yangerkun
2021-10-08  1:38     ` yangerkun
2021-09-24  9:32 ` [PATCH 0/2] bugfix for read_extent_tree_block yangerkun

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=20210904044946.2102404-2-yangerkun@huawei.com \
    --to=yangerkun@huawei.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yukuai3@huawei.com \
    /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.