diff options
author | Nathan Scott <nathans@sgi.com> | 2005-11-01 23:08:25 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-11-01 23:08:25 -0500 |
commit | 6b3f6b5b87f03d1649340d6b3a572206653a2a2b (patch) | |
tree | 7b8791eed46bbfa82f777ca25282c434270fdf50 /fs/xfs/quota | |
parent | 1f730e3b530fb2fa3159df06405c83f9a6fbbd83 (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')
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 31 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.h | 6 |
2 files changed, 19 insertions, 18 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 | */ |
63 | mutex_t xfs_Gqm_lock; | 63 | mutex_t xfs_Gqm_lock; |
64 | struct xfs_qm *xfs_Gqm; | 64 | struct xfs_qm *xfs_Gqm; |
65 | uint ndquot; | ||
65 | 66 | ||
66 | kmem_zone_t *qm_dqzone; | 67 | kmem_zone_t *qm_dqzone; |
67 | kmem_zone_t *qm_dqtrxzone; | 68 | kmem_zone_t *qm_dqtrxzone; |
@@ -108,25 +109,25 @@ extern mutex_t qcheck_lock; | |||
108 | STATIC struct xfs_qm * | 109 | STATIC struct xfs_qm * |
109 | xfs_Gqm_init(void) | 110 | xfs_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 | ||
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index 43219c97b371..12da259f2fcb 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h | |||
@@ -26,6 +26,7 @@ | |||
26 | struct xfs_qm; | 26 | struct xfs_qm; |
27 | struct xfs_inode; | 27 | struct xfs_inode; |
28 | 28 | ||
29 | extern uint ndquot; | ||
29 | extern mutex_t xfs_Gqm_lock; | 30 | extern mutex_t xfs_Gqm_lock; |
30 | extern struct xfs_qm *xfs_Gqm; | 31 | extern struct xfs_qm *xfs_Gqm; |
31 | extern kmem_zone_t *qm_dqzone; | 32 | extern kmem_zone_t *qm_dqzone; |
@@ -51,9 +52,8 @@ extern kmem_zone_t *qm_dqtrxzone; | |||
51 | /* | 52 | /* |
52 | * Dquot hashtable constants/threshold values. | 53 | * Dquot hashtable constants/threshold values. |
53 | */ | 54 | */ |
54 | #define XFS_QM_NCSIZE_THRESHOLD 5000 | 55 | #define XFS_QM_HASHSIZE_LOW (NBPP / sizeof(xfs_dqhash_t)) |
55 | #define XFS_QM_HASHSIZE_LOW 32 | 56 | #define XFS_QM_HASHSIZE_HIGH ((NBPP * 4) / sizeof(xfs_dqhash_t)) |
56 | #define XFS_QM_HASHSIZE_HIGH 64 | ||
57 | 57 | ||
58 | /* | 58 | /* |
59 | * We output a cmn_err when quotachecking a quota file with more than | 59 | * We output a cmn_err when quotachecking a quota file with more than |