From: Miao Xie <miaox@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/5] Btrfs: add branch prediction hints in the read page end IO function
Date: Thu, 11 Jul 2013 13:25:37 +0800 [thread overview]
Message-ID: <1373520339-13870-2-git-send-email-miaox@cn.fujitsu.com> (raw)
In-Reply-To: <1373520339-13870-1-git-send-email-miaox@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
fs/btrfs/extent_io.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 4bfbcc5..c9b28cf 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2503,7 +2503,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
spin_lock(&tree->lock);
state = find_first_extent_bit_state(tree, start, EXTENT_LOCKED);
- if (state && state->start == start) {
+ if (likely(state && state->start == start)) {
/*
* take a reference on the state, unlock will drop
* the ref
@@ -2513,7 +2513,8 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
spin_unlock(&tree->lock);
mirror = io_bio->mirror_num;
- if (uptodate && tree->ops && tree->ops->readpage_end_io_hook) {
+ if (likely(uptodate && tree->ops &&
+ tree->ops->readpage_end_io_hook)) {
ret = tree->ops->readpage_end_io_hook(page, start, end,
state, mirror);
if (ret)
@@ -2522,12 +2523,15 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
clean_io_failure(start, page);
}
- if (!uptodate && tree->ops && tree->ops->readpage_io_failed_hook) {
+ if (likely(uptodate))
+ goto readpage_ok;
+
+ if (tree->ops && tree->ops->readpage_io_failed_hook) {
ret = tree->ops->readpage_io_failed_hook(page, mirror);
if (!ret && !err &&
test_bit(BIO_UPTODATE, &bio->bi_flags))
uptodate = 1;
- } else if (!uptodate) {
+ } else {
/*
* The generic bio_readpage_error handles errors the
* following way: If possible, new read requests are
@@ -2548,7 +2552,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
continue;
}
}
-
+readpage_ok:
if (uptodate && tree->track_uptodate) {
set_extent_uptodate(tree, start, end, &cached,
GFP_ATOMIC);
--
1.8.1.4
next prev parent reply other threads:[~2013-07-11 5:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-11 5:25 [PATCH 1/5] Btrfs: remove unnecessary argument of bio_readpage_error() Miao Xie
2013-07-11 5:25 ` Miao Xie [this message]
2013-07-11 14:31 ` [PATCH 2/5] Btrfs: add branch prediction hints in the read page end IO function Chris Mason
2013-07-12 22:19 ` David Sterba
2013-07-11 5:25 ` [PATCH 3/5] Btrfs: don't cache the csum value into the extent state tree Miao Xie
2013-07-11 14:29 ` Chris Mason
2013-07-11 5:25 ` [PATCH 4/5] Btrfs: batch the extent state operation in the end io handle of the read page Miao Xie
2013-07-11 18:56 ` Josef Bacik
2013-07-11 8:05 ` [PATCH 1/5] Btrfs: remove unnecessary argument of bio_readpage_error() Miao Xie
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=1373520339-13870-2-git-send-email-miaox@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).