diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-03-13 04:52:35 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-03-14 12:09:06 -0400 |
commit | 9f920f116426806bfa34c1422742e1bf7b7a2b4b (patch) | |
tree | 3ec0a4f006dc10ed56e5bec1b605f5ecbb3a3275 /fs/xfs/xfs_qm.h | |
parent | f8739c3ce2ac9a01515b56026b6a066c0808234b (diff) |
xfs: use per-filesystem radix trees for dquot lookup
Replace the global hash tables for looking up in-memory dquot structures
with per-filesystem radix trees to allow scaling to a large number of
in-memory dquot structures.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_qm.h')
-rw-r--r-- | fs/xfs/xfs_qm.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h index c236bba9bfab..8f4b117823cc 100644 --- a/fs/xfs/xfs_qm.h +++ b/fs/xfs/xfs_qm.h | |||
@@ -31,12 +31,6 @@ extern kmem_zone_t *qm_dqzone; | |||
31 | extern kmem_zone_t *qm_dqtrxzone; | 31 | extern kmem_zone_t *qm_dqtrxzone; |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * Dquot hashtable constants/threshold values. | ||
35 | */ | ||
36 | #define XFS_QM_HASHSIZE_LOW (PAGE_SIZE / sizeof(xfs_dqhash_t)) | ||
37 | #define XFS_QM_HASHSIZE_HIGH ((PAGE_SIZE * 4) / sizeof(xfs_dqhash_t)) | ||
38 | |||
39 | /* | ||
40 | * This defines the unit of allocation of dquots. | 34 | * This defines the unit of allocation of dquots. |
41 | * Currently, it is just one file system block, and a 4K blk contains 30 | 35 | * Currently, it is just one file system block, and a 4K blk contains 30 |
42 | * (136 * 30 = 4080) dquots. It's probably not worth trying to make | 36 | * (136 * 30 = 4080) dquots. It's probably not worth trying to make |
@@ -47,15 +41,10 @@ extern kmem_zone_t *qm_dqtrxzone; | |||
47 | */ | 41 | */ |
48 | #define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 | 42 | #define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 |
49 | 43 | ||
50 | typedef xfs_dqhash_t xfs_dqlist_t; | ||
51 | |||
52 | /* | 44 | /* |
53 | * Quota Manager (global) structure. Lives only in core. | 45 | * Quota Manager (global) structure. Lives only in core. |
54 | */ | 46 | */ |
55 | typedef struct xfs_qm { | 47 | typedef struct xfs_qm { |
56 | xfs_dqlist_t *qm_usr_dqhtable;/* udquot hash table */ | ||
57 | xfs_dqlist_t *qm_grp_dqhtable;/* gdquot hash table */ | ||
58 | uint qm_dqhashmask; /* # buckets in dq hashtab - 1 */ | ||
59 | uint qm_nrefs; /* file systems with quota on */ | 48 | uint qm_nrefs; /* file systems with quota on */ |
60 | kmem_zone_t *qm_dqzone; /* dquot mem-alloc zone */ | 49 | kmem_zone_t *qm_dqzone; /* dquot mem-alloc zone */ |
61 | kmem_zone_t *qm_dqtrxzone; /* t_dqinfo of transactions */ | 50 | kmem_zone_t *qm_dqtrxzone; /* t_dqinfo of transactions */ |
@@ -66,6 +55,9 @@ typedef struct xfs_qm { | |||
66 | * The mount structure keeps a pointer to this. | 55 | * The mount structure keeps a pointer to this. |
67 | */ | 56 | */ |
68 | typedef struct xfs_quotainfo { | 57 | typedef struct xfs_quotainfo { |
58 | struct radix_tree_root qi_uquota_tree; | ||
59 | struct radix_tree_root qi_gquota_tree; | ||
60 | struct mutex qi_tree_lock; | ||
69 | xfs_inode_t *qi_uquotaip; /* user quota inode */ | 61 | xfs_inode_t *qi_uquotaip; /* user quota inode */ |
70 | xfs_inode_t *qi_gquotaip; /* group quota inode */ | 62 | xfs_inode_t *qi_gquotaip; /* group quota inode */ |
71 | struct list_head qi_lru_list; | 63 | struct list_head qi_lru_list; |
@@ -94,6 +86,11 @@ typedef struct xfs_quotainfo { | |||
94 | struct shrinker qi_shrinker; | 86 | struct shrinker qi_shrinker; |
95 | } xfs_quotainfo_t; | 87 | } xfs_quotainfo_t; |
96 | 88 | ||
89 | #define XFS_DQUOT_TREE(qi, type) \ | ||
90 | ((type & XFS_DQ_USER) ? \ | ||
91 | &((qi)->qi_uquota_tree) : \ | ||
92 | &((qi)->qi_gquota_tree)) | ||
93 | |||
97 | 94 | ||
98 | extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); | 95 | extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); |
99 | extern int xfs_trans_reserve_quota_bydquots(xfs_trans_t *, xfs_mount_t *, | 96 | extern int xfs_trans_reserve_quota_bydquots(xfs_trans_t *, xfs_mount_t *, |