aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota/xfs_qm.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2005-11-01 23:08:25 -0500
committerNathan Scott <nathans@sgi.com>2005-11-01 23:08:25 -0500
commit6b3f6b5b87f03d1649340d6b3a572206653a2a2b (patch)
tree7b8791eed46bbfa82f777ca25282c434270fdf50 /fs/xfs/quota/xfs_qm.c
parent1f730e3b530fb2fa3159df06405c83f9a6fbbd83 (diff)
[XFS] Rework the dquot hash sizing heuristics.
SGI-PV: 943123 SGI-Modid: xfs-linux:xfs-kern:24012a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/quota/xfs_qm.c')
-rw-r--r--fs/xfs/quota/xfs_qm.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 79aadb1c1f44..1aea42d71a64 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -60,8 +60,9 @@
60 * quota functionality, including maintaining the freelist and hash 60 * quota functionality, including maintaining the freelist and hash
61 * tables of dquots. 61 * tables of dquots.
62 */ 62 */
63mutex_t xfs_Gqm_lock; 63mutex_t xfs_Gqm_lock;
64struct xfs_qm *xfs_Gqm; 64struct xfs_qm *xfs_Gqm;
65uint ndquot;
65 66
66kmem_zone_t *qm_dqzone; 67kmem_zone_t *qm_dqzone;
67kmem_zone_t *qm_dqtrxzone; 68kmem_zone_t *qm_dqtrxzone;
@@ -108,25 +109,25 @@ extern mutex_t qcheck_lock;
108STATIC struct xfs_qm * 109STATIC struct xfs_qm *
109xfs_Gqm_init(void) 110xfs_Gqm_init(void)
110{ 111{
111 xfs_qm_t *xqm; 112 xfs_dqhash_t *udqhash, *gdqhash;
112 int hsize, i; 113 xfs_qm_t *xqm;
113 114 uint i, hsize, flags = KM_SLEEP | KM_MAYFAIL;
114 xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP);
115 ASSERT(xqm);
116 115
117 /* 116 /*
118 * Initialize the dquot hash tables. 117 * Initialize the dquot hash tables.
119 */ 118 */
120 hsize = (DQUOT_HASH_HEURISTIC < XFS_QM_NCSIZE_THRESHOLD) ? 119 hsize = XFS_QM_HASHSIZE_HIGH;
121 XFS_QM_HASHSIZE_LOW : XFS_QM_HASHSIZE_HIGH; 120 while (!(udqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), flags))) {
122 xqm->qm_dqhashmask = hsize - 1; 121 if ((hsize >>= 1) <= XFS_QM_HASHSIZE_LOW)
122 flags = KM_SLEEP;
123 }
124 gdqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), KM_SLEEP);
125 ndquot = hsize << 8;
123 126
124 xqm->qm_usr_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * 127 xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP);
125 sizeof(xfs_dqhash_t), 128 xqm->qm_dqhashmask = hsize - 1;
126 KM_SLEEP); 129 xqm->qm_usr_dqhtable = udqhash;
127 xqm->qm_grp_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * 130 xqm->qm_grp_dqhtable = gdqhash;
128 sizeof(xfs_dqhash_t),
129 KM_SLEEP);
130 ASSERT(xqm->qm_usr_dqhtable != NULL); 131 ASSERT(xqm->qm_usr_dqhtable != NULL);
131 ASSERT(xqm->qm_grp_dqhtable != NULL); 132 ASSERT(xqm->qm_grp_dqhtable != NULL);
132 133