diff options
Diffstat (limited to 'fs/xfs/quota/xfs_qm.c')
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 9e627a8b5b0e..417e61e3d9dd 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 (!gdqhash) | ||
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 ... |
@@ -436,7 +450,7 @@ xfs_qm_unmount_quotas( | |||
436 | STATIC int | 450 | STATIC int |
437 | xfs_qm_dqflush_all( | 451 | xfs_qm_dqflush_all( |
438 | xfs_mount_t *mp, | 452 | xfs_mount_t *mp, |
439 | int flags) | 453 | int sync_mode) |
440 | { | 454 | { |
441 | int recl; | 455 | int recl; |
442 | xfs_dquot_t *dqp; | 456 | xfs_dquot_t *dqp; |
@@ -472,7 +486,7 @@ again: | |||
472 | * across a disk write. | 486 | * across a disk write. |
473 | */ | 487 | */ |
474 | xfs_qm_mplist_unlock(mp); | 488 | xfs_qm_mplist_unlock(mp); |
475 | error = xfs_qm_dqflush(dqp, flags); | 489 | error = xfs_qm_dqflush(dqp, sync_mode); |
476 | xfs_dqunlock(dqp); | 490 | xfs_dqunlock(dqp); |
477 | if (error) | 491 | if (error) |
478 | return error; | 492 | return error; |
@@ -912,13 +926,11 @@ xfs_qm_sync( | |||
912 | { | 926 | { |
913 | int recl, restarts; | 927 | int recl, restarts; |
914 | xfs_dquot_t *dqp; | 928 | xfs_dquot_t *dqp; |
915 | uint flush_flags; | ||
916 | int error; | 929 | int error; |
917 | 930 | ||
918 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) | 931 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
919 | return 0; | 932 | return 0; |
920 | 933 | ||
921 | flush_flags = (flags & SYNC_WAIT) ? XFS_QMOPT_SYNC : XFS_QMOPT_DELWRI; | ||
922 | restarts = 0; | 934 | restarts = 0; |
923 | 935 | ||
924 | again: | 936 | again: |
@@ -978,7 +990,7 @@ xfs_qm_sync( | |||
978 | * across a disk write | 990 | * across a disk write |
979 | */ | 991 | */ |
980 | xfs_qm_mplist_unlock(mp); | 992 | xfs_qm_mplist_unlock(mp); |
981 | error = xfs_qm_dqflush(dqp, flush_flags); | 993 | error = xfs_qm_dqflush(dqp, flags); |
982 | xfs_dqunlock(dqp); | 994 | xfs_dqunlock(dqp); |
983 | if (error && XFS_FORCED_SHUTDOWN(mp)) | 995 | if (error && XFS_FORCED_SHUTDOWN(mp)) |
984 | return 0; /* Need to prevent umount failure */ | 996 | return 0; /* Need to prevent umount failure */ |
@@ -1782,7 +1794,7 @@ xfs_qm_quotacheck( | |||
1782 | * successfully. | 1794 | * successfully. |
1783 | */ | 1795 | */ |
1784 | if (!error) | 1796 | if (!error) |
1785 | error = xfs_qm_dqflush_all(mp, XFS_QMOPT_DELWRI); | 1797 | error = xfs_qm_dqflush_all(mp, 0); |
1786 | 1798 | ||
1787 | /* | 1799 | /* |
1788 | * We can get this error if we couldn't do a dquot allocation inside | 1800 | * We can get this error if we couldn't do a dquot allocation inside |
@@ -2004,7 +2016,7 @@ xfs_qm_shake_freelist( | |||
2004 | * We flush it delayed write, so don't bother | 2016 | * We flush it delayed write, so don't bother |
2005 | * releasing the mplock. | 2017 | * releasing the mplock. |
2006 | */ | 2018 | */ |
2007 | error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI); | 2019 | error = xfs_qm_dqflush(dqp, 0); |
2008 | if (error) { | 2020 | if (error) { |
2009 | xfs_fs_cmn_err(CE_WARN, dqp->q_mount, | 2021 | xfs_fs_cmn_err(CE_WARN, dqp->q_mount, |
2010 | "xfs_qm_dqflush_all: dquot %p flush failed", dqp); | 2022 | "xfs_qm_dqflush_all: dquot %p flush failed", dqp); |
@@ -2187,7 +2199,7 @@ xfs_qm_dqreclaim_one(void) | |||
2187 | * We flush it delayed write, so don't bother | 2199 | * We flush it delayed write, so don't bother |
2188 | * releasing the freelist lock. | 2200 | * releasing the freelist lock. |
2189 | */ | 2201 | */ |
2190 | error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI); | 2202 | error = xfs_qm_dqflush(dqp, 0); |
2191 | if (error) { | 2203 | if (error) { |
2192 | xfs_fs_cmn_err(CE_WARN, dqp->q_mount, | 2204 | xfs_fs_cmn_err(CE_WARN, dqp->q_mount, |
2193 | "xfs_qm_dqreclaim: dquot %p flush failed", dqp); | 2205 | "xfs_qm_dqreclaim: dquot %p flush failed", dqp); |