aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_pscsi.c
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2011-07-19 06:26:37 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-07-22 05:37:43 -0400
commit5951146dea1ac8ff2f177477c907084d63913cad (patch)
tree699cb7c498ca1799ae3e349cb4360171d9fa63e0 /drivers/target/target_core_pscsi.c
parentf22c119683e73498d8126581a1be75e1b7a339a3 (diff)
target: More core cleanups from AGrover (round 2)
This patch contains the squashed version of second round of target core cleanups and simplifications and Andy and Co. It also contains a handful of fixes to address bugs the original series and other minor cleanups. Here is the condensed shortlog: target: Remove unneeded casts to void* target: Rename get_lun_for_{cmd,tmr} to lookup_{cmd,tmr}_lun target: Make t_task a member of se_cmd, not a pointer target: Handle functions returning "-2" target: Use cmd->se_dev over cmd->se_lun->lun_se_dev target: Embed qr in struct se_cmd target: Replace embedded struct se_queue_req with a list_head target: Rename list_heads that are nodes in struct se_cmd to "*_node" target: Fold transport_device_setup_cmd() into lookup_{tmr,cmd}_lun() target: Make t_mem_list and t_mem_list_bidi members of t_task target: Add comment & cleanup transport_map_sg_to_mem() target: Remove unneeded checks in transport_free_pages() (Roland: Fix se_queue_req removal leftovers OOPs) (nab: Fix transport_lookup_tmr_lun failure case) (nab: Fix list_empty(&cmd->t_task.t_mem_bidi_list) inversion bugs) Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_pscsi.c')
-rw-r--r--drivers/target/target_core_pscsi.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 44a79a5c6d3..ecfe889cb0c 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -72,7 +72,7 @@ static int pscsi_attach_hba(struct se_hba *hba, u32 host_id)
72 phv->phv_host_id = host_id; 72 phv->phv_host_id = host_id;
73 phv->phv_mode = PHV_VIRUTAL_HOST_ID; 73 phv->phv_mode = PHV_VIRUTAL_HOST_ID;
74 74
75 hba->hba_ptr = (void *)phv; 75 hba->hba_ptr = phv;
76 76
77 printk(KERN_INFO "CORE_HBA[%d] - TCM SCSI HBA Driver %s on" 77 printk(KERN_INFO "CORE_HBA[%d] - TCM SCSI HBA Driver %s on"
78 " Generic Target Core Stack %s\n", hba->hba_id, 78 " Generic Target Core Stack %s\n", hba->hba_id,
@@ -355,7 +355,7 @@ static struct se_device *pscsi_add_device_to_list(
355 pdv->pdv_sd = sd; 355 pdv->pdv_sd = sd;
356 356
357 dev = transport_add_device_to_core_hba(hba, &pscsi_template, 357 dev = transport_add_device_to_core_hba(hba, &pscsi_template,
358 se_dev, dev_flags, (void *)pdv, 358 se_dev, dev_flags, pdv,
359 &dev_limits, NULL, NULL); 359 &dev_limits, NULL, NULL);
360 if (!(dev)) { 360 if (!(dev)) {
361 pdv->pdv_sd = NULL; 361 pdv->pdv_sd = NULL;
@@ -394,7 +394,7 @@ static void *pscsi_allocate_virtdevice(struct se_hba *hba, const char *name)
394 pdv->pdv_se_hba = hba; 394 pdv->pdv_se_hba = hba;
395 395
396 printk(KERN_INFO "PSCSI: Allocated pdv: %p for %s\n", pdv, name); 396 printk(KERN_INFO "PSCSI: Allocated pdv: %p for %s\n", pdv, name);
397 return (void *)pdv; 397 return pdv;
398} 398}
399 399
400/* 400/*
@@ -697,7 +697,7 @@ static int pscsi_transport_complete(struct se_task *task)
697 697
698 if (task->task_se_cmd->se_deve->lun_flags & 698 if (task->task_se_cmd->se_deve->lun_flags &
699 TRANSPORT_LUNFLAGS_READ_ONLY) { 699 TRANSPORT_LUNFLAGS_READ_ONLY) {
700 unsigned char *buf = task->task_se_cmd->t_task->t_task_buf; 700 unsigned char *buf = task->task_se_cmd->t_task.t_task_buf;
701 701
702 if (cdb[0] == MODE_SENSE_10) { 702 if (cdb[0] == MODE_SENSE_10) {
703 if (!(buf[3] & 0x80)) 703 if (!(buf[3] & 0x80))
@@ -763,7 +763,7 @@ static struct se_task *
763pscsi_alloc_task(struct se_cmd *cmd) 763pscsi_alloc_task(struct se_cmd *cmd)
764{ 764{
765 struct pscsi_plugin_task *pt; 765 struct pscsi_plugin_task *pt;
766 unsigned char *cdb = cmd->t_task->t_task_cdb; 766 unsigned char *cdb = cmd->t_task.t_task_cdb;
767 767
768 pt = kzalloc(sizeof(struct pscsi_plugin_task), GFP_KERNEL); 768 pt = kzalloc(sizeof(struct pscsi_plugin_task), GFP_KERNEL);
769 if (!pt) { 769 if (!pt) {
@@ -776,7 +776,7 @@ pscsi_alloc_task(struct se_cmd *cmd)
776 * allocate the extended CDB buffer for per struct se_task context 776 * allocate the extended CDB buffer for per struct se_task context
777 * pt->pscsi_cdb now. 777 * pt->pscsi_cdb now.
778 */ 778 */
779 if (cmd->t_task->t_task_cdb != cmd->t_task->__t_task_cdb) { 779 if (cmd->t_task.t_task_cdb != cmd->t_task.__t_task_cdb) {
780 780
781 pt->pscsi_cdb = kzalloc(scsi_command_size(cdb), GFP_KERNEL); 781 pt->pscsi_cdb = kzalloc(scsi_command_size(cdb), GFP_KERNEL);
782 if (!(pt->pscsi_cdb)) { 782 if (!(pt->pscsi_cdb)) {
@@ -812,7 +812,7 @@ static inline void pscsi_blk_init_request(
812 * also set the end_io_data pointer.to struct se_task. 812 * also set the end_io_data pointer.to struct se_task.
813 */ 813 */
814 req->end_io = pscsi_req_done; 814 req->end_io = pscsi_req_done;
815 req->end_io_data = (void *)task; 815 req->end_io_data = task;
816 /* 816 /*
817 * Load the referenced struct se_task's SCSI CDB into 817 * Load the referenced struct se_task's SCSI CDB into
818 * include/linux/blkdev.h:struct request->cmd 818 * include/linux/blkdev.h:struct request->cmd
@@ -822,7 +822,7 @@ static inline void pscsi_blk_init_request(
822 /* 822 /*
823 * Setup pointer for outgoing sense data. 823 * Setup pointer for outgoing sense data.
824 */ 824 */
825 req->sense = (void *)&pt->pscsi_sense[0]; 825 req->sense = &pt->pscsi_sense[0];
826 req->sense_len = 0; 826 req->sense_len = 0;
827} 827}
828 828
@@ -889,7 +889,7 @@ static void pscsi_free_task(struct se_task *task)
889 * Release the extended CDB allocation from pscsi_alloc_task() 889 * Release the extended CDB allocation from pscsi_alloc_task()
890 * if one exists. 890 * if one exists.
891 */ 891 */
892 if (cmd->t_task->t_task_cdb != cmd->t_task->__t_task_cdb) 892 if (cmd->t_task.t_task_cdb != cmd->t_task.__t_task_cdb)
893 kfree(pt->pscsi_cdb); 893 kfree(pt->pscsi_cdb);
894 /* 894 /*
895 * We do not release the bio(s) here associated with this task, as 895 * We do not release the bio(s) here associated with this task, as
@@ -1266,7 +1266,7 @@ static int pscsi_map_task_non_SG(struct se_task *task)
1266 return 0; 1266 return 0;
1267 1267
1268 ret = blk_rq_map_kern(pdv->pdv_sd->request_queue, 1268 ret = blk_rq_map_kern(pdv->pdv_sd->request_queue,
1269 pt->pscsi_req, cmd->t_task->t_task_buf, 1269 pt->pscsi_req, cmd->t_task.t_task_buf,
1270 task->task_size, GFP_KERNEL); 1270 task->task_size, GFP_KERNEL);
1271 if (ret < 0) { 1271 if (ret < 0) {
1272 printk(KERN_ERR "PSCSI: blk_rq_map_kern() failed: %d\n", ret); 1272 printk(KERN_ERR "PSCSI: blk_rq_map_kern() failed: %d\n", ret);