Hi all, This patchset prepares the generic btree code to allow for the creation of new btree types outside of libxfs. The end goal here is for online fsck to be able to create its own in-memory btrees that will be used to improve the performance (and reduce the memory requirements of) the refcount btree. To enable this, I decided that the btree ops structure is the ideal place to encode all of the geometry information about a btree. The btree ops struture already contains the buffer ops (and hence the btree block magic numbers) as well as the key and record sizes, so it doesn't seem all that farfetched to encode the XFS_BTREE_ flags that determine the geometry (ROOT_IN_INODE, LONG_PTRS, etc). The rest of the patchset cleans up the btree functions that initialize btree blocks and btree buffers. The bulk of this work is to replace btree geometry related function call arguments with a single pointer to the ops structure, and then clean up everything else around that. As a side effect, we rename the functions. Later, Christoph Hellwig and I merged together a bunch more cleanups that he wanted to do for a while. All the btree geometry information is now in the btree ops structure, we've created an explicit btree type (ag, inode, mem) and moved the per-btree type information to a separate union. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=btree-geometry-in-ops xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=btree-geometry-in-ops --- Commits in this patchset: * xfs: consolidate btree block freeing tracepoints * xfs: consolidate btree block allocation tracepoints * xfs: set the btree cursor bc_ops in xfs_btree_alloc_cursor * xfs: drop XFS_BTREE_CRC_BLOCKS * xfs: fix imprecise logic in xchk_btree_check_block_owner * xfs: encode the btree geometry flags in the btree ops structure * xfs: remove bc_ino.flags * xfs: consolidate the xfs_alloc_lookup_* helpers * xfs: turn the allocbt cursor active field into a btree flag * xfs: extern some btree ops structures * xfs: initialize btree blocks using btree_ops structure * xfs: rename btree block/buffer init functions * xfs: btree convert xfs_btree_init_block to xfs_btree_init_buf calls * xfs: remove the unnecessary daddr paramter to _init_block * xfs: set btree block buffer ops in _init_buf * xfs: move lru refs to the btree ops structure * xfs: move the btree stats offset into struct btree_ops * xfs: factor out a xfs_btree_owner helper * xfs: factor out a btree block owner check * xfs: store the btree pointer length in struct xfs_btree_ops * xfs: split out a btree type from the btree ops geometry flags * xfs: split the per-btree union in struct xfs_btree_cur * xfs: create predicate to determine if cursor is at inode root level --- fs/xfs/libxfs/xfs_ag.c | 33 +-- fs/xfs/libxfs/xfs_ag.h | 2 fs/xfs/libxfs/xfs_alloc.c | 54 +++-- fs/xfs/libxfs/xfs_alloc_btree.c | 39 ++-- fs/xfs/libxfs/xfs_bmap.c | 58 ++---- fs/xfs/libxfs/xfs_bmap_btree.c | 59 +++--- fs/xfs/libxfs/xfs_bmap_btree.h | 3 fs/xfs/libxfs/xfs_btree.c | 365 ++++++++++++++++++------------------ fs/xfs/libxfs/xfs_btree.h | 165 +++++++++------- fs/xfs/libxfs/xfs_btree_staging.c | 20 +- fs/xfs/libxfs/xfs_btree_staging.h | 3 fs/xfs/libxfs/xfs_ialloc_btree.c | 35 ++- fs/xfs/libxfs/xfs_refcount.c | 24 +- fs/xfs/libxfs/xfs_refcount_btree.c | 24 +- fs/xfs/libxfs/xfs_rmap_btree.c | 19 +- fs/xfs/libxfs/xfs_shared.h | 9 + fs/xfs/scrub/btree.c | 29 ++- fs/xfs/scrub/newbt.c | 2 fs/xfs/scrub/trace.c | 2 fs/xfs/xfs_trace.h | 83 ++++++++ 20 files changed, 566 insertions(+), 462 deletions(-)