diff options
author | David Chinner <dgc@sgi.com> | 2007-08-28 00:00:13 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 02:50:50 -0400 |
commit | da353b0d64e070ae7c5342a0d56ec20ae9ef5cfb (patch) | |
tree | 84454023d649df67cc6b125c73746ddb341ac34e /fs/xfs/xfs_mount.c | |
parent | 39cd9f877e63ce7e02cdc7f5dbf1b908451c9532 (diff) |
[XFS] Radix tree based inode caching
One of the perpetual scaling problems XFS has is indexing it's incore
inodes. We currently uses hashes and the default hash sizes chosen can
only ever be a tradeoff between memory consumption and the maximum
realistic size of the cache.
As a result, anyone who has millions of inodes cached on a filesystem
needs to tunes the size of the cache via the ihashsize mount option to
allow decent scalability with inode cache operations.
A further problem is the separate inode cluster hash, whose size is based
on the ihashsize but is smaller, and so under certain conditions (sparse
cluster cache population) this can become a limitation long before the
inode hash is causing issues.
The following patchset removes the inode hash and cluster hash and
replaces them with radix trees to avoid the scalability limitations of the
hashes. It also reduces the size of the inodes by 3 pointers....
SGI-PV: 969561
SGI-Modid: xfs-linux-melb:xfs-kern:29481a
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index f4daf1ec9931..71f25947251d 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -160,11 +160,6 @@ xfs_mount_free( | |||
160 | xfs_mount_t *mp, | 160 | xfs_mount_t *mp, |
161 | int remove_bhv) | 161 | int remove_bhv) |
162 | { | 162 | { |
163 | if (mp->m_ihash) | ||
164 | xfs_ihash_free(mp); | ||
165 | if (mp->m_chash) | ||
166 | xfs_chash_free(mp); | ||
167 | |||
168 | if (mp->m_perag) { | 163 | if (mp->m_perag) { |
169 | int agno; | 164 | int agno; |
170 | 165 | ||
@@ -342,6 +337,17 @@ xfs_mount_validate_sb( | |||
342 | return 0; | 337 | return 0; |
343 | } | 338 | } |
344 | 339 | ||
340 | STATIC void | ||
341 | xfs_initialize_perag_icache( | ||
342 | xfs_perag_t *pag) | ||
343 | { | ||
344 | if (!pag->pag_ici_init) { | ||
345 | rwlock_init(&pag->pag_ici_lock); | ||
346 | INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC); | ||
347 | pag->pag_ici_init = 1; | ||
348 | } | ||
349 | } | ||
350 | |||
345 | xfs_agnumber_t | 351 | xfs_agnumber_t |
346 | xfs_initialize_perag( | 352 | xfs_initialize_perag( |
347 | bhv_vfs_t *vfs, | 353 | bhv_vfs_t *vfs, |
@@ -396,12 +402,14 @@ xfs_initialize_perag( | |||
396 | pag->pagi_inodeok = 1; | 402 | pag->pagi_inodeok = 1; |
397 | if (index < max_metadata) | 403 | if (index < max_metadata) |
398 | pag->pagf_metadata = 1; | 404 | pag->pagf_metadata = 1; |
405 | xfs_initialize_perag_icache(pag); | ||
399 | } | 406 | } |
400 | } else { | 407 | } else { |
401 | /* Setup default behavior for smaller filesystems */ | 408 | /* Setup default behavior for smaller filesystems */ |
402 | for (index = 0; index < agcount; index++) { | 409 | for (index = 0; index < agcount; index++) { |
403 | pag = &mp->m_perag[index]; | 410 | pag = &mp->m_perag[index]; |
404 | pag->pagi_inodeok = 1; | 411 | pag->pagi_inodeok = 1; |
412 | xfs_initialize_perag_icache(pag); | ||
405 | } | 413 | } |
406 | } | 414 | } |
407 | return index; | 415 | return index; |
@@ -1033,13 +1041,6 @@ xfs_mountfs( | |||
1033 | xfs_trans_init(mp); | 1041 | xfs_trans_init(mp); |
1034 | 1042 | ||
1035 | /* | 1043 | /* |
1036 | * Allocate and initialize the inode hash table for this | ||
1037 | * file system. | ||
1038 | */ | ||
1039 | xfs_ihash_init(mp); | ||
1040 | xfs_chash_init(mp); | ||
1041 | |||
1042 | /* | ||
1043 | * Allocate and initialize the per-ag data. | 1044 | * Allocate and initialize the per-ag data. |
1044 | */ | 1045 | */ |
1045 | init_rwsem(&mp->m_peraglock); | 1046 | init_rwsem(&mp->m_peraglock); |
@@ -1190,8 +1191,6 @@ xfs_mountfs( | |||
1190 | error3: | 1191 | error3: |
1191 | xfs_log_unmount_dealloc(mp); | 1192 | xfs_log_unmount_dealloc(mp); |
1192 | error2: | 1193 | error2: |
1193 | xfs_ihash_free(mp); | ||
1194 | xfs_chash_free(mp); | ||
1195 | for (agno = 0; agno < sbp->sb_agcount; agno++) | 1194 | for (agno = 0; agno < sbp->sb_agcount; agno++) |
1196 | if (mp->m_perag[agno].pagb_list) | 1195 | if (mp->m_perag[agno].pagb_list) |
1197 | kmem_free(mp->m_perag[agno].pagb_list, | 1196 | kmem_free(mp->m_perag[agno].pagb_list, |