aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2012-01-19 16:39:11 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2012-02-25 17:37:46 -0500
commite35fa8c2d0feb977c2f7d14a973b4132483ffef3 (patch)
tree51e22df14dcef278c0eb6a3433b06e48a18a6d09
parent8e94b8db6121570f5ceb1aede9b28db93461cb86 (diff)
scsi: Use struct scsi_lun in fc/fcp.h
This allows us to use scsilun_to_int without an ugly cast. Fix up places that use scsilun_to_int on fcp->fc_lun accordingly. In fc target, this leaves ft_cmd.lun unused, so remove it. Signed-off-by: Andy Grover <agrover@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Kiran Patil <kiran.patil@intel.com> Cc: James Bottomley <JBottomley@Parallels.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c4
-rw-r--r--drivers/scsi/libfc/fc_fcp.c5
-rw-r--r--drivers/target/tcm_fc/tcm_fc.h1
-rw-r--r--drivers/target/tcm_fc/tfc_cmd.c11
-rw-r--r--include/scsi/fc/fc_fcp.h6
5 files changed, 11 insertions, 16 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 84a78af83f90..e897ce975bb8 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1682,9 +1682,7 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
1682 1682
1683 memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd)); 1683 memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd));
1684 1684
1685 int_to_scsilun(sc_cmd->device->lun, 1685 int_to_scsilun(sc_cmd->device->lun, &fcp_cmnd->fc_lun);
1686 (struct scsi_lun *) fcp_cmnd->fc_lun);
1687
1688 1686
1689 fcp_cmnd->fc_dl = htonl(io_req->data_xfer_len); 1687 fcp_cmnd->fc_dl = htonl(io_req->data_xfer_len);
1690 memcpy(fcp_cmnd->fc_cdb, sc_cmd->cmnd, sc_cmd->cmd_len); 1688 memcpy(fcp_cmnd->fc_cdb, sc_cmd->cmnd, sc_cmd->cmd_len);
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index f607314810ac..25de09f4ffcf 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1074,8 +1074,7 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp)
1074 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); 1074 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len);
1075 fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK; 1075 fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK;
1076 1076
1077 int_to_scsilun(fsp->cmd->device->lun, 1077 int_to_scsilun(fsp->cmd->device->lun, &fsp->cdb_cmd.fc_lun);
1078 (struct scsi_lun *)fsp->cdb_cmd.fc_lun);
1079 memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len); 1078 memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len);
1080 1079
1081 spin_lock_irqsave(&si->scsi_queue_lock, flags); 1080 spin_lock_irqsave(&si->scsi_queue_lock, flags);
@@ -1257,7 +1256,7 @@ static int fc_lun_reset(struct fc_lport *lport, struct fc_fcp_pkt *fsp,
1257 1256
1258 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); 1257 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len);
1259 fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET; 1258 fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET;
1260 int_to_scsilun(lun, (struct scsi_lun *)fsp->cdb_cmd.fc_lun); 1259 int_to_scsilun(lun, &fsp->cdb_cmd.fc_lun);
1261 1260
1262 fsp->wait_for_comp = 1; 1261 fsp->wait_for_comp = 1;
1263 init_completion(&fsp->tm_done); 1262 init_completion(&fsp->tm_done);
diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h
index e05c55100ec6..559f3bd6868d 100644
--- a/drivers/target/tcm_fc/tcm_fc.h
+++ b/drivers/target/tcm_fc/tcm_fc.h
@@ -113,7 +113,6 @@ struct ft_lport_acl {
113 * Commands 113 * Commands
114 */ 114 */
115struct ft_cmd { 115struct ft_cmd {
116 u32 lun; /* LUN from request */
117 struct ft_sess *sess; /* session held for cmd */ 116 struct ft_sess *sess; /* session held for cmd */
118 struct fc_seq *seq; /* sequence in exchange mgr */ 117 struct fc_seq *seq; /* sequence in exchange mgr */
119 struct se_cmd se_cmd; /* Local TCM I/O descriptor */ 118 struct se_cmd se_cmd; /* Local TCM I/O descriptor */
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index 9e7e26c74c79..c5f5bb29a165 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -61,7 +61,6 @@ void ft_dump_cmd(struct ft_cmd *cmd, const char *caller)
61 caller, cmd, cmd->sess, cmd->seq, se_cmd); 61 caller, cmd, cmd->sess, cmd->seq, se_cmd);
62 pr_debug("%s: cmd %p cdb %p\n", 62 pr_debug("%s: cmd %p cdb %p\n",
63 caller, cmd, cmd->cdb); 63 caller, cmd, cmd->cdb);
64 pr_debug("%s: cmd %p lun %d\n", caller, cmd, cmd->lun);
65 64
66 pr_debug("%s: cmd %p data_nents %u len %u se_cmd_flags <0x%x>\n", 65 pr_debug("%s: cmd %p data_nents %u len %u se_cmd_flags <0x%x>\n",
67 caller, cmd, se_cmd->t_data_nents, 66 caller, cmd, se_cmd->t_data_nents,
@@ -407,8 +406,7 @@ static void ft_send_tm(struct ft_cmd *cmd)
407 406
408 switch (fcp->fc_tm_flags) { 407 switch (fcp->fc_tm_flags) {
409 case FCP_TMF_LUN_RESET: 408 case FCP_TMF_LUN_RESET:
410 cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun); 409 if (transport_lookup_tmr_lun(&cmd->se_cmd, scsilun_to_int(&fcp->fc_lun)) < 0) {
411 if (transport_lookup_tmr_lun(&cmd->se_cmd, cmd->lun) < 0) {
412 /* 410 /*
413 * Make sure to clean up newly allocated TMR request 411 * Make sure to clean up newly allocated TMR request
414 * since "unable to handle TMR request because failed 412 * since "unable to handle TMR request because failed
@@ -416,7 +414,7 @@ static void ft_send_tm(struct ft_cmd *cmd)
416 */ 414 */
417 pr_debug("Failed to get LUN for TMR func %d, " 415 pr_debug("Failed to get LUN for TMR func %d, "
418 "se_cmd %p, unpacked_lun %d\n", 416 "se_cmd %p, unpacked_lun %d\n",
419 tm_func, &cmd->se_cmd, cmd->lun); 417 tm_func, &cmd->se_cmd, scsilun_to_int(&fcp->fc_lun));
420 ft_dump_cmd(cmd, __func__); 418 ft_dump_cmd(cmd, __func__);
421 sess = cmd->sess; 419 sess = cmd->sess;
422 transport_send_check_condition_and_sense(&cmd->se_cmd, 420 transport_send_check_condition_and_sense(&cmd->se_cmd,
@@ -597,14 +595,13 @@ static void ft_send_work(struct work_struct *work)
597 return; 595 return;
598 } 596 }
599 fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); 597 fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd);
600 cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun);
601 /* 598 /*
602 * Use a single se_cmd->cmd_kref as we expect to release se_cmd 599 * Use a single se_cmd->cmd_kref as we expect to release se_cmd
603 * directly from ft_check_stop_free callback in response path. 600 * directly from ft_check_stop_free callback in response path.
604 */ 601 */
605 target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, 602 target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb,
606 &cmd->ft_sense_buffer[0], cmd->lun, data_len, 603 &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun),
607 task_attr, data_dir, 0); 604 data_len, task_attr, data_dir, 0);
608 pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl); 605 pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl);
609 return; 606 return;
610 607
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 652dec230514..0d7d67e96d43 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -20,6 +20,8 @@
20#ifndef _FC_FCP_H_ 20#ifndef _FC_FCP_H_
21#define _FC_FCP_H_ 21#define _FC_FCP_H_
22 22
23#include <scsi/scsi.h>
24
23/* 25/*
24 * Fibre Channel Protocol for SCSI. 26 * Fibre Channel Protocol for SCSI.
25 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. 27 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005.
@@ -45,7 +47,7 @@
45 * FCP_CMND IU Payload. 47 * FCP_CMND IU Payload.
46 */ 48 */
47struct fcp_cmnd { 49struct fcp_cmnd {
48 __u8 fc_lun[8]; /* logical unit number */ 50 struct scsi_lun fc_lun; /* logical unit number */
49 __u8 fc_cmdref; /* command reference number */ 51 __u8 fc_cmdref; /* command reference number */
50 __u8 fc_pri_ta; /* priority and task attribute */ 52 __u8 fc_pri_ta; /* priority and task attribute */
51 __u8 fc_tm_flags; /* task management flags */ 53 __u8 fc_tm_flags; /* task management flags */
@@ -57,7 +59,7 @@ struct fcp_cmnd {
57#define FCP_CMND_LEN 32 /* expected length of structure */ 59#define FCP_CMND_LEN 32 /* expected length of structure */
58 60
59struct fcp_cmnd32 { 61struct fcp_cmnd32 {
60 __u8 fc_lun[8]; /* logical unit number */ 62 struct scsi_lun fc_lun; /* logical unit number */
61 __u8 fc_cmdref; /* command reference number */ 63 __u8 fc_cmdref; /* command reference number */
62 __u8 fc_pri_ta; /* priority and task attribute */ 64 __u8 fc_pri_ta; /* priority and task attribute */
63 __u8 fc_tm_flags; /* task management flags */ 65 __u8 fc_tm_flags; /* task management flags */