Commit e35fa8c2 authored by Andy Grover's avatar Andy Grover Committed by Nicholas Bellinger

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: default avatarAndy 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: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 8e94b8db
...@@ -1682,9 +1682,7 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req, ...@@ -1682,9 +1682,7 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd)); memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd));
int_to_scsilun(sc_cmd->device->lun, int_to_scsilun(sc_cmd->device->lun, &fcp_cmnd->fc_lun);
(struct scsi_lun *) fcp_cmnd->fc_lun);
fcp_cmnd->fc_dl = htonl(io_req->data_xfer_len); fcp_cmnd->fc_dl = htonl(io_req->data_xfer_len);
memcpy(fcp_cmnd->fc_cdb, sc_cmd->cmnd, sc_cmd->cmd_len); memcpy(fcp_cmnd->fc_cdb, sc_cmd->cmnd, sc_cmd->cmd_len);
......
...@@ -1074,8 +1074,7 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp) ...@@ -1074,8 +1074,7 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp)
fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); fsp->cdb_cmd.fc_dl = htonl(fsp->data_len);
fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK; fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK;
int_to_scsilun(fsp->cmd->device->lun, int_to_scsilun(fsp->cmd->device->lun, &fsp->cdb_cmd.fc_lun);
(struct scsi_lun *)fsp->cdb_cmd.fc_lun);
memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len); memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len);
spin_lock_irqsave(&si->scsi_queue_lock, flags); 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,7 +1256,7 @@ static int fc_lun_reset(struct fc_lport *lport, struct fc_fcp_pkt *fsp,
fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); fsp->cdb_cmd.fc_dl = htonl(fsp->data_len);
fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET; fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET;
int_to_scsilun(lun, (struct scsi_lun *)fsp->cdb_cmd.fc_lun); int_to_scsilun(lun, &fsp->cdb_cmd.fc_lun);
fsp->wait_for_comp = 1; fsp->wait_for_comp = 1;
init_completion(&fsp->tm_done); init_completion(&fsp->tm_done);
......
...@@ -113,7 +113,6 @@ struct ft_lport_acl { ...@@ -113,7 +113,6 @@ struct ft_lport_acl {
* Commands * Commands
*/ */
struct ft_cmd { struct ft_cmd {
u32 lun; /* LUN from request */
struct ft_sess *sess; /* session held for cmd */ struct ft_sess *sess; /* session held for cmd */
struct fc_seq *seq; /* sequence in exchange mgr */ struct fc_seq *seq; /* sequence in exchange mgr */
struct se_cmd se_cmd; /* Local TCM I/O descriptor */ struct se_cmd se_cmd; /* Local TCM I/O descriptor */
......
...@@ -61,7 +61,6 @@ void ft_dump_cmd(struct ft_cmd *cmd, const char *caller) ...@@ -61,7 +61,6 @@ void ft_dump_cmd(struct ft_cmd *cmd, const char *caller)
caller, cmd, cmd->sess, cmd->seq, se_cmd); caller, cmd, cmd->sess, cmd->seq, se_cmd);
pr_debug("%s: cmd %p cdb %p\n", pr_debug("%s: cmd %p cdb %p\n",
caller, cmd, cmd->cdb); caller, cmd, cmd->cdb);
pr_debug("%s: cmd %p lun %d\n", caller, cmd, cmd->lun);
pr_debug("%s: cmd %p data_nents %u len %u se_cmd_flags <0x%x>\n", pr_debug("%s: cmd %p data_nents %u len %u se_cmd_flags <0x%x>\n",
caller, cmd, se_cmd->t_data_nents, caller, cmd, se_cmd->t_data_nents,
...@@ -407,8 +406,7 @@ static void ft_send_tm(struct ft_cmd *cmd) ...@@ -407,8 +406,7 @@ static void ft_send_tm(struct ft_cmd *cmd)
switch (fcp->fc_tm_flags) { switch (fcp->fc_tm_flags) {
case FCP_TMF_LUN_RESET: case FCP_TMF_LUN_RESET:
cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun); if (transport_lookup_tmr_lun(&cmd->se_cmd, scsilun_to_int(&fcp->fc_lun)) < 0) {
if (transport_lookup_tmr_lun(&cmd->se_cmd, cmd->lun) < 0) {
/* /*
* Make sure to clean up newly allocated TMR request * Make sure to clean up newly allocated TMR request
* since "unable to handle TMR request because failed * since "unable to handle TMR request because failed
...@@ -416,7 +414,7 @@ static void ft_send_tm(struct ft_cmd *cmd) ...@@ -416,7 +414,7 @@ static void ft_send_tm(struct ft_cmd *cmd)
*/ */
pr_debug("Failed to get LUN for TMR func %d, " pr_debug("Failed to get LUN for TMR func %d, "
"se_cmd %p, unpacked_lun %d\n", "se_cmd %p, unpacked_lun %d\n",
tm_func, &cmd->se_cmd, cmd->lun); tm_func, &cmd->se_cmd, scsilun_to_int(&fcp->fc_lun));
ft_dump_cmd(cmd, __func__); ft_dump_cmd(cmd, __func__);
sess = cmd->sess; sess = cmd->sess;
transport_send_check_condition_and_sense(&cmd->se_cmd, transport_send_check_condition_and_sense(&cmd->se_cmd,
...@@ -597,14 +595,13 @@ static void ft_send_work(struct work_struct *work) ...@@ -597,14 +595,13 @@ static void ft_send_work(struct work_struct *work)
return; return;
} }
fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd);
cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun);
/* /*
* Use a single se_cmd->cmd_kref as we expect to release se_cmd * Use a single se_cmd->cmd_kref as we expect to release se_cmd
* directly from ft_check_stop_free callback in response path. * directly from ft_check_stop_free callback in response path.
*/ */
target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb,
&cmd->ft_sense_buffer[0], cmd->lun, data_len, &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun),
task_attr, data_dir, 0); data_len, task_attr, data_dir, 0);
pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl); pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl);
return; return;
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#ifndef _FC_FCP_H_ #ifndef _FC_FCP_H_
#define _FC_FCP_H_ #define _FC_FCP_H_
#include <scsi/scsi.h>
/* /*
* Fibre Channel Protocol for SCSI. * Fibre Channel Protocol for SCSI.
* From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005.
...@@ -45,7 +47,7 @@ ...@@ -45,7 +47,7 @@
* FCP_CMND IU Payload. * FCP_CMND IU Payload.
*/ */
struct fcp_cmnd { struct fcp_cmnd {
__u8 fc_lun[8]; /* logical unit number */ struct scsi_lun fc_lun; /* logical unit number */
__u8 fc_cmdref; /* command reference number */ __u8 fc_cmdref; /* command reference number */
__u8 fc_pri_ta; /* priority and task attribute */ __u8 fc_pri_ta; /* priority and task attribute */
__u8 fc_tm_flags; /* task management flags */ __u8 fc_tm_flags; /* task management flags */
...@@ -57,7 +59,7 @@ struct fcp_cmnd { ...@@ -57,7 +59,7 @@ struct fcp_cmnd {
#define FCP_CMND_LEN 32 /* expected length of structure */ #define FCP_CMND_LEN 32 /* expected length of structure */
struct fcp_cmnd32 { struct fcp_cmnd32 {
__u8 fc_lun[8]; /* logical unit number */ struct scsi_lun fc_lun; /* logical unit number */
__u8 fc_cmdref; /* command reference number */ __u8 fc_cmdref; /* command reference number */
__u8 fc_pri_ta; /* priority and task attribute */ __u8 fc_pri_ta; /* priority and task attribute */
__u8 fc_tm_flags; /* task management flags */ __u8 fc_tm_flags; /* task management flags */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment