Whamcloud - gitweb
b=9482
authorgreen <green>
Wed, 19 Oct 2005 18:58:42 +0000 (18:58 +0000)
committergreen <green>
Wed, 19 Oct 2005 18:58:42 +0000 (18:58 +0000)
r=adilger
Check that there is no page_mapped() before trying to define it for 2.4 kernels.

lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h

index b77ce5f..5b48d1c 100644 (file)
@@ -414,6 +414,21 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+AC_DEFUN([LC_FUNC_PAGE_MAPPED],
+[AC_MSG_CHECKING([if kernel offers page_mapped])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/mm.h>
+],[
+       page_mapped(NULL);
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+
 #
 # LC_PROG_LINUX
 #
@@ -437,6 +452,7 @@ LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
 LC_FUNC_DEV_SET_RDONLY
 LC_FUNC_FILEMAP_FDATAWRITE
 LC_STRUCT_STATFS
+LC_FUNC_PAGE_MAPPED
 ])
 
 #
index 86430bf..e5260f1 100644 (file)
@@ -287,6 +287,7 @@ static inline int mapping_mapped(struct address_space *mapping)
 #define ll_zap_page_range(vma, addr, len)  zap_page_range(vma->vm_mm, addr, len)
 #endif
 
+#ifndef HAVE_PAGE_MAPPED
 /* Poor man's page_mapped. substract from page count, counts from
    buffers/pagecache and our own count (we are supposed to hold one reference).
    What is left are user mappings and also others who work with this page now,
@@ -295,6 +296,7 @@ static inline int page_mapped(struct page *page)
 {
         return page_count(page) - !!page->mapping - !!page->buffers - 1;
 }
+#endif /* !HAVE_PAGE_MAPPED */
 
 #endif /* end of 2.4 compat macros */