Whamcloud - gitweb
Branch b1_8
authoryangsheng <yangsheng>
Fri, 6 Mar 2009 17:23:29 +0000 (17:23 +0000)
committeryangsheng <yangsheng>
Fri, 6 Mar 2009 17:23:29 +0000 (17:23 +0000)
b=18718

i=johann, shadow

Fixed build issues for sles9.

lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/obdfilter/filter_io.c

index d0288c7..54cb5fc 100644 (file)
@@ -1096,7 +1096,7 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
+AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE],
 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
 [mm/truncate.c],[
 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
@@ -1559,6 +1559,15 @@ LB_LINUX_TRY_COMPILE([
 EXTRA_KCFLAGS="$tmp_flags"
 ])
 
+# 2.6.5 sles9 hasn't define sysctl_vfs_cache_pressure
+AC_DEFUN([LC_HAVE_SYSCTL_VFS_CACHE_PRESSURE],
+[LB_CHECK_SYMBOL_EXPORT([sysctl_vfs_cache_pressure],
+[fs/dcache.c],[
+        AC_DEFINE(HAVE_SYSCTL_VFS_CACHE_PRESSURE, 1, [kernel exports sysctl_vfs_cache_pressure])
+],[
+])
+])
+
 #
 # LC_PROG_LINUX
 #
@@ -1580,7 +1589,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
           LC_TASK_PPTR
           # RHEL4 patches
-          LC_EXPORT_TRUNCATE_COMPLETE
+          LC_EXPORT_TRUNCATE_COMPLETE_PAGE
           LC_EXPORT_TRUNCATE_RANGE
           LC_EXPORT_D_REHASH_COND
           LC_EXPORT___D_REHASH
@@ -1617,6 +1626,9 @@ AC_DEFUN([LC_PROG_LINUX],
           # does the kernel have VFS intent patches?
           LC_VFS_INTENT_PATCHES
 
+         # 2.6.5 sles9
+         LC_HAVE_SYSCTL_VFS_CACHE_PRESSURE
+
           # 2.6.12
           LC_RW_TREE_LOCK
 
index e6a8bed..7f25733 100644 (file)
@@ -558,5 +558,9 @@ static inline long labs(long x)
 #define INODE_PRIVATE_DATA(inode)       ((inode)->u.generic_ip)
 #endif
 
+#ifndef        HAVE_SYSCTL_VFS_CACHE_PRESSURE
+#define        sysctl_vfs_cache_pressure       100
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _COMPAT25_H */
index fe91eaa..0dc4e2e 100644 (file)
@@ -361,21 +361,22 @@ void filter_truncate_cache(struct obd_device *obd, struct obd_ioobj *obj,
                            struct niobuf_remote *nb, int pages,
                            struct niobuf_local *res, struct inode *inode)
 {
-        struct niobuf_remote *rnb;
         int i;
 
         LASSERT(inode != NULL);
 #ifdef HAVE_TRUNCATE_RANGE
-        for (i = 0, rnb = nb; i < obj->ioo_bufcnt; i++, rnb++) {
+        for (i = 0; i < obj->ioo_bufcnt; i++, nb++) {
                 /* remove pages in which range is fit */
                 truncate_inode_pages_range(inode->i_mapping,
-                                           rnb->offset & CFS_PAGE_MASK,
-                                           (rnb->offset + rnb->len - 1) |
+                                           nb->offset & CFS_PAGE_MASK,
+                                           (nb->offset + nb->len - 1) |
                                            ~CFS_PAGE_MASK);
         }
-#elif (defined HAVE_TRUNCATE_COMPLETE)
-        for (i = 0, lnb = res; i < pages; i++, lnb++)
-                truncate_complete_page(inode->i_mapping, lnb->page);
+#elif (defined HAVE_TRUNCATE_COMPLETE_PAGE)
+        for (i = 0; i < pages; i++, res++) {
+                if (res->page != NULL)
+                        truncate_complete_page(inode->i_mapping, res->page);
+        }
 #else
 #error "Nor truncate_inode_pages_range or truncate_complete_page are supported"
 #endif