Re: [RFC PATCH-mm] scsi: use unaligned endian helpers rather than byteshifting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2008-12-03 at 11:37 -0800, Harvey Harrison wrote:
> Signed-off-by: Harvey Harrison <harvey.harrison@xxxxxxxxx>
> ---
> Depends on the unaligned access work in -mm.  Just so you can see what the
> transition would look like.  See in particular the READ/WRITE6 bits
> as just reading the full 32 bits and masking ends up being better on
> lots of arches. (x86/powerpc/SH at least)

Well, as I've said before, I'm not particularly interested in moving
SCSI over to the generic accessors.  It does look like the proponents of
SCSI specific ones gave up as well (most driver writers even open coded
their own over the u32 one we already have).

However, things like this

> @@ -1479,29 +1480,18 @@ static void io_callback(void *context, struct fib * fibptr)
>  		switch (scsicmd->cmnd[0]) {
>  		case WRITE_6:
>  		case READ_6:
> -			lba = ((scsicmd->cmnd[1] & 0x1F) << 16) |
> -			    (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
> +			lba = load_be32_noalign((__be32 *)&scsicmd->cmnd[0]) & 0x1fffff;
>  			break;

Make me think absolutely no way.  It's far less readable than the
original.  The first thing that leaps to the mind of any SCSI person
seeing this is what on earth is the opcode doing loaded as part of that
expression.   It takes a bit of thought to see it's loaded and then
discarded by the and operation.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux