From mboxrd@z Thu Jan 1 00:00:00 1970 From: Franck Bui-Huu Subject: Re: [PATCH take2] do_mpage_readpage(): remove first_logical_block parameter Date: Sun, 30 Nov 2008 11:48:12 +0100 Message-ID: <49326F6C.9060300@gmail.com> References: <492C6017.2070307@gmail.com> <20081125164803.952e9fd9.akpm@linux-foundation.org> <492DABE4.7010709@gmail.com> <20081129012312.b12127c2.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org To: Andrew Morton Return-path: Received: from fk-out-0910.google.com ([209.85.128.189]:47082 "EHLO fk-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751177AbYK3KsV (ORCPT ); Sun, 30 Nov 2008 05:48:21 -0500 Received: by fk-out-0910.google.com with SMTP id 18so2032499fkq.5 for ; Sun, 30 Nov 2008 02:48:19 -0800 (PST) In-Reply-To: <20081129012312.b12127c2.akpm@linux-foundation.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 ? Franck ---8<--- diff --git a/fs/mpage.c b/fs/mpage.c index 74e7f83..ef26eb1 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) +{ + unsigned map_index = map_bh->b_size >> PAGE_CACHE_SHIFT; + + return buffer_boundary(map_bh) && + page->index - map_bh->b_page->index >= map_index; +} + +/* * 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];