 SLES10 doesn't have a read_mapping_page(), but has the infrastructure to
 support it. This patch adds a check.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 Config.make.in                          |    1 +
 Makefile                                |    1 +
 configure.in                            |    6 ++++++
 fs/ocfs2/Makefile                       |    4 ++++
 kapi-compat/include/read_mapping_page.h |   15 +++++++++++++++
 5 files changed, 27 insertions(+)

--- a/Config.make.in	2008-02-02 10:36:28.000000000 -0500
+++ b/Config.make.in	2008-02-02 10:36:30.000000000 -0500
@@ -87,6 +87,7 @@ NO_BLKCNT_T = @NO_BLKCNT_T@
 NO_I_PRIVATE = @NO_I_PRIVATE@
 NO_PAGE_MKWRITE = @NO_PAGE_MKWRITE@
 NO_VFSMOUNT_IN_GET_SB_BDEV = @NO_VFSMOUNT_IN_GET_SB_BDEV@
+NO_READ_MAPPING_PAGE = @NO_READ_MAPPING_PAGE@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
--- a/Makefile	2008-02-02 10:36:26.000000000 -0500
+++ b/Makefile	2008-02-02 10:36:30.000000000 -0500
@@ -30,6 +30,7 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/generic_segment_checks.h \
 	kapi-compat/include/writeback_control.h \
 	kapi-compat/include/blkcnt_t.h \
+	kapi-compat/include/read_mapping_page.h \
 	kapi-compat/include/aiovec.h
 
 PATCH_FILES =
--- a/configure.in	2008-02-02 10:36:29.000000000 -0500
+++ b/configure.in	2008-02-02 10:36:30.000000000 -0500
@@ -377,6 +377,12 @@ OCFS2_CHECK_KERNEL([get_sb_bdev() with 5
   [^	int (\*fill_super)(struct super_block \*, void \*, int));$])
 AC_SUBST(NO_VFSMOUNT_IN_GET_SB_BDEV)
 
+NO_READ_MAPPING_PAGE=
+OCFS2_CHECK_KERNEL([read_mapping_page in pagemap.h], pagemap.h, ,
+  NO_READ_MAPPING_PAGE=yes, [read_mapping_page])
+AC_SUBST(NO_READ_MAPPING_PAGE)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS read_mapping_page.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
--- a/fs/ocfs2/Makefile	2008-02-02 10:36:29.000000000 -0500
+++ b/fs/ocfs2/Makefile	2008-02-02 10:36:30.000000000 -0500
@@ -140,6 +140,10 @@ ifdef NO_VFSMOUNT_IN_GET_SB_BDEV
 EXTRA_CFLAGS += -DNO_VFSMOUNT_IN_GET_SB_BDEV
 endif
 
+ifdef NO_READ_MAPPING_PAGE
+EXTRA_CFLAGS += -DNO_READ_MAPPING_PAGE
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ b/kapi-compat/include/read_mapping_page.h	2008-02-02 10:36:30.000000000 -0500
@@ -0,0 +1,15 @@
+#ifndef KAPI_COMPAT_READ_MAPPING_PAGE_H
+#define KAPI_COMPAT_READ_MAPPING_PAGE_H
+
+#ifdef NO_READ_MAPPING_PAGE
+#include <linux/pagemap.h>
+
+static inline struct page *read_mapping_page(struct address_space *mapping,
+                                             pgoff_t index, void *data)
+{
+	filler_t *filler = (filler_t *)mapping->a_ops->readpage;
+	return read_cache_page(mapping, index, filler, data);
+}
+#endif
+
+#endif



