aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2008-07-30 16:54:26 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commit0ee0fda06b943d7ef65f3cec50ab9d427a2baf97 (patch)
tree342ac5337dc72cf18b683f7f79b497db98a6062e /fs/btrfs/extent_io.c
parentbcc63abbf3e9bf948a1b0129b3e6120ec7d7f698 (diff)
Btrfs: Add compatibility for kernels >= 2.6.27-rc1
Add a couple of #if's to follow API changes. Signed-off-by: Sven Wegener <sven.wegener@stealer.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
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 5368e3b6eb9..1cf4baba434 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,
mapping = eb->first_page->mapping;
if (!mapping)
return NULL;
+
+ /*
+ * extent_buffer_page is only called after pinning the page
+ * by increasing the reference count. So we know the page must
+ * be in the radix tree.
+ */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
+ rcu_read_lock();
+#else
read_lock_irq(&mapping->tree_lock);
+#endif
p = radix_tree_lookup(&mapping->page_tree, i);
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
+ rcu_read_unlock();
+#else
read_unlock_irq(&mapping->tree_lock);
+#endif
return p;
}
@@ -2843,13 +2858,21 @@ int clear_extent_buffer_dirty(struct extent_io_tree *tree,
}
}
clear_page_dirty_for_io(page);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
+ spin_lock_irq(&page->mapping->tree_lock);
+#else
read_lock_irq(&page->mapping->tree_lock);
+#endif
if (!PageDirty(page)) {
radix_tree_tag_clear(&page->mapping->page_tree,
page_index(page),
PAGECACHE_TAG_DIRTY);
}
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
+ spin_unlock_irq(&page->mapping->tree_lock);
+#else
read_unlock_irq(&page->mapping->tree_lock);
+#endif
unlock_page(page);
}
return 0;