]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: avoid unnecessary runtime sibling pointer endian conversions
authorDave Chinner <dchinner@redhat.com>
Fri, 27 May 2022 00:20:45 +0000 (10:20 +1000)
committerDave Chinner <david@fromorbit.com>
Fri, 27 May 2022 00:20:45 +0000 (10:20 +1000)
commitdc8c2899d8f8fb0a28ecb537ecfd994cec31a03f
tree435ead0e961e501d32c38ebefe43067c507a2d14
parent8b37d9d0004f0e6adbb647a1cdc0066b6e0df931
xfs: avoid unnecessary runtime sibling pointer endian conversions

Commit 3a30bb457c95 has caused a small aim7 regression, showing a
small increase in CPU usage in __xfs_btree_check_sblock() as a
result of the extra checking.

This is likely due to the endian conversion of the sibling poitners
being unconditional instead of relying on the compiler to endian
convert the NULL pointer at compile time and avoiding the runtime
conversion for this common case.

Rework the checks so that endian conversion of the sibling pointers
is only done if they are not null as the original code did.

.... and these need to be "inline" because the compiler completely
fails to inline them automatically like it should be doing.

$ size fs/xfs/libxfs/xfs_btree.o*
   text    data     bss     dec     hex filename
  51874     240       0   52114    cb92 fs/xfs/libxfs/xfs_btree.o.orig
  51562     240       0   51802    ca5a fs/xfs/libxfs/xfs_btree.o.inline

Just when you think the tools have advanced sufficiently we don't
have to care about stuff like this anymore, along comes a reminder
that *our tools still suck*.

Fixes: 3a30bb457c95 ("xfs: detect self referencing btree sibling pointers")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_btree.c