From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-scsi <linux-scsi@vger.kernel.org>,
Al Viro <viro@ZenIV.linux.org.uk>
Subject: Re: [PATCH] scsi: sd_dif.c use unaligned access helpers
Date: Sat, 26 Jul 2008 08:26:16 -0400 [thread overview]
Message-ID: <yq1vdysj0gn.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <1217049240.5971.51.camel@brick> (Harvey Harrison's message of "Fri\, 25 Jul 2008 22\:14\:00 -0700")
>>>>> "Harvey" == Harvey Harrison <harvey.harrison@gmail.com> writes:
Harvey> So who cares what the spec says, the code is treating it as a
Harvey> host-order u16 everywhere. Similarly for the ref_tag.
Hold on. We don't know the personality of the ref_tag.
This is convoluted and I totally agree it's icky.
Each DIF tuple consists of 8 bytes. The interpretation of those 8
bytes depends on how the disk is formatted. For Type 1, 2 and 3 the
first two bytes contain the guard_tag, a big endian CRC of the data
portion of the sector. That part is easy.
The next two bytes are defined to be for use by the application client
(i.e. OS). The current SCSI spec doesn't say anything about the
contents or how they should be interpreted.
The last four bytes (reference tag) are defined as a big endian entity
for Type 1 and 2. But with Type 3 the last four bytes become part of
the opaque tag space. You can view is as they get combined with the
app tag to provide 6 bytes of space.
IOW, for Type 1 + 2 the ref tag is big endian. For Type 3 it is
undefined.
Also, for DIF Type 4 that's currently being discussed the application
tag will be used for a hash that's defined to be big endian.
So the problem is that the endianness depends on how the attached disk
is formatted.
For now we can switch the app_tag to be host endian. The only
workaround I can think of for the ref_tag is to introduce struct
sd_dif_tuple_type12 and struct sd_dif_tuple_type3 which use __be32 and
u32 respectively.
I'll muck with that later. But first I have to finish my OLS
slides...
--
Martin K. Petersen Oracle Linux Engineering
next prev parent reply other threads:[~2008-07-26 12:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 23:07 [PATCH] scsi: sd_dif.c use unaligned access helpers Harvey Harrison
2008-07-26 4:22 ` Martin K. Petersen
2008-07-26 5:14 ` Harvey Harrison
2008-07-26 12:26 ` Martin K. Petersen [this message]
2008-07-26 16:46 ` Harvey Harrison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yq1vdysj0gn.fsf@sermon.lab.mkp.net \
--to=martin.petersen@oracle.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=harvey.harrison@gmail.com \
--cc=linux-scsi@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox