]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Btrfs: Change TestSetPageLocked() to trylock_page()
authorDavid Woodhouse <dwmw2@infradead.org>
Thu, 7 Aug 2008 15:19:43 +0000 (11:19 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:06 +0000 (11:04 -0400)
Add backwards compatibility in compat.h

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
 compat.h    |    3 +++
 extent_io.c |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/compat.h
fs/btrfs/extent_io.c

index d39a768e65ff17c598c8c7801a204fe534b7585c..b3349a66999d20762b407d9dc853cdda908cac74 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _COMPAT_H_
 #define _COMPAT_H_
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,26)
+#define trylock_page(page) (!TestSetPageLocked(page))
+#endif
 
 /*
  * Even if AppArmor isn't enabled, it still has different prototypes.
index 1cf4baba4342a2e5419424da9f0f0fc7cd699e62..f46f88620c709415acd1c4d64fe21bf58a3aa57a 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/pagevec.h>
 #include "extent_io.h"
 #include "extent_map.h"
+#include "compat.h"
 
 /* temporary define until extent_map moves out of btrfs */
 struct kmem_cache *btrfs_cache_create(const char *name, size_t size,
@@ -3055,7 +3056,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
        for (i = start_i; i < num_pages; i++) {
                page = extent_buffer_page(eb, i);
                if (!wait) {
-                       if (TestSetPageLocked(page))
+                       if (!trylock_page(page))
                                goto unlock_exit;
                } else {
                        lock_page(page);