diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-01-20 16:55:30 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-01-21 14:44:56 -0500 |
commit | bdfb04301fa5fdd95f219539a9a5b9663b1e5fc2 (patch) | |
tree | 6d50b1c71d1f227cf1800ee0531a475266ef6da8 /fs/xfs/quota/xfs_qm.c | |
parent | a14a348bff2f99471a28e5928eb6801224c053d8 (diff) |
xfs: replace KM_LARGE with explicit vmalloc use
We use the KM_LARGE flag to make kmem_alloc and friends use vmalloc
if necessary. As we only need this for a few boot/mount time
allocations just switch to explicit vmalloc calls there.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/quota/xfs_qm.c')
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 9e627a8b5b0e..11cfd8245c7c 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -118,9 +118,14 @@ xfs_Gqm_init(void) | |||
118 | */ | 118 | */ |
119 | udqhash = kmem_zalloc_greedy(&hsize, | 119 | udqhash = kmem_zalloc_greedy(&hsize, |
120 | XFS_QM_HASHSIZE_LOW * sizeof(xfs_dqhash_t), | 120 | XFS_QM_HASHSIZE_LOW * sizeof(xfs_dqhash_t), |
121 | XFS_QM_HASHSIZE_HIGH * sizeof(xfs_dqhash_t), | 121 | XFS_QM_HASHSIZE_HIGH * sizeof(xfs_dqhash_t)); |
122 | KM_SLEEP | KM_MAYFAIL | KM_LARGE); | 122 | if (!udqhash) |
123 | gdqhash = kmem_zalloc(hsize, KM_SLEEP | KM_LARGE); | 123 | goto out; |
124 | |||
125 | gdqhash = kmem_zalloc_large(hsize); | ||
126 | if (!udqhash) | ||
127 | goto out_free_udqhash; | ||
128 | |||
124 | hsize /= sizeof(xfs_dqhash_t); | 129 | hsize /= sizeof(xfs_dqhash_t); |
125 | ndquot = hsize << 8; | 130 | ndquot = hsize << 8; |
126 | 131 | ||
@@ -170,6 +175,11 @@ xfs_Gqm_init(void) | |||
170 | mutex_init(&qcheck_lock); | 175 | mutex_init(&qcheck_lock); |
171 | #endif | 176 | #endif |
172 | return xqm; | 177 | return xqm; |
178 | |||
179 | out_free_udqhash: | ||
180 | kmem_free_large(udqhash); | ||
181 | out: | ||
182 | return NULL; | ||
173 | } | 183 | } |
174 | 184 | ||
175 | /* | 185 | /* |
@@ -189,8 +199,8 @@ xfs_qm_destroy( | |||
189 | xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i])); | 199 | xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i])); |
190 | xfs_qm_list_destroy(&(xqm->qm_grp_dqhtable[i])); | 200 | xfs_qm_list_destroy(&(xqm->qm_grp_dqhtable[i])); |
191 | } | 201 | } |
192 | kmem_free(xqm->qm_usr_dqhtable); | 202 | kmem_free_large(xqm->qm_usr_dqhtable); |
193 | kmem_free(xqm->qm_grp_dqhtable); | 203 | kmem_free_large(xqm->qm_grp_dqhtable); |
194 | xqm->qm_usr_dqhtable = NULL; | 204 | xqm->qm_usr_dqhtable = NULL; |
195 | xqm->qm_grp_dqhtable = NULL; | 205 | xqm->qm_grp_dqhtable = NULL; |
196 | xqm->qm_dqhashmask = 0; | 206 | xqm->qm_dqhashmask = 0; |
@@ -219,8 +229,12 @@ xfs_qm_hold_quotafs_ref( | |||
219 | */ | 229 | */ |
220 | mutex_lock(&xfs_Gqm_lock); | 230 | mutex_lock(&xfs_Gqm_lock); |
221 | 231 | ||
222 | if (xfs_Gqm == NULL) | 232 | if (!xfs_Gqm) { |
223 | xfs_Gqm = xfs_Gqm_init(); | 233 | xfs_Gqm = xfs_Gqm_init(); |
234 | if (!xfs_Gqm) | ||
235 | return ENOMEM; | ||
236 | } | ||
237 | |||
224 | /* | 238 | /* |
225 | * We can keep a list of all filesystems with quotas mounted for | 239 | * We can keep a list of all filesystems with quotas mounted for |
226 | * debugging and statistical purposes, but ... | 240 | * debugging and statistical purposes, but ... |