Lots of xfs code does endian-flipping of on-disk data, but in the
case where we're setting to zero or testing for zero, endian-flipping
is a waste of time. There are stock macros for this: INT_ZERO and
INT_ISZERO, they just do "= 0" and "== 0" respectively.
So, where used to do
INT_SET(var, ARCH_CONVERT, 0)
now we do
INT_ZERO(var, ARCH_CONVERT)
and we don't endian-flip the zero.
Same for
if (INT_GET(var, ARCH_CONVERT) == 0)
changed to
if (INT_ISZERO(var, ARCH_CONVERT))
so we don't flip "var" before testing whether it's zero.
Doing these via the macros is good, because it points out that
in general, these variables still need endian care.
This change should shrink the size of xfs a fair amount (I think
I saw ~20k on my fully-loaded xfs.o) and may even speed up the
code a bit. A few more changes in this respect coming tomorrow...
This mod also touches a LOT of lines, so if odd things start
happening... shout. :)
-Eric
Date: Mon Apr 1 14:46:06 PST 2002
Workarea: stout.americas.sgi.com:/localhome/eric/2.4.x-xfs/workarea-endian
The following file(s) were checked into:
bonnie.engr.sgi.com:/isms/slinx/2.4.x-xfs
Modid: 2.4.x-xfs:slinx:115339a
linux/fs/xfs/xfs_trans_dquot.c - 1.34
linux/fs/xfs/xfsidbg.c - 1.179
linux/fs/xfs/xfs_quota_priv.h - 1.20
linux/fs/xfs/xfs_ialloc.c - 1.152
linux/fs/xfs/xfs_da_btree.c - 1.125
linux/fs/xfs/xfs_dir2_block.c - 1.22
linux/fs/xfs/xfs_qm_syscalls.c - 1.57
linux/fs/xfs/xfs_dquot.c - 1.60
linux/fs/xfs/xfs_dir_leaf.c - 1.99
linux/fs/xfs/xfs_btree.c - 1.96
linux/fs/xfs/xfs_dir2_data.c - 1.16
linux/fs/xfs/xfs_inode.c - 1.332
linux/fs/xfs/xfs_dir2_leaf.c - 1.25
linux/fs/xfs/xfs_attr_leaf.c - 1.57
linux/fs/xfs/xfs_alloc.c - 1.148
linux/fs/xfs/xfs_fsops.c - 1.74
linux/fs/xfs/xfs_dir2_node.c - 1.22
linux/fs/xfs/xfs_attr.c - 1.89
linux/fs/xfs/xfs_dinode.h - 1.59
- Optimize endian flipping code when setting to or testing for zero
Use INT_ZERO and INT_ISZERO instead of INT_SET and INT_GET
|