Whamcloud - gitweb
Branch HEAD
authoryangsheng <yangsheng>
Wed, 23 Apr 2008 03:52:19 +0000 (03:52 +0000)
committeryangsheng <yangsheng>
Wed, 23 Apr 2008 03:52:19 +0000 (03:52 +0000)
b=14576
i=shadow, nikita

Add own nr_free_buffer_pages() function when it wasn't exported.

lustre/include/linux/lustre_compat25.h
lustre/obdclass/lu_object.c

index 2007a74..5bbac96 100644 (file)
@@ -383,6 +383,17 @@ int ll_unregister_blkdev(unsigned int dev, const char *name)
 #define ll_inode_blksize(a)     (1<<(a)->i_blkbits)
 #endif
 
+#ifndef HAVE_EXPORT_NR_FREE_BUFFER_PAGES
+static inline unsigned int ll_nr_free_buffer_pages(void)
+{
+        struct sysinfo si;
+
+        si_meminfo(&si);
+        return (unsigned int)(si.freeram - si.freehigh);
+}
+#else
+#define ll_nr_free_buffer_pages()      nr_free_buffer_pages()
+#endif
 
 #ifdef FS_ODD_RENAME
 #define FS_RENAME_DOES_D_MOVE FS_ODD_RENAME
index ee55b41..9850941 100644 (file)
@@ -553,7 +553,7 @@ static int lu_htable_order(void)
          *
          * Size of lu_object is (arbitrary) taken as 1K (together with inode).
          */
-        cache_size = nr_free_buffer_pages() / 100 *
+        cache_size = ll_nr_free_buffer_pages() / 100 *
                 LU_CACHE_PERCENT * (CFS_PAGE_SIZE / 1024);
 
         for (bits = 1; (1 << bits) < cache_size; ++bits) {