diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index fa2b8e9c907716bf791c92a2fe17e3980bb2ecb3..30cd78dfa8399f77b6e34a7675e754d81580a9a0 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -18,6 +18,11 @@ tbd  Sun Microsystems, Inc.
        * RHEL 4 and RHEL 5/SLES 10 clients behaves differently on 'cd' to a
         removed cwd "./" (refer to Bugzilla 14399).
 
+Severity   : minor
+Bugzilla   : 15517
+Description: Fix warnings with compile liblustre at sles10/rhel5 which have
+             __u64 as usingied long long type.
+
 Severity   : minor
 Bugzilla   : 15210
 Frequency  : rare, on shutdown
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 51ba04a6900d79dcf57ccc5429e0b3363f5c4633..ff695410ed2f860a8c68ddcfa8a3fe68bd9735e3 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -1077,6 +1077,27 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+# RHEL5 PageChecked and SetPageChecked defined
+AC_DEFUN([LC_PAGE_CHECKED],
+[AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/page-flags.h>
+],[
+        #ifndef PageChecked
+        #error PageChecked not defined in kernel
+        #endif
+        #ifndef SetPageChecked
+        #error SetPageChecked not defined in kernel
+        #endif
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_PAGE_CHECKED, 1,
+                  [does kernel have PageChecked and SetPageChecked])
+],[
+        AC_MSG_RESULT(NO)
+])
+])
+
 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
 [mm/truncate.c],[
@@ -1306,6 +1327,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
           #2.6.18 + RHEL5 (fc6)
           LC_PG_FS_MISC
+          LC_PAGE_CHECKED
 
           # 2.6.19
           LC_INODE_BLKSIZE
diff --git a/lustre/include/linux/lustre_user.h b/lustre/include/linux/lustre_user.h
index 477899329992507309ce9cebac9009dd7bd8a61b..1b7fb8aee210c04eb9b3f322aeac2e2560ad335c 100644
--- a/lustre/include/linux/lustre_user.h
+++ b/lustre/include/linux/lustre_user.h
@@ -56,36 +56,4 @@ typedef struct stat64   lstat_t;
 #define HAVE_LOV_USER_MDS_DATA
 #endif
 
-#ifndef LPU64
-/* this is a bit chunky */
-#if defined(__KERNEL__)
- #define _LWORDSIZE BITS_PER_LONG
-#else
- #define _LWORDSIZE __WORDSIZE
-#endif
-/* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
-#if (defined(__x86_64__) && (defined(__KERNEL__) || defined(CRAY_XT3)))
-# define LPU64 "%Lu"
-# define LPD64 "%Ld"
-# define LPX64 "%#Lx"
-# define LPSZ  "%lu"
-# define LPSSZ "%ld"
-#elif (_LWORDSIZE == 32)
-# define LPU64 "%Lu"
-# define LPD64 "%Ld"
-# define LPX64 "%#Lx"
-# define LPSZ  "%u"
-# define LPSSZ "%d"
-#elif (_LWORDSIZE == 64)
-# define LPU64 "%lu"
-# define LPD64 "%ld"
-# define LPX64 "%#lx"
-# define LPSZ  "%lu"
-# define LPSSZ "%ld"
-#endif
-
-#undef _LWORDSIZE
-
-#endif /* !LPU64 */
-
 #endif /* _LUSTRE_USER_H */
diff --git a/lustre/liblustre/tests/sanity.c b/lustre/liblustre/tests/sanity.c
index b07906d877472c8a1e19d84a66cc22a114aa5f96..27f7211d4359c75fbb682e17045d402ef8ff9fd7 100644
--- a/lustre/liblustre/tests/sanity.c
+++ b/lustre/liblustre/tests/sanity.c
@@ -32,22 +32,17 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <sys/queue.h>
 #include <signal.h>
 #include <errno.h>
 #include <dirent.h>
 #include <sys/uio.h>
 #include <sys/time.h>
 #include <time.h>
-#include <sys/ioctl.h>
 
+#include <liblustre.h>
 #include "test_common.h"
-#include <ioctl.h>
 #include <lustre/liblustreapi.h>
 
-#ifndef PAGE_SIZE
-#define PAGE_SIZE getpagesize()
-#endif
 #define _npages (2048)
 
 void *buf_alloc;
diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
index 813351d78e9b035c88b78346f3cb15197b10233c..c05255d8c59578bca89ea47fa7e16584ce007781 100644
--- a/lustre/llite/dir.c
+++ b/lustre/llite/dir.c
@@ -73,10 +73,13 @@ static inline unsigned ll_dir_rec_len(unsigned name_len)
         return (name_len + 8 + LL_DIR_PAD - 1) & ~(LL_DIR_PAD - 1);
 }
 
-
+#ifndef HAVE_PAGE_CHECKED
 #ifdef HAVE_PG_FS_MISC
 #define PageChecked(page)        test_bit(PG_fs_misc, &(page)->flags)
 #define SetPageChecked(page)     set_bit(PG_fs_misc, &(page)->flags)
+#else
+#error PageChecked or PageFsMisc not defined in kernel
+#endif
 #endif
 
 /* returns the page unlocked, but with a reference */