From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: linux-scsi <linux-scsi@vger.kernel.org>,
James Bottomley <James.Bottomley@suse.de>
Cc: Christoph Hellwig <hch@lst.de>,
Mike Christie <michaelc@cs.wisc.edu>,
Hannes Reinecke <hare@suse.de>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Boaz Harrosh <bharrosh@panasas.com>,
Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [PATCH-v2 03/14] target: Convert REPORT_LUNs to use int_to_scsilun
Date: Tue, 22 Mar 2011 20:06:34 -0700 [thread overview]
Message-ID: <1300849605-12651-4-git-send-email-nab@linux-iscsi.org> (raw)
In-Reply-To: <1300849605-12651-1-git-send-email-nab@linux-iscsi.org>
From: Nicholas Bellinger <nab@linux-iscsi.org>
This patch converts transport_core_report_lun_response() to use
drivers/scsi/scsi_scan.c:int_to_scsilun instead of using the
struct target_core_fabric_ops->pack_lun() fabric provided API vector.
It also removes the tfo->pack_lun check from target_fabric_tf_ops_check()
and will be removed from struct target_core_fabric_ops in a seperate
patch.
Reported-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
drivers/target/target_core_configfs.c | 4 ----
drivers/target/target_core_device.c | 26 +++++---------------------
2 files changed, 5 insertions(+), 25 deletions(-)
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index a5f44a6..ee6fad9 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -497,10 +497,6 @@ static int target_fabric_tf_ops_check(
printk(KERN_ERR "Missing tfo->is_state_remove()\n");
return -EINVAL;
}
- if (!(tfo->pack_lun)) {
- printk(KERN_ERR "Missing tfo->pack_lun()\n");
- return -EINVAL;
- }
/*
* We at least require tfo->fabric_make_wwn(), tfo->fabric_drop_wwn()
* tfo->fabric_make_tpg() and tfo->fabric_drop_tpg() in
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 3fb8e32..7605967 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -38,6 +38,7 @@
#include <net/sock.h>
#include <net/tcp.h>
#include <scsi/scsi.h>
+#include <scsi/scsi_device.h>
#include <target/target_core_base.h>
#include <target/target_core_device.h>
@@ -658,8 +659,7 @@ int transport_core_report_lun_response(struct se_cmd *se_cmd)
struct se_session *se_sess = SE_SESS(se_cmd);
struct se_task *se_task;
unsigned char *buf = (unsigned char *)T_TASK(se_cmd)->t_task_buf;
- u32 cdb_offset = 0, lun_count = 0, offset = 8;
- u64 i, lun;
+ u32 cdb_offset = 0, lun_count = 0, offset = 8, i;
list_for_each_entry(se_task, &T_TASK(se_cmd)->t_task_list, t_list)
break;
@@ -675,15 +675,7 @@ int transport_core_report_lun_response(struct se_cmd *se_cmd)
* a $FABRIC_MOD. In that case, report LUN=0 only.
*/
if (!(se_sess)) {
- lun = 0;
- buf[offset++] = ((lun >> 56) & 0xff);
- buf[offset++] = ((lun >> 48) & 0xff);
- buf[offset++] = ((lun >> 40) & 0xff);
- buf[offset++] = ((lun >> 32) & 0xff);
- buf[offset++] = ((lun >> 24) & 0xff);
- buf[offset++] = ((lun >> 16) & 0xff);
- buf[offset++] = ((lun >> 8) & 0xff);
- buf[offset++] = (lun & 0xff);
+ int_to_scsilun(0, (struct scsi_lun *)&buf[offset]);
lun_count = 1;
goto done;
}
@@ -703,16 +695,8 @@ int transport_core_report_lun_response(struct se_cmd *se_cmd)
if ((cdb_offset + 8) >= se_cmd->data_length)
continue;
- lun = cpu_to_be64(CMD_TFO(se_cmd)->pack_lun(deve->mapped_lun));
- buf[offset++] = ((lun >> 56) & 0xff);
- buf[offset++] = ((lun >> 48) & 0xff);
- buf[offset++] = ((lun >> 40) & 0xff);
- buf[offset++] = ((lun >> 32) & 0xff);
- buf[offset++] = ((lun >> 24) & 0xff);
- buf[offset++] = ((lun >> 16) & 0xff);
- buf[offset++] = ((lun >> 8) & 0xff);
- buf[offset++] = (lun & 0xff);
- cdb_offset += 8;
+ int_to_scsilun(deve->mapped_lun, (struct scsi_lun *)&buf[offset]);
+ cdb_offset += 16;
}
spin_unlock_irq(&SE_NODE_ACL(se_sess)->device_list_lock);
--
1.7.4.1
next prev parent reply other threads:[~2011-03-23 3:07 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 3:06 [PATCH-v2 00/14] iscsi-target: iSCSI target v4.1.0-rc1 series initial merge Nicholas A. Bellinger
2011-03-23 3:06 ` Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 01/14] iscsi: Resolve iscsi_proto.h naming conflicts with drivers/target/iscsi Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 02/14] iscsi: Add Serial Number Arithmetic LT and GT into iscsi_proto.h Nicholas A. Bellinger
2011-03-23 3:06 ` Nicholas A. Bellinger [this message]
2011-03-23 3:06 ` [PATCH-v2 04/14] iscsi-target: Add iSCSI fabric support for target v4 Nicholas A. Bellinger
2011-04-07 7:34 ` Mike Christie
2011-05-09 16:22 ` Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 05/14] iscsi-target: Add TCM v4 compatiable ConfigFS control plane Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 06/14] iscsi-target: Add configfs fabric dependent statistics Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 07/14] iscsi-target: Add TPG and Device logic Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 08/14] iscsi-target: Add iSCSI Login Negotiation and Parameter logic Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 09/14] iscsi-target: Add CHAP Authentication support using libcrypto Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 10/14] iscsi-target: Add Sequence/PDU list + DataIN response logic Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 11/14] iscsi-target: Add iSCSI Error Recovery Hierarchy support Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 12/14] iscsi-target: Add support for task management operations Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 13/14] iscsi-target: Add misc utility and debug logic Nicholas A. Bellinger
2011-03-23 3:06 ` [PATCH-v2 14/14] iscsi-target: Add Makefile/Kconfig and update TCM top level Nicholas A. Bellinger
2011-03-23 8:54 ` [PATCH-v2 00/14] iscsi-target: iSCSI target v4.1.0-rc1 series initial merge FUJITA Tomonori
2011-03-23 10:22 ` Nicholas A. Bellinger
2011-03-23 11:07 ` FUJITA Tomonori
2011-03-23 21:37 ` Nicholas A. Bellinger
2011-03-23 22:46 ` FUJITA Tomonori
2011-03-23 23:28 ` Nicholas A. Bellinger
2011-03-24 1:29 ` FUJITA Tomonori
2011-03-24 6:59 ` Nicholas A. Bellinger
2011-03-25 0:18 ` James Bottomley
2011-03-25 11:31 ` Bart Van Assche
2011-03-25 15:06 ` James Bottomley
2011-03-25 18:44 ` Bart Van Assche
2011-03-25 19:34 ` James Bottomley
2011-03-25 19:49 ` Bart Van Assche
2011-03-25 19:54 ` James Bottomley
2011-03-25 20:05 ` Bart Van Assche
2011-03-25 21:14 ` Nicholas A. Bellinger
2011-03-27 10:02 ` FUJITA Tomonori
2011-03-28 8:30 ` Nicholas A. Bellinger
2011-03-28 8:33 ` FUJITA Tomonori
2011-03-27 10:02 ` FUJITA Tomonori
2011-03-28 8:53 ` Nicholas A. Bellinger
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=1300849605-12651-4-git-send-email-nab@linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=James.Bottomley@suse.de \
--cc=bharrosh@panasas.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
/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).