Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andy Grover and committed by
Nicholas Bellinger
e35fa8c2 8e94b8db

+11 -16
+1 -3
drivers/scsi/bnx2fc/bnx2fc_io.c
··· 1682 1682 1683 1683 memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd)); 1684 1684 1685 - int_to_scsilun(sc_cmd->device->lun, 1686 - (struct scsi_lun *) fcp_cmnd->fc_lun); 1687 - 1685 + int_to_scsilun(sc_cmd->device->lun, &fcp_cmnd->fc_lun); 1688 1686 1689 1687 fcp_cmnd->fc_dl = htonl(io_req->data_xfer_len); 1690 1688 memcpy(fcp_cmnd->fc_cdb, sc_cmd->cmnd, sc_cmd->cmd_len);
+2 -3
drivers/scsi/libfc/fc_fcp.c
··· 1074 1074 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); 1075 1075 fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK; 1076 1076 1077 - int_to_scsilun(fsp->cmd->device->lun, 1078 - (struct scsi_lun *)fsp->cdb_cmd.fc_lun); 1077 + int_to_scsilun(fsp->cmd->device->lun, &fsp->cdb_cmd.fc_lun); 1079 1078 memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len); 1080 1079 1081 1080 spin_lock_irqsave(&si->scsi_queue_lock, flags); ··· 1256 1257 1257 1258 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); 1258 1259 fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET; 1259 - int_to_scsilun(lun, (struct scsi_lun *)fsp->cdb_cmd.fc_lun); 1260 + int_to_scsilun(lun, &fsp->cdb_cmd.fc_lun); 1260 1261 1261 1262 fsp->wait_for_comp = 1; 1262 1263 init_completion(&fsp->tm_done);
-1
drivers/target/tcm_fc/tcm_fc.h
··· 113 113 * Commands 114 114 */ 115 115 struct ft_cmd { 116 - u32 lun; /* LUN from request */ 117 116 struct ft_sess *sess; /* session held for cmd */ 118 117 struct fc_seq *seq; /* sequence in exchange mgr */ 119 118 struct se_cmd se_cmd; /* Local TCM I/O descriptor */
+4 -7
drivers/target/tcm_fc/tfc_cmd.c
··· 61 61 caller, cmd, cmd->sess, cmd->seq, se_cmd); 62 62 pr_debug("%s: cmd %p cdb %p\n", 63 63 caller, cmd, cmd->cdb); 64 - pr_debug("%s: cmd %p lun %d\n", caller, cmd, cmd->lun); 65 64 66 65 pr_debug("%s: cmd %p data_nents %u len %u se_cmd_flags <0x%x>\n", 67 66 caller, cmd, se_cmd->t_data_nents, ··· 406 407 407 408 switch (fcp->fc_tm_flags) { 408 409 case FCP_TMF_LUN_RESET: 409 - cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun); 410 - if (transport_lookup_tmr_lun(&cmd->se_cmd, cmd->lun) < 0) { 410 + if (transport_lookup_tmr_lun(&cmd->se_cmd, scsilun_to_int(&fcp->fc_lun)) < 0) { 411 411 /* 412 412 * Make sure to clean up newly allocated TMR request 413 413 * since "unable to handle TMR request because failed ··· 414 416 */ 415 417 pr_debug("Failed to get LUN for TMR func %d, " 416 418 "se_cmd %p, unpacked_lun %d\n", 417 - tm_func, &cmd->se_cmd, cmd->lun); 419 + tm_func, &cmd->se_cmd, scsilun_to_int(&fcp->fc_lun)); 418 420 ft_dump_cmd(cmd, __func__); 419 421 sess = cmd->sess; 420 422 transport_send_check_condition_and_sense(&cmd->se_cmd, ··· 595 597 return; 596 598 } 597 599 fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); 598 - cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun); 599 600 /* 600 601 * Use a single se_cmd->cmd_kref as we expect to release se_cmd 601 602 * directly from ft_check_stop_free callback in response path. 602 603 */ 603 604 target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, 604 - &cmd->ft_sense_buffer[0], cmd->lun, data_len, 605 - task_attr, data_dir, 0); 605 + &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), 606 + data_len, task_attr, data_dir, 0); 606 607 pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl); 607 608 return; 608 609
+4 -2
include/scsi/fc/fc_fcp.h
··· 20 20 #ifndef _FC_FCP_H_ 21 21 #define _FC_FCP_H_ 22 22 23 + #include <scsi/scsi.h> 24 + 23 25 /* 24 26 * Fibre Channel Protocol for SCSI. 25 27 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. ··· 47 45 * FCP_CMND IU Payload. 48 46 */ 49 47 struct fcp_cmnd { 50 - __u8 fc_lun[8]; /* logical unit number */ 48 + struct scsi_lun fc_lun; /* logical unit number */ 51 49 __u8 fc_cmdref; /* command reference number */ 52 50 __u8 fc_pri_ta; /* priority and task attribute */ 53 51 __u8 fc_tm_flags; /* task management flags */ ··· 59 57 #define FCP_CMND_LEN 32 /* expected length of structure */ 60 58 61 59 struct fcp_cmnd32 { 62 - __u8 fc_lun[8]; /* logical unit number */ 60 + struct scsi_lun fc_lun; /* logical unit number */ 63 61 __u8 fc_cmdref; /* command reference number */ 64 62 __u8 fc_pri_ta; /* priority and task attribute */ 65 63 __u8 fc_tm_flags; /* task management flags */