aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 5368e3b6eb96..1cf4baba4342 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2649,9 +2649,24 @@ static inline struct page *extent_buffer_page(struct extent_buffer *eb,
2649 mapping = eb->first_page->mapping; 2649 mapping = eb->first_page->mapping;
2650 if (!mapping) 2650 if (!mapping)
2651 return NULL; 2651 return NULL;
2652
2653 /*
2654 * extent_buffer_page is only called after pinning the page
2655 * by increasing the reference count. So we know the page must
2656 * be in the radix tree.
2657 */
2658#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
2659 rcu_read_lock();
2660#else
2652 read_lock_irq(&mapping->tree_lock); 2661 read_lock_irq(&mapping->tree_lock);
2662#endif
2653 p = radix_tree_lookup(&mapping->page_tree, i); 2663 p = radix_tree_lookup(&mapping->page_tree, i);
2664
2665#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
2666 rcu_read_unlock();
2667#else
2654 read_unlock_irq(&mapping->tree_lock); 2668 read_unlock_irq(&mapping->tree_lock);
2669#endif
2655 return p; 2670 return p;
2656} 2671}
2657 2672
@@ -2843,13 +2858,21 @@ int clear_extent_buffer_dirty(struct extent_io_tree *tree,
2843 } 2858 }
2844 } 2859 }
2845 clear_page_dirty_for_io(page); 2860 clear_page_dirty_for_io(page);
2861#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
2862 spin_lock_irq(&page->mapping->tree_lock);
2863#else
2846 read_lock_irq(&page->mapping->tree_lock); 2864 read_lock_irq(&page->mapping->tree_lock);
2865#endif
2847 if (!PageDirty(page)) { 2866 if (!PageDirty(page)) {
2848 radix_tree_tag_clear(&page->mapping->page_tree, 2867 radix_tree_tag_clear(&page->mapping->page_tree,
2849 page_index(page), 2868 page_index(page),
2850 PAGECACHE_TAG_DIRTY); 2869 PAGECACHE_TAG_DIRTY);
2851 } 2870 }
2871#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
2872 spin_unlock_irq(&page->mapping->tree_lock);
2873#else
2852 read_unlock_irq(&page->mapping->tree_lock); 2874 read_unlock_irq(&page->mapping->tree_lock);
2875#endif
2853 unlock_page(page); 2876 unlock_page(page);
2854 } 2877 }
2855 return 0; 2878 return 0;