From 08c9088f34869fa492524e47cd4e5219608d4eb4 Mon Sep 17 00:00:00 2001 From: vitaly Date: Fri, 10 Apr 2009 19:43:32 +0000 Subject: [PATCH] Branch HEAD b=18863 i=shadow i=bzzz lu cache shrinker bugfix, return the proper amount of cached objects. --- lustre/obdclass/lu_object.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 273cee1..8c55d6b 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -1429,8 +1429,11 @@ static int lu_cache_shrink(int nr, unsigned int gfp_mask) int remain = nr; CFS_LIST_HEAD(splice); - if (nr != 0 && !(gfp_mask & __GFP_FS)) - return -1; + if (nr != 0) { + if (!(gfp_mask & __GFP_FS)) + return -1; + CDEBUG(D_INODE, "Shrink %d objects\n", nr); + } down(&lu_sites_guard); list_for_each_entry_safe(s, tmp, &lu_sites, ls_linkage) { @@ -1445,11 +1448,15 @@ static int lu_cache_shrink(int nr, unsigned int gfp_mask) read_lock(&s->ls_guard); cached += s->ls_total - s->ls_busy; read_unlock(&s->ls_guard); - if (remain <= 0) + if (nr && remain <= 0) break; } list_splice(&splice, lu_sites.prev); up(&lu_sites_guard); + + cached = (cached / 100) * sysctl_vfs_cache_pressure; + if (nr == 0) + CDEBUG(D_INODE, "%d objects cached\n", cached); return cached; } -- 1.8.3.1