diff options
author | Christoph Hellwig <hch@lst.de> | 2011-07-08 08:36:05 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2011-07-08 08:36:05 -0400 |
commit | 69ef921b55cc3788d1d2a27b33b27d04acd0090a (patch) | |
tree | bcc7c1f4b7f15628f122dfdb96f8d4d37f587e92 /fs/xfs/xfs_attr.c | |
parent | 218106a1104c598011e5df9d9aac7e0416be03e6 (diff) |
xfs: byteswap constants instead of variables
Micro-optimize various comparisms by always byteswapping the constant
instead of the variable, which allows to do the swap at compile instead
of runtime.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 795d5aac7042..cbae424fe1ba 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -1203,7 +1203,7 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context) | |||
1203 | return XFS_ERROR(error); | 1203 | return XFS_ERROR(error); |
1204 | ASSERT(bp != NULL); | 1204 | ASSERT(bp != NULL); |
1205 | leaf = bp->data; | 1205 | leaf = bp->data; |
1206 | if (unlikely(be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC)) { | 1206 | if (unlikely(leaf->hdr.info.magic != cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) { |
1207 | XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW, | 1207 | XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW, |
1208 | context->dp->i_mount, leaf); | 1208 | context->dp->i_mount, leaf); |
1209 | xfs_da_brelse(NULL, bp); | 1209 | xfs_da_brelse(NULL, bp); |
@@ -1610,9 +1610,8 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1610 | XFS_ATTR_FORK); | 1610 | XFS_ATTR_FORK); |
1611 | if (error) | 1611 | if (error) |
1612 | goto out; | 1612 | goto out; |
1613 | ASSERT(be16_to_cpu(((xfs_attr_leafblock_t *) | 1613 | ASSERT((((xfs_attr_leafblock_t *)bp->data)->hdr.info.magic) == |
1614 | bp->data)->hdr.info.magic) | 1614 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1615 | == XFS_ATTR_LEAF_MAGIC); | ||
1616 | 1615 | ||
1617 | if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { | 1616 | if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { |
1618 | xfs_bmap_init(args->flist, args->firstblock); | 1617 | xfs_bmap_init(args->flist, args->firstblock); |
@@ -1877,11 +1876,11 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1877 | return(XFS_ERROR(EFSCORRUPTED)); | 1876 | return(XFS_ERROR(EFSCORRUPTED)); |
1878 | } | 1877 | } |
1879 | node = bp->data; | 1878 | node = bp->data; |
1880 | if (be16_to_cpu(node->hdr.info.magic) | 1879 | if (node->hdr.info.magic == |
1881 | == XFS_ATTR_LEAF_MAGIC) | 1880 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) |
1882 | break; | 1881 | break; |
1883 | if (unlikely(be16_to_cpu(node->hdr.info.magic) | 1882 | if (unlikely(node->hdr.info.magic != |
1884 | != XFS_DA_NODE_MAGIC)) { | 1883 | cpu_to_be16(XFS_DA_NODE_MAGIC))) { |
1885 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(3)", | 1884 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(3)", |
1886 | XFS_ERRLEVEL_LOW, | 1885 | XFS_ERRLEVEL_LOW, |
1887 | context->dp->i_mount, | 1886 | context->dp->i_mount, |
@@ -1916,8 +1915,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1916 | */ | 1915 | */ |
1917 | for (;;) { | 1916 | for (;;) { |
1918 | leaf = bp->data; | 1917 | leaf = bp->data; |
1919 | if (unlikely(be16_to_cpu(leaf->hdr.info.magic) | 1918 | if (unlikely(leaf->hdr.info.magic != |
1920 | != XFS_ATTR_LEAF_MAGIC)) { | 1919 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) { |
1921 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)", | 1920 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)", |
1922 | XFS_ERRLEVEL_LOW, | 1921 | XFS_ERRLEVEL_LOW, |
1923 | context->dp->i_mount, leaf); | 1922 | context->dp->i_mount, leaf); |