From patchwork Wed Mar 17 13:31:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Piggin X-Patchwork-Id: 86334 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2HDVDir031028 for ; Wed, 17 Mar 2010 13:31:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754866Ab0CQNbJ (ORCPT ); Wed, 17 Mar 2010 09:31:09 -0400 Received: from cantor.suse.de ([195.135.220.2]:43602 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754911Ab0CQNbI (ORCPT ); Wed, 17 Mar 2010 09:31:08 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 4D2CB457F0; Wed, 17 Mar 2010 14:31:07 +0100 (CET) Received: by laptop.local0.net (Postfix, from userid 1000) id C0B9429866; Thu, 18 Mar 2010 00:31:04 +1100 (EST) Date: Thu, 18 Mar 2010 00:31:04 +1100 From: Nick Piggin To: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, Chris Mason Subject: Re: [patch] btrfs: use add_to_page_cache_lru, use __page_cache_alloc Message-ID: <20100317133104.GI2869@laptop> References: <20100317062053.GB2869@laptop> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100317062053.GB2869@laptop> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 17 Mar 2010 13:31:13 +0000 (UTC) Index: linux-2.6/fs/btrfs/compression.c =================================================================== --- linux-2.6.orig/fs/btrfs/compression.c +++ linux-2.6/fs/btrfs/compression.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "compat.h" #include "ctree.h" #include "disk-io.h" @@ -445,7 +444,6 @@ static noinline int add_ra_bio_pages(str unsigned long nr_pages = 0; struct extent_map *em; struct address_space *mapping = inode->i_mapping; - struct pagevec pvec; struct extent_map_tree *em_tree; struct extent_io_tree *tree; u64 end; @@ -461,7 +459,6 @@ static noinline int add_ra_bio_pages(str end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT; - pagevec_init(&pvec, 0); while (last_offset < compressed_end) { page_index = last_offset >> PAGE_CACHE_SHIFT; @@ -478,26 +475,17 @@ static noinline int add_ra_bio_pages(str goto next; } - page = alloc_page(mapping_gfp_mask(mapping) & ~__GFP_FS); + page = __page_cache_alloc(mapping_gfp_mask(mapping) & + ~__GFP_FS); if (!page) break; - page->index = page_index; - /* - * what we want to do here is call add_to_page_cache_lru, - * but that isn't exported, so we reproduce it here - */ - if (add_to_page_cache(page, mapping, - page->index, GFP_NOFS)) { + if (add_to_page_cache_lru(page, mapping, page_index, + GFP_NOFS)) { page_cache_release(page); goto next; } - /* open coding of lru_cache_add, also not exported */ - page_cache_get(page); - if (!pagevec_add(&pvec, page)) - __pagevec_lru_add_file(&pvec); - end = last_offset + PAGE_CACHE_SIZE - 1; /* * at this point, we have a locked page in the page cache @@ -551,8 +539,6 @@ static noinline int add_ra_bio_pages(str next: last_offset += PAGE_CACHE_SIZE; } - if (pagevec_count(&pvec)) - __pagevec_lru_add_file(&pvec); return 0; } Index: linux-2.6/fs/btrfs/extent_io.c =================================================================== --- linux-2.6.orig/fs/btrfs/extent_io.c +++ linux-2.6/fs/btrfs/extent_io.c @@ -2663,33 +2663,21 @@ int extent_readpages(struct extent_io_tr { struct bio *bio = NULL; unsigned page_idx; - struct pagevec pvec; unsigned long bio_flags = 0; - pagevec_init(&pvec, 0); for (page_idx = 0; page_idx < nr_pages; page_idx++) { struct page *page = list_entry(pages->prev, struct page, lru); prefetchw(&page->flags); list_del(&page->lru); - /* - * what we want to do here is call add_to_page_cache_lru, - * but that isn't exported, so we reproduce it here - */ - if (!add_to_page_cache(page, mapping, + if (add_to_page_cache_lru(page, mapping, page->index, GFP_KERNEL)) { - - /* open coding of lru_cache_add, also not exported */ - page_cache_get(page); - if (!pagevec_add(&pvec, page)) - __pagevec_lru_add_file(&pvec); - __extent_read_full_page(tree, page, get_extent, - &bio, 0, &bio_flags); + page_cache_release(page); + continue; } - page_cache_release(page); + __extent_read_full_page(tree, page, get_extent, + &bio, 0, &bio_flags); } - if (pagevec_count(&pvec)) - __pagevec_lru_add_file(&pvec); BUG_ON(!list_empty(pages)); if (bio) submit_one_bio(READ, bio, 0, bio_flags);