mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miquel van Smoorenburg <mikevs@xs4all.net>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] do_mpage_readpage: don't submit lots of small bios on boundary
Date: Thu, 23 Oct 2008 18:15:03 +0200	[thread overview]
Message-ID: <20081023161500.GA28181@xs4all.net> (raw)

(not really sure who to put in the Cc list here)

While tracing I/O patterns with blktrace (a great tool) a few
weeks ago I identified a minor issue in fs/mpage.c

[PATCH] do_mpage_readpage: don't submit lots of small bios on boundary

As the comment above mpage_readpages() says, a fs's get_block
function will set BH_Boundary when it maps a block just before
a block for which extra I/O is required.

Since get_block() can map a range of pages, for all these pages
the BH_Boundary flag will be set. But we only need to push what
I/O we have accumulated at the last block of this range.

This makes do_mpage_readpage() send out the largest possible
bio instead of a bunch of page-sized ones in the BH_Boundary case.

Signed-off-by: Miquel van Smoorenburg <mikevs@xs4all.net>

diff -ruN linux-2.6.26.5.orig/fs/mpage.c linux-2.6.26.5/fs/mpage.c
--- linux-2.6.26.5.orig/fs/mpage.c	2008-09-08 19:40:20.000000000 +0200
+++ linux-2.6.26.5/fs/mpage.c	2008-10-23 00:32:11.000000000 +0200
@@ -307,7 +307,10 @@
 		goto alloc_new;
 	}
 
-	if (buffer_boundary(map_bh) || (first_hole != blocks_per_page))
+	relative_block = block_in_file - *first_logical_block;
+	nblocks = map_bh->b_size >> blkbits;
+	if ((buffer_boundary(map_bh) && relative_block == nblocks) ||
+	    (first_hole != blocks_per_page))
 		bio = mpage_bio_submit(READ, bio);
 	else
 		*last_block_in_bio = blocks[blocks_per_page - 1];

                 reply	other threads:[~2008-10-23 16:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20081023161500.GA28181@xs4all.net \
    --to=mikevs@xs4all.net \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®