Skip to content

Commit

Permalink
Btrfs: Change TestSetPageLocked() to trylock_page()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Woodhouse authored and Chris Mason committed Sep 25, 2008
1 parent 5036f53 commit 2db0496
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions fs/btrfs/compat.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 2 additions & 1 deletion fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2db0496

Please sign in to comment.