aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 99bb385c2982..86e84a8579e3 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -381,7 +381,6 @@ int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
381 381
382 end = min_t(u64, eb->len, PAGE_CACHE_SIZE); 382 end = min_t(u64, eb->len, PAGE_CACHE_SIZE);
383 end = eb->start + end - 1; 383 end = eb->start + end - 1;
384 release_extent_buffer_tail_pages(eb);
385err: 384err:
386 free_extent_buffer(eb); 385 free_extent_buffer(eb);
387out: 386out:
@@ -563,21 +562,21 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags)
563 struct extent_map_tree *map; 562 struct extent_map_tree *map;
564 int ret; 563 int ret;
565 564
566 if (page_count(page) > 3) {
567 /* once for page->private, once for the caller, once
568 * once for the page cache
569 */
570 return 0;
571 }
572 tree = &BTRFS_I(page->mapping->host)->io_tree; 565 tree = &BTRFS_I(page->mapping->host)->io_tree;
573 map = &BTRFS_I(page->mapping->host)->extent_tree; 566 map = &BTRFS_I(page->mapping->host)->extent_tree;
567
574 ret = try_release_extent_state(map, tree, page, gfp_flags); 568 ret = try_release_extent_state(map, tree, page, gfp_flags);
569 if (!ret) {
570 return 0;
571 }
572
573 ret = try_release_extent_buffer(tree, page);
575 if (ret == 1) { 574 if (ret == 1) {
576 invalidate_extent_lru(tree, page_offset(page), PAGE_CACHE_SIZE);
577 ClearPagePrivate(page); 575 ClearPagePrivate(page);
578 set_page_private(page, 0); 576 set_page_private(page, 0);
579 page_cache_release(page); 577 page_cache_release(page);
580 } 578 }
579
581 return ret; 580 return ret;
582} 581}
583 582
@@ -588,7 +587,8 @@ static void btree_invalidatepage(struct page *page, unsigned long offset)
588 extent_invalidatepage(tree, page, offset); 587 extent_invalidatepage(tree, page, offset);
589 btree_releasepage(page, GFP_NOFS); 588 btree_releasepage(page, GFP_NOFS);
590 if (PagePrivate(page)) { 589 if (PagePrivate(page)) {
591 invalidate_extent_lru(tree, page_offset(page), PAGE_CACHE_SIZE); 590 printk("warning page private not zero on page %Lu\n",
591 page_offset(page));
592 ClearPagePrivate(page); 592 ClearPagePrivate(page);
593 set_page_private(page, 0); 593 set_page_private(page, 0);
594 page_cache_release(page); 594 page_cache_release(page);
@@ -1456,7 +1456,6 @@ fail_tree_root:
1456 free_extent_buffer(tree_root->node); 1456 free_extent_buffer(tree_root->node);
1457fail_sys_array: 1457fail_sys_array:
1458fail_sb_buffer: 1458fail_sb_buffer:
1459 extent_io_tree_empty_lru(&BTRFS_I(fs_info->btree_inode)->io_tree);
1460 btrfs_stop_workers(&fs_info->fixup_workers); 1459 btrfs_stop_workers(&fs_info->fixup_workers);
1461 btrfs_stop_workers(&fs_info->workers); 1460 btrfs_stop_workers(&fs_info->workers);
1462 btrfs_stop_workers(&fs_info->endio_workers); 1461 btrfs_stop_workers(&fs_info->endio_workers);
@@ -1705,13 +1704,6 @@ int close_ctree(struct btrfs_root *root)
1705 1704
1706 filemap_write_and_wait(fs_info->btree_inode->i_mapping); 1705 filemap_write_and_wait(fs_info->btree_inode->i_mapping);
1707 1706
1708 extent_io_tree_empty_lru(&fs_info->free_space_cache);
1709 extent_io_tree_empty_lru(&fs_info->block_group_cache);
1710 extent_io_tree_empty_lru(&fs_info->pinned_extents);
1711 extent_io_tree_empty_lru(&fs_info->pending_del);
1712 extent_io_tree_empty_lru(&fs_info->extent_ins);
1713 extent_io_tree_empty_lru(&BTRFS_I(fs_info->btree_inode)->io_tree);
1714
1715 truncate_inode_pages(fs_info->btree_inode->i_mapping, 0); 1707 truncate_inode_pages(fs_info->btree_inode->i_mapping, 0);
1716 1708
1717 btrfs_stop_workers(&fs_info->fixup_workers); 1709 btrfs_stop_workers(&fs_info->fixup_workers);