提交 2db04966 编写于 作者: D David Woodhouse 提交者: Chris Mason

Btrfs: Change TestSetPageLocked() to trylock_page()

Add backwards compatibility in compat.h
Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
---
 compat.h    |    3 +++
 extent_io.c |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 5036f538
#ifndef _COMPAT_H_ #ifndef _COMPAT_H_
#define _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. * Even if AppArmor isn't enabled, it still has different prototypes.
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/pagevec.h> #include <linux/pagevec.h>
#include "extent_io.h" #include "extent_io.h"
#include "extent_map.h" #include "extent_map.h"
#include "compat.h"
/* temporary define until extent_map moves out of btrfs */ /* temporary define until extent_map moves out of btrfs */
struct kmem_cache *btrfs_cache_create(const char *name, size_t size, 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, ...@@ -3055,7 +3056,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
for (i = start_i; i < num_pages; i++) { for (i = start_i; i < num_pages; i++) {
page = extent_buffer_page(eb, i); page = extent_buffer_page(eb, i);
if (!wait) { if (!wait) {
if (TestSetPageLocked(page)) if (!trylock_page(page))
goto unlock_exit; goto unlock_exit;
} else { } else {
lock_page(page); lock_page(page);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册