Btrfs: Change TestSetPageLocked() to trylock_page()
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>
diff --git a/fs/btrfs/compat.h b/fs/btrfs/compat.h
index d39a768..b3349a6 100644
--- a/fs/btrfs/compat.h
+++ b/fs/btrfs/compat.h
@@ -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.