Whamcloud - gitweb
Branch HEAD
authorvitaly <vitaly>
Fri, 10 Apr 2009 19:43:32 +0000 (19:43 +0000)
committervitaly <vitaly>
Fri, 10 Apr 2009 19:43:32 +0000 (19:43 +0000)
b=18863
i=shadow
i=bzzz

lu cache shrinker bugfix, return the proper amount of cached objects.

lustre/obdclass/lu_object.c

index 273cee1..8c55d6b 100644 (file)
@@ -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;
 }