From 3f14fe67a3cf446fc9d335e6166eaa792395e707 Mon Sep 17 00:00:00 2001 From: yangsheng <yangsheng> Date: Wed, 23 Apr 2008 03:52:19 +0000 Subject: [PATCH] Branch HEAD b=14576 i=shadow, nikita Add own nr_free_buffer_pages() function when it wasn't exported. --- lustre/include/linux/lustre_compat25.h | 11 +++++++++++ lustre/obdclass/lu_object.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 2007a74fb6..5bbac966bc 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -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 diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index ee55b41788..9850941484 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -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) { -- GitLab