From: Hannes Reinecke <hare@suse.de>
To: linux-scsi@vger.kernel.org
Cc: James Bottomley <jbottomley@parallels.com>,
Jeremy Linton <jlinton@tributary.com>,
Robert Elliott <Elliott@hp.com>,
Bart Van Assche <bvanassche@acm.org>,
Hannes Reinecke <hare@suse.de>
Subject: [PATCH 1/4] scsi_scan: Fixup scsilun_to_int()
Date: Tue, 19 Feb 2013 09:18:00 +0100 [thread overview]
Message-ID: <1361261883-41467-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1361261883-41467-1-git-send-email-hare@suse.de>
scsilun_to_int() has an error which prevents it from generating
correct LUN numbers for 64bit values.
Also we should remove the misleading comment about portions of
the LUN being ignored; the initiator should treat the LUN as
an opaque value.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/scsi/scsi_scan.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 3e58b22..4f315f5 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1228,14 +1228,11 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
* truncation before using this function.
*
* Notes:
- * The struct scsi_lun is assumed to be four levels, with each level
- * effectively containing a SCSI byte-ordered (big endian) short; the
- * addressing bits of each level are ignored (the highest two bits).
* For a description of the LUN format, post SCSI-3 see the SCSI
* Architecture Model, for SCSI-3 see the SCSI Controller Commands.
*
- * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns
- * the integer: 0x0b030a04
+ * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function
+ * returns the integer: 0x0b030a04
**/
int scsilun_to_int(struct scsi_lun *scsilun)
{
@@ -1244,7 +1241,7 @@ int scsilun_to_int(struct scsi_lun *scsilun)
lun = 0;
for (i = 0; i < sizeof(lun); i += 2)
- lun = lun | (((scsilun->scsi_lun[i] << 8) |
+ lun = lun | (((scsilun->scsi_lun[i] << ((i + 1) * 8)) |
scsilun->scsi_lun[i + 1]) << (i * 8));
return lun;
}
--
1.7.4.2
next prev parent reply other threads:[~2013-02-19 8:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-19 8:17 [PATCH 0/4] scsi: 64-bit LUN support Hannes Reinecke
2013-02-19 8:18 ` Hannes Reinecke [this message]
2013-02-19 8:18 ` [PATCH 2/4] scsi: use 64-bit LUNs Hannes Reinecke
2013-02-25 15:33 ` Steffen Maier
2013-02-25 15:52 ` Hannes Reinecke
2013-02-25 17:08 ` Douglas Gilbert
2013-02-19 8:18 ` [PATCH 3/4] scsi: use 64-bit value for 'max_luns' Hannes Reinecke
2013-02-19 16:30 ` Michael Christie
2013-02-19 16:33 ` James Bottomley
2013-02-20 6:43 ` Hannes Reinecke
2013-02-19 8:18 ` [PATCH 4/4] scsi: Remove CONFIG_SCSI_MULTI_LUN Hannes Reinecke
2013-02-21 16:15 ` [PATCH 0/4] scsi: 64-bit LUN support Elliott, Robert (Server Storage)
2013-02-21 16:32 ` James Bottomley
2013-02-25 16:02 ` Douglas Gilbert
2013-02-23 9:31 ` Hannes Reinecke
2013-03-26 18:00 ` Chad Dupuis
2013-03-26 19:03 ` Douglas Gilbert
2013-03-27 7:37 ` Hannes Reinecke
2013-03-27 11:58 ` Chad Dupuis
2013-03-29 16:32 ` Tomas Henzl
2013-03-30 16:53 ` Hannes Reinecke
2013-03-31 17:44 ` Tomas Henzl
2013-04-04 10:17 ` Hannes Reinecke
2013-04-05 15:24 ` James Smart
2013-04-08 14:06 ` Hannes Reinecke
2013-04-08 15:37 ` Tomas Henzl
2013-04-09 7:38 ` Hannes Reinecke
2013-04-09 14:27 ` Elliott, Robert (Server Storage)
2013-04-09 14:52 ` Hannes Reinecke
-- strict thread matches above, loose matches on Subject: below --
2013-02-20 13:47 [PATCH v2 " Hannes Reinecke
2013-02-20 13:47 ` [PATCH 1/4] scsi_scan: Fixup scsilun_to_int() Hannes Reinecke
2013-03-04 18:22 ` Douglas Gilbert
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=1361261883-41467-2-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=Elliott@hp.com \
--cc=bvanassche@acm.org \
--cc=jbottomley@parallels.com \
--cc=jlinton@tributary.com \
--cc=linux-scsi@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).