Re: [PATCH] scsi: sd_dif.c use unaligned access helpers

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

 



>>>>> "Harvey" == Harvey Harrison <harvey.harrison@xxxxxxxxx> writes:

[Sorry about the delayed response.  I've been traveling for a few
days.]

Harvey> This code should be looked at carefully, while this patch
Harvey> doesn't change any behaviour, the handling of app_tag, ref_tag
Harvey> seems odd.  The struct defines both as __be16/32 but in these
Harvey> locations it is read in/written out as cpu-byteorder.

The opaque tag space (app in Type 1+2, app + ref in Type 3) is
provided for use by filesystems.  The SCSI layer doesn't know anything
about the contents of the tag buffer.  It has no idea whether it
contains bytes, shorts, ints or longs.  So we can't swab on the
assumption that each DIF tuple contains an u16.  Just like we don't
byteswap any other data coming down from above.

Filesystems must prepare tags in an endianness-aware fashion just like
they prepare normal filesystem metadata.  And at the SCSI layer we
treat it as a byte stream.


Harvey> It looks like they should actually be u16/u32.

Guard + ref tags are interpreted by the HBA and storage device and
they are defined to be big endian.

Consequently the DIF tuple tags are defined as __be16 and __be32 to be
in sync with the spec.  But from a protocol perspective the notion of
endianness of the application tag is essentially meaningless.  It is
not interpreted by anybody else than the filesystem.

-- 
Martin K. Petersen	Oracle Linux Engineering
--
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