Fix some bugs spotted by Andrea Arcangeli <andrea@suse.de>

- When we added /proc/sys/vm/vfs_cache_pressure we forgot to allow it to
  tune the dquot and mbcache slabs as well.

- Reduce lock contention in shrink_dqcache_memory().

- Use dqstats.free_dquots in shrink_dqcache_memory(): this is the count of
  reclaimable objects.

- Export sysctl_vfs_cache_pressure to GPL modules for mbcache.o

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/dcache.c  |    1 +
 25-akpm/fs/dquot.c   |   12 +++++-------
 25-akpm/fs/mbcache.c |    2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff -puN fs/dquot.c~slab-shrinkers-use-vfs_cache_pressure fs/dquot.c
--- 25/fs/dquot.c~slab-shrinkers-use-vfs_cache_pressure	2005-03-18 01:07:25.000000000 -0800
+++ 25-akpm/fs/dquot.c	2005-03-18 01:07:25.000000000 -0800
@@ -505,14 +505,12 @@ static void prune_dqcache(int count)
 
 static int shrink_dqcache_memory(int nr, unsigned int gfp_mask)
 {
-	int ret;
-
-	spin_lock(&dq_list_lock);
-	if (nr)
+	if (nr) {
+		spin_lock(&dq_list_lock);
 		prune_dqcache(nr);
-	ret = dqstats.allocated_dquots;
-	spin_unlock(&dq_list_lock);
-	return ret;
+		spin_unlock(&dq_list_lock);
+	}
+	return (dqstats.free_dquots / 100) * sysctl_vfs_cache_pressure;
 }
 
 /*
diff -puN fs/mbcache.c~slab-shrinkers-use-vfs_cache_pressure fs/mbcache.c
--- 25/fs/mbcache.c~slab-shrinkers-use-vfs_cache_pressure	2005-03-18 01:07:25.000000000 -0800
+++ 25-akpm/fs/mbcache.c	2005-03-18 01:07:25.000000000 -0800
@@ -225,7 +225,7 @@ mb_cache_shrink_fn(int nr_to_scan, unsig
 						   e_lru_list), gfp_mask);
 	}
 out:
-	return count;
+	return (count / 100) * sysctl_vfs_cache_pressure;
 }
 
 
diff -puN fs/dcache.c~slab-shrinkers-use-vfs_cache_pressure fs/dcache.c
--- 25/fs/dcache.c~slab-shrinkers-use-vfs_cache_pressure	2005-03-18 01:34:08.000000000 -0800
+++ 25-akpm/fs/dcache.c	2005-03-18 01:34:23.000000000 -0800
@@ -36,6 +36,7 @@
 /* #define DCACHE_DEBUG 1 */
 
 int sysctl_vfs_cache_pressure = 100;
+EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
 
  __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lock);
 seqlock_t rename_lock __cacheline_aligned_in_smp = SEQLOCK_UNLOCKED;
_