]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
xfs: make xfs btree stats less huge
authorDave Chinner <dchinner@redhat.com>
Mon, 5 Dec 2016 03:38:58 +0000 (14:38 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 5 Dec 2016 03:38:58 +0000 (14:38 +1100)
commit11ef38afe98cc7ad1a46ef24945232ec1760d5e2
treeb198c9b46f06a7bcac329cd9d9a6a913ae3312ad
parent1bb33a98702d8360947f18a44349df75ba555d5d
xfs: make xfs btree stats less huge

Embedding a switch statement in every btree stats inc/add adds a lot
of code overhead to the core btree infrastructure paths. Stats are
supposed to be small and lightweight, but the btree stats have
become big and bloated as we've added more btrees. It needs fixing
because the reflink code will just add more overhead again.

Convert the v2 btree stats to arrays instead of independent
variables, and instead use the type to index the specific btree
array via an enum. This allows us to use array based indexing
to update the stats, rather than having to derefence variables
specific to the btree type.

If we then wrap the xfsstats structure in a union and place uint32_t
array beside it, and calculate the correct btree stats array base
array index when creating a btree cursor,  we can easily access
entries in the stats structure without having to switch names based
on the btree type.

We then replace with the switch statement with a simple set of stats
wrapper macros, resulting in a significant simplification of the
btree stats code, and:

   text    data     bss     dec     hex filename
  48905     144       8   49057    bfa1 fs/xfs/libxfs/xfs_btree.o.old
  36793     144       8   36945    9051 fs/xfs/libxfs/xfs_btree.o

it reduces the core btree infrastructure code size by close to 25%!

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_alloc_btree.c
fs/xfs/libxfs/xfs_bmap_btree.c
fs/xfs/libxfs/xfs_btree.h
fs/xfs/libxfs/xfs_ialloc_btree.c
fs/xfs/libxfs/xfs_refcount_btree.c
fs/xfs/libxfs/xfs_rmap_btree.c
fs/xfs/xfs_stats.c
fs/xfs/xfs_stats.h