diff options
author | Nathan Scott <nathans@sgi.com> | 2005-11-02 15:08:25 +1100 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-11-02 15:08:25 +1100 |
commit | 6b3f6b5b87f03d1649340d6b3a572206653a2a2b (patch) | |
tree | 7b8791eed46bbfa82f777ca25282c434270fdf50 /fs | |
parent | 1f730e3b530fb2fa3159df06405c83f9a6fbbd83 (diff) | |
download | linux-3.10-6b3f6b5b87f03d1649340d6b3a572206653a2a2b.tar.gz linux-3.10-6b3f6b5b87f03d1649340d6b3a572206653a2a2b.tar.bz2 linux-3.10-6b3f6b5b87f03d1649340d6b3a572206653a2a2b.zip |
[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')
-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 52b24053953..44fed10af0d 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) #define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */ #define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */ -/* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */ -/* we may well need to fine-tune this if it ever becomes an issue. */ -#define DQUOT_MAX_HEURISTIC 1024 /* NR_DQUOTS */ -#define ndquot DQUOT_MAX_HEURISTIC - -/* IRIX uses the current size of the name cache to guess a good value */ -/* - this isn't the same but is a good enough starting point for now. */ -#define DQUOT_HASH_HEURISTIC files_stat.nr_files - -/* IRIX inodes maintain the project ID also, zero this field on Linux */ -#define DEFAULT_PROJID 0 -#define dfltprid DEFAULT_PROJID - +#define dfltprid 0 #define MAXPATHLEN 1024 #define MIN(a,b) (min(a,b)) diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 79aadb1c1f4..1aea42d71a6 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c @@ -60,8 +60,9 @@ * quota functionality, including maintaining the freelist and hash * tables of dquots. */ -mutex_t xfs_Gqm_lock; +mutex_t xfs_Gqm_lock; struct xfs_qm *xfs_Gqm; +uint ndquot; kmem_zone_t *qm_dqzone; kmem_zone_t *qm_dqtrxzone; @@ -108,25 +109,25 @@ extern mutex_t qcheck_lock; STATIC struct xfs_qm * xfs_Gqm_init(void) { - xfs_qm_t *xqm; - int hsize, i; - - xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP); - ASSERT(xqm); + xfs_dqhash_t *udqhash, *gdqhash; + xfs_qm_t *xqm; + uint i, hsize, flags = KM_SLEEP | KM_MAYFAIL; /* * Initialize the dquot hash tables. */ - hsize = (DQUOT_HASH_HEURISTIC < XFS_QM_NCSIZE_THRESHOLD) ? - XFS_QM_HASHSIZE_LOW : XFS_QM_HASHSIZE_HIGH; - xqm->qm_dqhashmask = hsize - 1; + hsize = XFS_QM_HASHSIZE_HIGH; + while (!(udqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), flags))) { + if ((hsize >>= 1) <= XFS_QM_HASHSIZE_LOW) + flags = KM_SLEEP; + } + gdqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), KM_SLEEP); + ndquot = hsize << 8; - xqm->qm_usr_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * - sizeof(xfs_dqhash_t), - KM_SLEEP); - xqm->qm_grp_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * - sizeof(xfs_dqhash_t), - KM_SLEEP); + xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP); + xqm->qm_dqhashmask = hsize - 1; + xqm->qm_usr_dqhtable = udqhash; + xqm->qm_grp_dqhtable = gdqhash; ASSERT(xqm->qm_usr_dqhtable != NULL); ASSERT(xqm->qm_grp_dqhtable != NULL); diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index 43219c97b37..12da259f2fc 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h @@ -26,6 +26,7 @@ struct xfs_qm; struct xfs_inode; +extern uint ndquot; extern mutex_t xfs_Gqm_lock; extern struct xfs_qm *xfs_Gqm; extern kmem_zone_t *qm_dqzone; @@ -51,9 +52,8 @@ extern kmem_zone_t *qm_dqtrxzone; /* * Dquot hashtable constants/threshold values. */ -#define XFS_QM_NCSIZE_THRESHOLD 5000 -#define XFS_QM_HASHSIZE_LOW 32 -#define XFS_QM_HASHSIZE_HIGH 64 +#define XFS_QM_HASHSIZE_LOW (NBPP / sizeof(xfs_dqhash_t)) +#define XFS_QM_HASHSIZE_HIGH ((NBPP * 4) / sizeof(xfs_dqhash_t)) /* * We output a cmn_err when quotachecking a quota file with more than |