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_ialloc.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_ialloc.c')
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 84ebeec16642..dd5628bd8d0b 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -683,7 +683,7 @@ xfs_dialloc( | |||
683 | return 0; | 683 | return 0; |
684 | } | 684 | } |
685 | agi = XFS_BUF_TO_AGI(agbp); | 685 | agi = XFS_BUF_TO_AGI(agbp); |
686 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 686 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
687 | } else { | 687 | } else { |
688 | /* | 688 | /* |
689 | * Continue where we left off before. In this case, we | 689 | * Continue where we left off before. In this case, we |
@@ -691,7 +691,7 @@ xfs_dialloc( | |||
691 | */ | 691 | */ |
692 | agbp = *IO_agbp; | 692 | agbp = *IO_agbp; |
693 | agi = XFS_BUF_TO_AGI(agbp); | 693 | agi = XFS_BUF_TO_AGI(agbp); |
694 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 694 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
695 | ASSERT(be32_to_cpu(agi->agi_freecount) > 0); | 695 | ASSERT(be32_to_cpu(agi->agi_freecount) > 0); |
696 | } | 696 | } |
697 | mp = tp->t_mountp; | 697 | mp = tp->t_mountp; |
@@ -775,7 +775,7 @@ nextag: | |||
775 | if (error) | 775 | if (error) |
776 | goto nextag; | 776 | goto nextag; |
777 | agi = XFS_BUF_TO_AGI(agbp); | 777 | agi = XFS_BUF_TO_AGI(agbp); |
778 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 778 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
779 | } | 779 | } |
780 | /* | 780 | /* |
781 | * Here with an allocation group that has a free inode. | 781 | * Here with an allocation group that has a free inode. |
@@ -944,7 +944,7 @@ nextag: | |||
944 | * See if the most recently allocated block has any free. | 944 | * See if the most recently allocated block has any free. |
945 | */ | 945 | */ |
946 | newino: | 946 | newino: |
947 | if (be32_to_cpu(agi->agi_newino) != NULLAGINO) { | 947 | if (agi->agi_newino != cpu_to_be32(NULLAGINO)) { |
948 | error = xfs_inobt_lookup(cur, be32_to_cpu(agi->agi_newino), | 948 | error = xfs_inobt_lookup(cur, be32_to_cpu(agi->agi_newino), |
949 | XFS_LOOKUP_EQ, &i); | 949 | XFS_LOOKUP_EQ, &i); |
950 | if (error) | 950 | if (error) |
@@ -1085,7 +1085,7 @@ xfs_difree( | |||
1085 | return error; | 1085 | return error; |
1086 | } | 1086 | } |
1087 | agi = XFS_BUF_TO_AGI(agbp); | 1087 | agi = XFS_BUF_TO_AGI(agbp); |
1088 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 1088 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
1089 | ASSERT(agbno < be32_to_cpu(agi->agi_length)); | 1089 | ASSERT(agbno < be32_to_cpu(agi->agi_length)); |
1090 | /* | 1090 | /* |
1091 | * Initialize the cursor. | 1091 | * Initialize the cursor. |
@@ -1438,7 +1438,7 @@ xfs_ialloc_log_agi( | |||
1438 | xfs_agi_t *agi; /* allocation group header */ | 1438 | xfs_agi_t *agi; /* allocation group header */ |
1439 | 1439 | ||
1440 | agi = XFS_BUF_TO_AGI(bp); | 1440 | agi = XFS_BUF_TO_AGI(bp); |
1441 | ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC); | 1441 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
1442 | #endif | 1442 | #endif |
1443 | /* | 1443 | /* |
1444 | * Compute byte offsets for the first and last fields. | 1444 | * Compute byte offsets for the first and last fields. |
@@ -1492,7 +1492,7 @@ xfs_read_agi( | |||
1492 | /* | 1492 | /* |
1493 | * Validate the magic number of the agi block. | 1493 | * Validate the magic number of the agi block. |
1494 | */ | 1494 | */ |
1495 | agi_ok = be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC && | 1495 | agi_ok = agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC) && |
1496 | XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum)) && | 1496 | XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum)) && |
1497 | be32_to_cpu(agi->agi_seqno) == agno; | 1497 | be32_to_cpu(agi->agi_seqno) == agno; |
1498 | if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IALLOC_READ_AGI, | 1498 | if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IALLOC_READ_AGI, |