aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2010-03-17 09:31:04 -0400
committerChris Mason <chris.mason@oracle.com>2010-04-05 14:41:51 -0400
commit28ecb60906e86e74e9ad4ac7e0218d8631e73a94 (patch)
tree7214fa7bfb39f789aa4a78e174e39f61ef101b95 /fs/btrfs/extent_io.c
parent0cad8a1130f77c7c445e3298c0e3593b3c0ef439 (diff)
Btrfs: use add_to_page_cache_lru, use __page_cache_alloc
Pagecache pages should be allocated with __page_cache_alloc, so they obey pagecache memory policies. add_to_page_cache_lru is exported, so it should be used. Benefits over using a private pagevec: neater code, 128 bytes fewer stack used, percpu lru ordering is preserved, and finally don't need to flush pagevec before returning so batching may be shared with other LRU insertions. Signed-off-by: Nick Piggin <npiggin@suse.de>: Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index c99121ac5d6b..fc742e59815e 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2679,33 +2679,20 @@ int extent_readpages(struct extent_io_tree *tree,
2679{ 2679{
2680 struct bio *bio = NULL; 2680 struct bio *bio = NULL;
2681 unsigned page_idx; 2681 unsigned page_idx;
2682 struct pagevec pvec;
2683 unsigned long bio_flags = 0; 2682 unsigned long bio_flags = 0;
2684 2683
2685 pagevec_init(&pvec, 0);
2686 for (page_idx = 0; page_idx < nr_pages; page_idx++) { 2684 for (page_idx = 0; page_idx < nr_pages; page_idx++) {
2687 struct page *page = list_entry(pages->prev, struct page, lru); 2685 struct page *page = list_entry(pages->prev, struct page, lru);
2688 2686
2689 prefetchw(&page->flags); 2687 prefetchw(&page->flags);
2690 list_del(&page->lru); 2688 list_del(&page->lru);
2691 /* 2689 if (!add_to_page_cache_lru(page, mapping,
2692 * what we want to do here is call add_to_page_cache_lru,
2693 * but that isn't exported, so we reproduce it here
2694 */
2695 if (!add_to_page_cache(page, mapping,
2696 page->index, GFP_KERNEL)) { 2690 page->index, GFP_KERNEL)) {
2697
2698 /* open coding of lru_cache_add, also not exported */
2699 page_cache_get(page);
2700 if (!pagevec_add(&pvec, page))
2701 __pagevec_lru_add_file(&pvec);
2702 __extent_read_full_page(tree, page, get_extent, 2691 __extent_read_full_page(tree, page, get_extent,
2703 &bio, 0, &bio_flags); 2692 &bio, 0, &bio_flags);
2704 } 2693 }
2705 page_cache_release(page); 2694 page_cache_release(page);
2706 } 2695 }
2707 if (pagevec_count(&pvec))
2708 __pagevec_lru_add_file(&pvec);
2709 BUG_ON(!list_empty(pages)); 2696 BUG_ON(!list_empty(pages));
2710 if (bio) 2697 if (bio)
2711 submit_one_bio(READ, bio, 0, bio_flags); 2698 submit_one_bio(READ, bio, 0, bio_flags);