aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2007-05-24 01:25:42 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-07-14 01:23:53 -0400
commit3260f78ad6d5b788e78ea709d377f58e569bee41 (patch)
tree9ba46ac087769061b0cc3f0fec67be863c4a28b7 /fs
parent92dfe8d266eaf35a50607a0e0dcf525e1d367c80 (diff)
[XFS] Use generic shrinker interfaces in XFS.
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/kmem.h19
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c6
-rw-r--r--fs/xfs/quota/xfs_qm.c6
3 files changed, 6 insertions, 25 deletions
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
index 9ebabdf7829c..4b6470cf87f0 100644
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/linux-2.6/kmem.h
@@ -100,25 +100,6 @@ kmem_zone_destroy(kmem_zone_t *zone)
100extern void *kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast); 100extern void *kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast);
101extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast); 101extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast);
102 102
103/*
104 * Low memory cache shrinkers
105 */
106
107typedef struct shrinker *kmem_shaker_t;
108typedef int (*kmem_shake_func_t)(int, gfp_t);
109
110static inline kmem_shaker_t
111kmem_shake_register(kmem_shake_func_t sfunc)
112{
113 return set_shrinker(DEFAULT_SEEKS, sfunc);
114}
115
116static inline void
117kmem_shake_deregister(kmem_shaker_t shrinker)
118{
119 remove_shrinker(shrinker);
120}
121
122static inline int 103static inline int
123kmem_shake_allow(gfp_t gfp_mask) 104kmem_shake_allow(gfp_t gfp_mask)
124{ 105{
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 192aa0650919..a3eff54a201c 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -35,7 +35,7 @@
35#include <linux/freezer.h> 35#include <linux/freezer.h>
36 36
37static kmem_zone_t *xfs_buf_zone; 37static kmem_zone_t *xfs_buf_zone;
38static kmem_shaker_t xfs_buf_shake; 38static struct shrinker *xfs_buf_shake;
39STATIC int xfsbufd(void *); 39STATIC int xfsbufd(void *);
40STATIC int xfsbufd_wakeup(int, gfp_t); 40STATIC int xfsbufd_wakeup(int, gfp_t);
41STATIC void xfs_buf_delwri_queue(xfs_buf_t *, int); 41STATIC void xfs_buf_delwri_queue(xfs_buf_t *, int);
@@ -1831,7 +1831,7 @@ xfs_buf_init(void)
1831 if (!xfsdatad_workqueue) 1831 if (!xfsdatad_workqueue)
1832 goto out_destroy_xfslogd_workqueue; 1832 goto out_destroy_xfslogd_workqueue;
1833 1833
1834 xfs_buf_shake = kmem_shake_register(xfsbufd_wakeup); 1834 xfs_buf_shake = set_shrinker(DEFAULT_SEEKS, xfsbufd_wakeup);
1835 if (!xfs_buf_shake) 1835 if (!xfs_buf_shake)
1836 goto out_destroy_xfsdatad_workqueue; 1836 goto out_destroy_xfsdatad_workqueue;
1837 1837
@@ -1853,7 +1853,7 @@ xfs_buf_init(void)
1853void 1853void
1854xfs_buf_terminate(void) 1854xfs_buf_terminate(void)
1855{ 1855{
1856 kmem_shake_deregister(xfs_buf_shake); 1856 remove_shrinker(xfs_buf_shake);
1857 destroy_workqueue(xfsdatad_workqueue); 1857 destroy_workqueue(xfsdatad_workqueue);
1858 destroy_workqueue(xfslogd_workqueue); 1858 destroy_workqueue(xfslogd_workqueue);
1859 kmem_zone_destroy(xfs_buf_zone); 1859 kmem_zone_destroy(xfs_buf_zone);
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 3e4a8ad8a34c..eeb3d9cc0e8e 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -62,7 +62,7 @@ uint ndquot;
62 62
63kmem_zone_t *qm_dqzone; 63kmem_zone_t *qm_dqzone;
64kmem_zone_t *qm_dqtrxzone; 64kmem_zone_t *qm_dqtrxzone;
65static kmem_shaker_t xfs_qm_shaker; 65static struct shrinker *xfs_qm_shaker;
66 66
67static cred_t xfs_zerocr; 67static cred_t xfs_zerocr;
68static xfs_inode_t xfs_zeroino; 68static xfs_inode_t xfs_zeroino;
@@ -150,7 +150,7 @@ xfs_Gqm_init(void)
150 } else 150 } else
151 xqm->qm_dqzone = qm_dqzone; 151 xqm->qm_dqzone = qm_dqzone;
152 152
153 xfs_qm_shaker = kmem_shake_register(xfs_qm_shake); 153 xfs_qm_shaker = set_shrinker(DEFAULT_SEEKS, xfs_qm_shake);
154 154
155 /* 155 /*
156 * The t_dqinfo portion of transactions. 156 * The t_dqinfo portion of transactions.
@@ -182,7 +182,7 @@ xfs_qm_destroy(
182 182
183 ASSERT(xqm != NULL); 183 ASSERT(xqm != NULL);
184 ASSERT(xqm->qm_nrefs == 0); 184 ASSERT(xqm->qm_nrefs == 0);
185 kmem_shake_deregister(xfs_qm_shaker); 185 remove_shrinker(xfs_qm_shaker);
186 hsize = xqm->qm_dqhashmask + 1; 186 hsize = xqm->qm_dqhashmask + 1;
187 for (i = 0; i < hsize; i++) { 187 for (i = 0; i < hsize; i++) {
188 xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i])); 188 xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i]));