diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_linux.h | 14 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 31 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.h | 6 |
3 files changed, 20 insertions, 31 deletions
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index 52b240539531..44fed10af0dd 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
@@ -217,19 +217,7 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) | |||
217 | #define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */ | 217 | #define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */ |
218 | #define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */ | 218 | #define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */ |
219 | 219 | ||
220 | /* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */ | 220 | #define dfltprid 0 |
221 | /* we may well need to fine-tune this if it ever becomes an issue. */ | ||
222 | #define DQUOT_MAX_HEURISTIC 1024 /* NR_DQUOTS */ | ||
223 | #define ndquot DQUOT_MAX_HEURISTIC | ||
224 | |||
225 | /* IRIX uses the current size of the name cache to guess a good value */ | ||
226 | /* - this isn't the same but is a good enough starting point for now. */ | ||
227 | #define DQUOT_HASH_HEURISTIC files_stat.nr_files | ||
228 | |||
229 | /* IRIX inodes maintain the project ID also, zero this field on Linux */ | ||
230 | #define DEFAULT_PROJID 0 | ||
231 | #define dfltprid DEFAULT_PROJID | ||
232 | |||
233 | #define MAXPATHLEN 1024 | 221 | #define MAXPATHLEN 1024 |
234 | 222 | ||
235 | #define MIN(a,b) (min(a,b)) | 223 | #define MIN(a,b) (min(a,b)) |
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 |