Commit 828cfcb3 authored by Nathan Scott's avatar Nathan Scott

[XFS] Make kmem shaking interface consistent between kernel versions. No code...

[XFS] Make kmem shaking interface consistent between kernel versions.  No code change here, mainly symbol names.

SGI Modid: 2.5.x-xfs:slinx:162379a
parent ea7de3cf
......@@ -82,6 +82,7 @@ EXPORT_SYMBOL(xfs_Gqm); /* used by xfsidbg */
kmem_zone_t *qm_dqzone;
kmem_zone_t *qm_dqtrxzone;
kmem_shaker_t xfs_qm_shaker;
STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int);
STATIC void xfs_qm_list_destroy(xfs_dqlist_t *);
......@@ -112,8 +113,6 @@ extern mutex_t qcheck_lock;
#define XQM_LIST_PRINT(l, NXT, title) do { } while (0)
#endif
struct shrinker *xfs_qm_shrinker;
/*
* Initialize the XQM structure.
* Note that there is not one quota manager per file system.
......@@ -163,7 +162,7 @@ xfs_Gqm_init(void)
} else
xqm->qm_dqzone = qm_dqzone;
xfs_qm_shrinker = set_shrinker(DEFAULT_SEEKS, xfs_qm_shake);
xfs_qm_shaker = kmem_shake_register(xfs_qm_shake);
/*
* The t_dqinfo portion of transactions.
......@@ -195,8 +194,7 @@ xfs_qm_destroy(
ASSERT(xqm != NULL);
ASSERT(xqm->qm_nrefs == 0);
remove_shrinker(xfs_qm_shrinker);
kmem_shake_deregister(xfs_qm_shaker);
hsize = xqm->qm_dqhashmask + 1;
for (i = 0; i < hsize; i++) {
xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i]));
......@@ -2078,7 +2076,7 @@ xfs_qm_shake_freelist(
xfs_dqunlock(dqp);
xfs_qm_freelist_unlock(xfs_Gqm);
if (++restarts >= XFS_QM_RECLAIM_MAX_RESTARTS)
goto out;
return (nreclaimed);
XQM_STATS_INC(xqmstats.xs_qm_dqwants);
goto tryagain;
}
......@@ -2153,7 +2151,7 @@ xfs_qm_shake_freelist(
XFS_DQ_HASH_UNLOCK(hash);
xfs_qm_freelist_unlock(xfs_Gqm);
if (++restarts >= XFS_QM_RECLAIM_MAX_RESTARTS)
goto out;
return (nreclaimed);
goto tryagain;
}
xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING");
......@@ -2178,14 +2176,12 @@ xfs_qm_shake_freelist(
dqp = nextdqp;
}
xfs_qm_freelist_unlock(xfs_Gqm);
out:
return nreclaimed;
return (nreclaimed);
}
/*
* The shake manager routine called by shaked() when memory is
* running low.
* The kmem_shake interface is invoked when memory is running low.
*/
/* ARGSUSED */
STATIC int
......@@ -2193,10 +2189,10 @@ xfs_qm_shake(int nr_to_scan, unsigned int gfp_mask)
{
int ndqused, nfree, n;
if (!(gfp_mask & __GFP_WAIT))
return 0;
if (!kmem_shake_allow(gfp_mask))
return (0);
if (!xfs_Gqm)
return 0;
return (0);
nfree = xfs_Gqm->qm_dqfreelist.qh_nelems; /* free dquots */
/* incore dquots in all f/s's */
......@@ -2205,7 +2201,7 @@ xfs_qm_shake(int nr_to_scan, unsigned int gfp_mask)
ASSERT(ndqused >= 0);
if (nfree <= ndqused && nfree < ndquot)
return 0;
return (0);
ndqused *= xfs_Gqm->qm_dqfree_ratio; /* target # of free dquots */
n = nfree - ndqused - ndquot; /* # over target */
......
......@@ -165,4 +165,25 @@ kmem_zone_free(kmem_zone_t *zone, void *ptr)
kmem_cache_free(zone, ptr);
}
typedef struct shrinker *kmem_shaker_t;
typedef int (*kmem_shake_func_t)(int, unsigned int);
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(unsigned int gfp_mask)
{
return (gfp_mask & __GFP_WAIT);
}
#endif /* __XFS_SUPPORT_KMEM_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment