kernel-ark/fs/xfs
Dave Chinner 1c1c6ebcf5 xfs: Replace per-ag array with a radix tree
The use of an array for the per-ag structures requires reallocation
of the array when growing the filesystem. This requires locking
access to the array to avoid use after free situations, and the
locking is difficult to get right. To avoid needing to reallocate an
array, change the per-ag structures to an allocated object per ag
and index them using a tree structure.

The AGs are always densely indexed (hence the use of an array), but
the number supported is 2^32 and lookups tend to be random and hence
indexing needs to scale. A simple choice is a radix tree - it works
well with this sort of index.  This change also removes another
large contiguous allocation from the mount/growfs path in XFS.

The growing process now needs to change to only initialise the new
AGs required for the extra space, and as such only needs to
exclusively lock the tree for inserts. The rest of the code only
needs to lock the tree while doing lookups, and hence this will
remove all the deadlocks that currently occur on the m_perag_lock as
it is now an innermost lock. The lock is also changed to a spinlock
from a read/write lock as the hold time is now extremely short.

To complete the picture, the per-ag structures will need to be
reference counted to ensure that we don't free/modify them while
they are still in use.  This will be done in subsequent patch.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
2010-01-15 15:33:52 -06:00
..
linux-2.6 xfs: rename xfs_get_perag 2010-01-15 15:33:02 -06:00
quota xfs: reclaim inodes under a write lock 2010-01-15 13:43:55 -06:00
support xfs: event tracing support 2009-12-14 23:08:16 -06:00
Kconfig xfs: use generic Posix ACL code 2009-06-10 17:07:47 +02:00
Makefile xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_acl.h sanitize xattr handler prototypes 2009-12-16 12:16:49 -05:00
xfs_ag.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_alloc_btree.c xfs: Don't directly reference m_perag in allocation code 2010-01-15 15:33:12 -06:00
xfs_alloc_btree.h
xfs_alloc.c xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_alloc.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_arch.h xfs: use generic Posix ACL code 2009-06-10 17:07:47 +02:00
xfs_attr_leaf.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_attr_leaf.h
xfs_attr_sf.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_attr.c xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_attr.h xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_bit.c
xfs_bit.h
xfs_bmap_btree.c xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_bmap_btree.h xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_bmap.c xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_bmap.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_btree_trace.c
xfs_btree_trace.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_btree.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_btree.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_buf_item.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_buf_item.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_da_btree.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_da_btree.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dfrag.c xfs: clean up inconsistent variable naming in xfs_swap_extent 2010-01-15 15:31:23 -06:00
xfs_dfrag.h xfs: clean up inconsistent variable naming in xfs_swap_extent 2010-01-15 15:31:23 -06:00
xfs_dinode.h
xfs_dir2_block.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2_block.h
xfs_dir2_data.c
xfs_dir2_data.h
xfs_dir2_leaf.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2_leaf.h
xfs_dir2_node.c xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_dir2_node.h xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_dir2_sf.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2_sf.h
xfs_dir2.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2.h
xfs_dmapi.h
xfs_dmops.c
xfs_error.c
xfs_error.h
xfs_extfree_item.c
xfs_extfree_item.h
xfs_filestream.c xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_filestream.h xfs: Convert filestreams code to use per-ag get/put routines 2010-01-15 15:33:22 -06:00
xfs_fs.h trivial: fix typo "for for" in multiple files 2009-09-21 15:14:54 +02:00
xfs_fsops.c xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_fsops.h
xfs_ialloc_btree.c
xfs_ialloc_btree.h
xfs_ialloc.c xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_ialloc.h xfs: rationalize xfs_inobt_lookup* 2009-09-01 12:45:39 -05:00
xfs_iget.c xfs: rename xfs_get_perag 2010-01-15 15:33:02 -06:00
xfs_inode_item.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_inode_item.h xfs: kill xfs_bmbt_rec_32/64 types 2009-12-16 13:41:20 -06:00
xfs_inode.c xfs: convert remaining direct references to m_perag 2010-01-15 15:33:39 -06:00
xfs_inode.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_inum.h xfs: remove XFS_INO64_OFFSET 2009-08-31 14:46:22 -05:00
xfs_iomap.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_iomap.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_itable.c xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_itable.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_log_priv.h xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_log_recover.c xfs: Use list_heads for log recovery item lists 2010-01-15 15:31:51 -06:00
xfs_log_recover.h xfs: Use list_heads for log recovery item lists 2010-01-15 15:31:51 -06:00
xfs_log.c xfs: improve metadata I/O merging in the elevator 2009-12-16 13:41:19 -06:00
xfs_log.h
xfs_mount.c xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_mount.h xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_mru_cache.c xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_mru_cache.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_quota.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_refcache.h
xfs_rename.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_rtalloc.c xfs: fix missing error check in xfs_rtfree_range 2010-01-15 13:46:19 -06:00
xfs_rtalloc.h
xfs_rw.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_rw.h xfs: uninline xfs_get_extsz_hint 2009-12-11 15:11:22 -06:00
xfs_sb.h
xfs_trans_ail.c xfs: Don't wake the aild once per second 2010-01-15 15:32:46 -06:00
xfs_trans_buf.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_trans_extfree.c
xfs_trans_inode.c xfs: simplify xfs_trans_iget 2009-09-01 12:46:16 -05:00
xfs_trans_item.c
xfs_trans_priv.h
xfs_trans_space.h
xfs_trans.c xfs: I/O completion handlers must use NOFS allocations 2009-12-11 15:11:20 -06:00
xfs_trans.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_types.h
xfs_utils.c xfs: kill xfs_qmops 2009-06-08 15:33:32 +02:00
xfs_utils.h
xfs_vnodeops.c xfs: fix timestamp handling in xfs_setattr 2010-01-10 12:21:58 -06:00
xfs_vnodeops.h xfs: simplify inode teardown 2009-12-11 15:11:19 -06:00
xfs.h xfs: event tracing support 2009-12-14 23:08:16 -06:00