All of lore.kernel.org
 help / color / mirror / Atom feed
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH take2] do_mpage_readpage(): remove first_logical_block parameter
Date: Sun, 30 Nov 2008 14:53:34 +0100	[thread overview]
Message-ID: <49329ADE.3000007@gmail.com> (raw)
In-Reply-To: <49326F6C.9060300@gmail.com>

Franck Bui-Huu wrote:
> Andrew Morton wrote:
>> Unfortunately we have a conflict with the already-queued
>> do_mpage_readpage-dont-submit-lots-of-small-bios-on-boundary.patch:
>>
> 
> How about amending this on top of take #2 ?
> 

Actually the version below is better...

		Franck

---8<---

diff --git a/fs/mpage.c b/fs/mpage.c
index 74e7f83..ca33b28 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -157,6 +157,19 @@ map_buffer_to_page(struct page *page, struct buffer_head *bh, int page_block)
 }
 
 /*
+ * 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.
+*/
+static int last_mapped_page(struct buffer_head *map_bh, struct page *page)
+{
+	pgoff_t map_index = map_bh->b_page->index;
+
+	return buffer_boundary(map_bh) &&
+		page->index >= map_index + (map_bh->b_size>>PAGE_CACHE_SHIFT);
+}
+
+/*
  * This is the worker routine which does all the work of mapping the disk
  * blocks and constructs largest possible bios, submits them for IO if the
  * blocks are not contiguous on the disk.
@@ -312,10 +325,7 @@ alloc_new:
 		goto alloc_new;
 	}
 
-	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))
+	if (last_mapped_page(map_bh, page) || 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-11-30 13:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 20:29 [PATCH] do_mpage_readpage(): remove first_logical_block parameter Franck Bui-Huu
2008-11-26  0:48 ` Andrew Morton
2008-11-26  8:03   ` Franck Bui-Huu
2008-11-26 20:04   ` [PATCH take2] " Franck Bui-Huu
2008-11-29  9:23     ` Andrew Morton
2008-11-30 10:48       ` Franck Bui-Huu
2008-11-30 13:53         ` Franck Bui-Huu [this message]

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=49329ADE.3000007@gmail.com \
    --to=vagabon.xyz@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@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 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.