Whamcloud - gitweb
Branch b_release_1_8_0
authoryangsheng <yangsheng>
Fri, 6 Mar 2009 17:54:09 +0000 (17:54 +0000)
committeryangsheng <yangsheng>
Fri, 6 Mar 2009 17:54:09 +0000 (17:54 +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 60c2bc5..9921ac0 100644 (file)
@@ -1169,7 +1169,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,
@@ -1381,6 +1381,15 @@ AC_CHECK_HEADERS([linux/exportfs.h])
 CFLAGS="$tmpfl"
 ])
 
+# 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
 #
@@ -1402,7 +1411,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
@@ -1445,6 +1454,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 9ad15c0..751e762 100644 (file)
@@ -468,5 +468,9 @@ static inline long labs(long x)
 #define invalidate_mapping_pages(mapping,s,e) invalidate_inode_pages(mapping)
 #endif
 
+#ifndef        HAVE_SYSCTL_VFS_CACHE_PRESSURE
+#define        sysctl_vfs_cache_pressure       100
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _COMPAT25_H */
index bd0ad34..334f64e 100644 (file)
@@ -341,21 +341,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