All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: linux-btrfs@vger.kernel.org, jens.axboe@oracle.com
Subject: Re: [patch]btrfs: finish read pages in the order they are submitted
Date: Wed, 3 Feb 2010 13:18:45 -0500	[thread overview]
Message-ID: <20100203181845.GE22119@think> (raw)
In-Reply-To: <20100203074511.GA26548@sli10-desk.sh.intel.com>

On Wed, Feb 03, 2010 at 03:45:11PM +0800, Shaohua Li wrote:
> the endio is done at reverse order of bio vectors. That means for a sequential
> read, the page first submitted will finish last in a bio. Considering we will
> do checksum (making cache hot) for every page, this does introduce delay (and
> chance to squeeze cache used soon) for pages submitted at the begining. I
> don't observe obvious performance difference with below patch at my simple test,
> but seems more natural to finish read in the order they are submitted.

Interesting, I wonder if we'd be able to see this on a higher throughput
system.  Jens, care to give it a shot (patch below)?

-chris


Signed-off-by: Shaohua Li <shaohua.li@intel.com>

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 96577e8..4df0c56 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1750,7 +1750,8 @@ static void end_bio_extent_writepage(struct bio *bio, int err)
 static void end_bio_extent_readpage(struct bio *bio, int err)
 {
 	int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
-	struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
+	struct bio_vec *bvec_end = bio->bi_io_vec + bio->bi_vcnt - 1;
+	struct bio_vec *bvec = bio->bi_io_vec;
 	struct extent_io_tree *tree;
 	u64 start;
 	u64 end;
@@ -1773,7 +1774,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
 		else
 			whole_page = 0;
 
-		if (--bvec >= bio->bi_io_vec)
+		if (++bvec <= bvec_end)
 			prefetchw(&bvec->bv_page->flags);
 
 		if (uptodate && tree->ops && tree->ops->readpage_end_io_hook) {
@@ -1818,7 +1819,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
 			}
 			check_page_locked(tree, page);
 		}
-	} while (bvec >= bio->bi_io_vec);
+	} while (bvec <= bvec_end);
 
 	bio_put(bio);
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-02-03 18:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03  7:45 [patch]btrfs: finish read pages in the order they are submitted Shaohua Li
2010-02-03 18:18 ` Chris Mason [this message]
2010-02-08 10:59   ` Jens Axboe
2010-02-08 11:44     ` Jens Axboe

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=20100203181845.GE22119@think \
    --to=chris.mason@oracle.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=shaohua.li@intel.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.