[XFS] Use generic shrinker interfaces in XFS.
authorAndrew Morton <akpm@linux-foundation.org>
Thu, 24 May 2007 05:25:42 +0000 (15:25 +1000)
committerTim Shimmin <tes@chook.melbourne.sgi.com>
Sat, 14 Jul 2007 05:23:53 +0000 (15:23 +1000)
SGI-PV: 964986
SGI-Modid: xfs-linux-melb:xfs-kern:28642a

Signed-Off-By: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
fs/xfs/linux-2.6/kmem.h
fs/xfs/linux-2.6/xfs_buf.c
fs/xfs/quota/xfs_qm.c

index 9ebabdf7829c3a5c5dc2fe08caefde56fb8dfe2c..4b6470cf87f0c633c3ca1b0bbe4d98ffb2757374 100644 (file)
@@ -100,25 +100,6 @@ kmem_zone_destroy(kmem_zone_t *zone)
 extern void *kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast);
 extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast);
 
-/*
- * Low memory cache shrinkers
- */
-
-typedef struct shrinker *kmem_shaker_t;
-typedef int (*kmem_shake_func_t)(int, gfp_t);
-
-static inline kmem_shaker_t
-kmem_shake_register(kmem_shake_func_t sfunc)
-{
-       return set_shrinker(DEFAULT_SEEKS, sfunc);
-}
-
-static inline void
-kmem_shake_deregister(kmem_shaker_t shrinker)
-{
-       remove_shrinker(shrinker);
-}
-
 static inline int
 kmem_shake_allow(gfp_t gfp_mask)
 {
index 192aa0650919153b09a7427ff1e47b73f5ffe6f9..a3eff54a201c5306ea83cf0a9a1568c2bd3d4261 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/freezer.h>
 
 static kmem_zone_t *xfs_buf_zone;
-static kmem_shaker_t xfs_buf_shake;
+static struct shrinker *xfs_buf_shake;
 STATIC int xfsbufd(void *);
 STATIC int xfsbufd_wakeup(int, gfp_t);
 STATIC void xfs_buf_delwri_queue(xfs_buf_t *, int);
@@ -1831,7 +1831,7 @@ xfs_buf_init(void)
        if (!xfsdatad_workqueue)
                goto out_destroy_xfslogd_workqueue;
 
-       xfs_buf_shake = kmem_shake_register(xfsbufd_wakeup);
+       xfs_buf_shake = set_shrinker(DEFAULT_SEEKS, xfsbufd_wakeup);
        if (!xfs_buf_shake)
                goto out_destroy_xfsdatad_workqueue;
 
@@ -1853,7 +1853,7 @@ xfs_buf_init(void)
 void
 xfs_buf_terminate(void)
 {
-       kmem_shake_deregister(xfs_buf_shake);
+       remove_shrinker(xfs_buf_shake);
        destroy_workqueue(xfsdatad_workqueue);
        destroy_workqueue(xfslogd_workqueue);
        kmem_zone_destroy(xfs_buf_zone);
index 3e4a8ad8a34c3180eff417f732f11d5df320b722..eeb3d9cc0e8efae23cfdad5b7463e07e51b1dfd9 100644 (file)
@@ -62,7 +62,7 @@ uint          ndquot;
 
 kmem_zone_t    *qm_dqzone;
 kmem_zone_t    *qm_dqtrxzone;
-static kmem_shaker_t   xfs_qm_shaker;
+static struct shrinker *xfs_qm_shaker;
 
 static cred_t  xfs_zerocr;
 static xfs_inode_t     xfs_zeroino;
@@ -150,7 +150,7 @@ xfs_Gqm_init(void)
        } else
                xqm->qm_dqzone = qm_dqzone;
 
-       xfs_qm_shaker = kmem_shake_register(xfs_qm_shake);
+       xfs_qm_shaker = set_shrinker(DEFAULT_SEEKS, xfs_qm_shake);
 
        /*
         * The t_dqinfo portion of transactions.
@@ -182,7 +182,7 @@ xfs_qm_destroy(
 
        ASSERT(xqm != NULL);
        ASSERT(xqm->qm_nrefs == 0);
-       kmem_shake_deregister(xfs_qm_shaker);
+       remove_shrinker(xfs_qm_shaker);
        hsize = xqm->qm_dqhashmask + 1;
        for (i = 0; i < hsize; i++) {
                xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i]));