xfs
[Top] [All Lists]

***** SUSPECTED SPAM ***** Re: [PATCH 06/49] libxfs: fix byte swapping

To: Mark Tinguely <tinguely@xxxxxxx>
Subject: ***** SUSPECTED SPAM ***** Re: [PATCH 06/49] libxfs: fix byte swapping on constants
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 12 Aug 2013 10:03:34 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Importance: Low
In-reply-to: <51FBB978.2040207@xxxxxxx>
References: <1374216324-8781-1-git-send-email-david@xxxxxxxxxxxxx> <1374216324-8781-7-git-send-email-david@xxxxxxxxxxxxx> <51FBB978.2040207@xxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Aug 02, 2013 at 08:51:52AM -0500, Mark Tinguely wrote:
> On 07/19/13 01:44, Dave Chinner wrote:
> >From: Dave Chinner<dchinner@xxxxxxxxxx>
> >
> >The kernel code uses cpu_to_beXX() on constants in switch()
> >statements for magic numbers in the btree code. Th ebyte swapping
> >infratructure isn't hooked up to the proper byte swap macros to make
> >this work, so fix it and then swap all the generic btree code over
> >to match the kernel code.
> >
> >Signed-off-by: Dave Chinner<dchinner@xxxxxxxxxx>
> >---
> 
> sync to include/uapi/linux/swab.h and (IMO backwards) switch/case
> statements in xfs_allocbt_verify() like kernel commit ee1a47ab.

The reason they are done that way is so that the compiler evalutes
the byte swap rather than doing it at runtime. i.e runtime only
requires a comparisons, instead of a endian swap then a
comparison. Hence we end up with smaller, faster code...

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>