aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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
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')
-rw-r--r--fs/btrfs/extent_io.c23
-rw-r--r--fs/btrfs/file.c4
-rw-r--r--fs/btrfs/inode.c12
3 files changed, 37 insertions, 2 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;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 412ab4a26382..388ac397c2c8 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -886,7 +886,11 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
886#ifdef REMOVE_SUID_PATH 886#ifdef REMOVE_SUID_PATH
887 err = remove_suid(&file->f_path); 887 err = remove_suid(&file->f_path);
888#else 888#else
889# if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
890 err = file_remove_suid(file);
891# else
889 err = remove_suid(fdentry(file)); 892 err = remove_suid(fdentry(file));
893# endif
890#endif 894#endif
891 if (err) 895 if (err)
892 goto out_nolock; 896 goto out_nolock;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7af8be076ee5..c4afa9d78da9 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3293,7 +3293,9 @@ void btrfs_destroy_inode(struct inode *inode)
3293 kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); 3293 kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
3294} 3294}
3295 3295
3296#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23) 3296#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
3297static void init_once(void *foo)
3298#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
3297static void init_once(struct kmem_cache * cachep, void *foo) 3299static void init_once(struct kmem_cache * cachep, void *foo)
3298#else 3300#else
3299static void init_once(void * foo, struct kmem_cache * cachep, 3301static void init_once(void * foo, struct kmem_cache * cachep,
@@ -3321,7 +3323,9 @@ void btrfs_destroy_cachep(void)
3321 3323
3322struct kmem_cache *btrfs_cache_create(const char *name, size_t size, 3324struct kmem_cache *btrfs_cache_create(const char *name, size_t size,
3323 unsigned long extra_flags, 3325 unsigned long extra_flags,
3324#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23) 3326#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
3327 void (*ctor)(void *)
3328#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
3325 void (*ctor)(struct kmem_cache *, void *) 3329 void (*ctor)(struct kmem_cache *, void *)
3326#else 3330#else
3327 void (*ctor)(void *, struct kmem_cache *, 3331 void (*ctor)(void *, struct kmem_cache *,
@@ -3561,8 +3565,12 @@ static int btrfs_set_page_dirty(struct page *page)
3561 return __set_page_dirty_nobuffers(page); 3565 return __set_page_dirty_nobuffers(page);
3562} 3566}
3563 3567
3568#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
3569static int btrfs_permission(struct inode *inode, int mask)
3570#else
3564static int btrfs_permission(struct inode *inode, int mask, 3571static int btrfs_permission(struct inode *inode, int mask,
3565 struct nameidata *nd) 3572 struct nameidata *nd)
3573#endif
3566{ 3574{
3567 if (btrfs_test_flag(inode, READONLY) && (mask & MAY_WRITE)) 3575 if (btrfs_test_flag(inode, READONLY) && (mask & MAY_WRITE))
3568 return -EACCES; 3576 return -EACCES;