 SLES10 still uses max_blocks in DIO get_blocks(). This patch adds a check.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/aops.c   |   10 +++++++++-
 4 files changed, 19 insertions(+), 1 deletion(-)

--- a/Config.make.in	2008-02-02 10:36:31.000000000 -0500
+++ b/Config.make.in	2008-02-02 10:36:32.000000000 -0500
@@ -90,6 +90,7 @@ NO_VFSMOUNT_IN_GET_SB_BDEV = @NO_VFSMOUN
 NO_READ_MAPPING_PAGE = @NO_READ_MAPPING_PAGE@
 FILLDIR_T_WITH_INO_T = @FILLDIR_T_WITH_INO_T@
 INVALIDATEPAGE_RETURNS_INT = @INVALIDATEPAGE_RETURNS_INT@
+DIO_OLD_GET_BLOCKS = @DIO_OLD_GET_BLOCKS@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
--- a/configure.in	2008-02-02 10:36:31.000000000 -0500
+++ b/configure.in	2008-02-02 10:36:32.000000000 -0500
@@ -395,6 +395,11 @@ OCFS2_CHECK_KERNEL([invalidatepage retur
   [^	int (\*invalidatepage) (struct page \*, unsigned long);])
 AC_SUBST(INVALIDATEPAGE_RETURNS_INT)
 
+DIO_OLD_GET_BLOCKS=
+OCFS2_CHECK_KERNEL([get_blocks_t type], fs.h,
+  DIO_OLD_GET_BLOCKS=yes, , [get_blocks_t])
+AC_SUBST(DIO_OLD_GET_BLOCKS)
+
 # 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:31.000000000 -0500
+++ b/fs/ocfs2/Makefile	2008-02-02 10:36:32.000000000 -0500
@@ -152,6 +152,10 @@ ifdef INVALIDATEPAGE_RETURNS_INT
 EXTRA_CFLAGS += -DINVALIDATEPAGE_RETURNS_INT
 endif
 
+ifdef DIO_OLD_GET_BLOCKS
+EXTRA_CFLAGS += -DDIO_OLD_GET_BLOCKS
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
--- a/fs/ocfs2/aops.c	2008-02-02 10:36:31.000000000 -0500
+++ b/fs/ocfs2/aops.c	2008-02-02 10:36:32.000000000 -0500
@@ -553,14 +553,22 @@ bail:
  * called like this: dio->get_blocks(dio->inode, fs_startblk,
  * 					fs_count, map_bh, dio->rw == WRITE);
  */
+#ifdef DIO_OLD_GET_BLOCKS
+static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
+				      unsigned long max_blocks,
+				      struct buffer_head *bh_result,
+				      int create)
+{
+#else
 static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
 				     struct buffer_head *bh_result, int create)
 {
+	unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
+#endif
 	int ret;
 	u64 p_blkno, inode_blocks, contig_blocks;
 	unsigned int ext_flags;
 	unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
-	unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
 
 	/* This function won't even be called if the request isn't all
 	 * nicely aligned and of the right size, so there's no need



