aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2012-03-09 16:01:49 -0500
committerChris Mason <chris.mason@oracle.com>2012-03-26 16:51:08 -0400
commit3083ee2e18b701122a3b841db83448543a87a583 (patch)
tree0265021499da54e5b4667a041f8b82c6d1a8667e /fs/btrfs/disk-io.c
parent115391d2315239164e400a8259b26392afccf3bd (diff)
Btrfs: introduce free_extent_buffer_stale
Because btrfs cow's we can end up with extent buffers that are no longer necessary just sitting around in memory. So instead of evicting these pages, we could end up evicting things we actually care about. Thus we have free_extent_buffer_stale for use when we are freeing tree blocks. This will make it so that the ref for the eb being in the radix tree is dropped as soon as possible and then is freed when the refcount hits 0 instead of waiting to be released by releasepage. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index bc88649cffb7..0ba055e03eb8 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -923,16 +923,8 @@ static int btree_readpage(struct file *file, struct page *page)
923 923
924static int btree_releasepage(struct page *page, gfp_t gfp_flags) 924static int btree_releasepage(struct page *page, gfp_t gfp_flags)
925{ 925{
926 struct extent_map_tree *map;
927 struct extent_io_tree *tree;
928 int ret;
929
930 if (PageWriteback(page) || PageDirty(page)) 926 if (PageWriteback(page) || PageDirty(page))
931 return 0; 927 return 0;
932
933 tree = &BTRFS_I(page->mapping->host)->io_tree;
934 map = &BTRFS_I(page->mapping->host)->extent_tree;
935
936 /* 928 /*
937 * We need to mask out eg. __GFP_HIGHMEM and __GFP_DMA32 as we're doing 929 * We need to mask out eg. __GFP_HIGHMEM and __GFP_DMA32 as we're doing
938 * slab allocation from alloc_extent_state down the callchain where 930 * slab allocation from alloc_extent_state down the callchain where
@@ -940,11 +932,7 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags)
940 */ 932 */
941 gfp_flags &= ~GFP_SLAB_BUG_MASK; 933 gfp_flags &= ~GFP_SLAB_BUG_MASK;
942 934
943 ret = try_release_extent_state(map, tree, page, gfp_flags); 935 return try_release_extent_buffer(page, gfp_flags);
944 if (!ret)
945 return 0;
946
947 return try_release_extent_buffer(tree, page);
948} 936}
949 937
950static void btree_invalidatepage(struct page *page, unsigned long offset) 938static void btree_invalidatepage(struct page *page, unsigned long offset)