diff options
author | Brian Behlendorf <[email protected]> | 2011-06-16 15:39:08 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-06-21 14:02:39 -0700 |
commit | a55bcaad181096d764e12d847e3091cd7b15509a (patch) | |
tree | dc3b2a033d186854c8d92cf70bc2b4545847e415 /module/spl | |
parent | a32661a6c976c1d8100ddd8e60c958ae8db98747 (diff) |
Linux 3.0: Shrinker compatibility
Update the the wrapper macros for the memory shrinker to handle
this 4th API change. The callback function now takes a
shrink_control structure. This is certainly a step in the
right direction but it's annoying to have to accomidate yet
another version of the API.
Diffstat (limited to 'module/spl')
-rw-r--r-- | module/spl/spl-kmem.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index e7fc5f2c9..d71ab11bb 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -829,8 +829,7 @@ struct rw_semaphore spl_kmem_cache_sem; /* Cache list lock */ static int spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush); -SPL_SHRINKER_CALLBACK_PROTO(spl_kmem_cache_generic_shrinker, - shrinker_cb, nr_to_scan, gfp_mask); +SPL_SHRINKER_CALLBACK_FWD_DECLARE(spl_kmem_cache_generic_shrinker); SPL_SHRINKER_DECLARE(spl_kmem_cache_shrinker, spl_kmem_cache_generic_shrinker, KMC_DEFAULT_SEEKS); @@ -1858,15 +1857,16 @@ EXPORT_SYMBOL(spl_kmem_cache_free); * objects should be freed, because Solaris semantics are to free * all available objects we may free more objects than requested. */ -SPL_SHRINKER_CALLBACK_PROTO(spl_kmem_cache_generic_shrinker, - shrinker_cb, nr_to_scan, gfp_mask) +static int +__spl_kmem_cache_generic_shrinker(struct shrinker *shrink, + struct shrink_control *sc) { spl_kmem_cache_t *skc; int unused = 0; down_read(&spl_kmem_cache_sem); list_for_each_entry(skc, &spl_kmem_cache_list, skc_list) { - if (nr_to_scan) + if (sc->nr_to_scan) spl_kmem_cache_reap_now(skc); /* @@ -1882,6 +1882,8 @@ SPL_SHRINKER_CALLBACK_PROTO(spl_kmem_cache_generic_shrinker, return (unused * sysctl_vfs_cache_pressure) / 100; } +SPL_SHRINKER_CALLBACK_WRAPPER(spl_kmem_cache_generic_shrinker); + /* * Call the registered reclaim function for a cache. Depending on how * many and which objects are released it may simply repopulate the @@ -1923,7 +1925,12 @@ EXPORT_SYMBOL(spl_kmem_cache_reap_now); void spl_kmem_reap(void) { - spl_exec_shrinker(&spl_kmem_cache_shrinker, KMC_REAP_CHUNK, GFP_KERNEL); + struct shrink_control sc; + + sc.nr_to_scan = KMC_REAP_CHUNK; + sc.gfp_mask = GFP_KERNEL; + + __spl_kmem_cache_generic_shrinker(NULL, &sc); } EXPORT_SYMBOL(spl_kmem_reap); |