diff options
author | Andy Grover <agrover@redhat.com> | 2011-05-02 17:12:10 -0700 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 09:37:44 +0000 |
commit | a1d8b49abd60ba5d09e7c968731abcb0f8f1cbf6 (patch) | |
tree | 8cbfd54b4829fd5f0ed206e15c81c1e626e7701d /drivers/target/target_core_cdb.c | |
parent | dd3a5ad8e0c8706659f02c4a72b8c87f6f7ab479 (diff) | |
download | linux-a1d8b49abd60ba5d09e7c968731abcb0f8f1cbf6.tar.bz2 |
target: Updates from AGrover and HCH (round 3)
This patch contains a squashed version of third round series cleanups,
improvements ,and simplfications from Andy and Christoph ahead of the
heavy lifting between round 3 -> 4 for the target core SGL conversion.
This include cleanups to the main target I/O path and other miscellaneous
updates.
target: Replace custom sg<->buf functions with lib funcs
target: Simplify sector limiting code
target: get_cdb should never return NULL
target: Simplify transport_memcpy_se_mem_read_contig
target: Use assignment rather than increment for t_task_cdbs
target: Don't pass dma_size to generic_get_mem
target: Pass sg with type scatterlist in transport_map_sg_to_mem
target: Move task_sg_num next to task_sg in struct se_task
target: inline struct se_transport_task into struct se_cmd
target: Change name & semantics of transport_get_sectors()
target: Remove unused members of se_cmd
target: Rename se_cmd.t_task_cdbs to t_task_list_num
target: Fix some spelling
target: Remove unused var from transport_generic_do_tmr
target: map_sg_to_mem: return sg_count in return value
target/pscsi: Use min_t for sector limits
target/pscsi: Unused param for pscsi_get_bio()
target: Rename get_cdb_count to allocate_tasks
target: Make transport_generic_new_cmd() available for iscsi-target
target: Remove fabric callback to allocate iovecs
target: Fix transport_generic_new_cmd WRITE comment
(hch: Use __GFP_ZERO usage for alloc_pages() usage)
Signed-off-by: Andy Grover <agrover@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_cdb.c')
-rw-r--r-- | drivers/target/target_core_cdb.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 8d5a0fc3a220..09ef3f811567 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c @@ -66,7 +66,7 @@ target_emulate_inquiry_std(struct se_cmd *cmd) { struct se_lun *lun = cmd->se_lun; struct se_device *dev = cmd->se_dev; - unsigned char *buf = cmd->t_task.t_task_buf; + unsigned char *buf = cmd->t_task_buf; /* * Make sure we at least have 6 bytes of INQUIRY response @@ -621,8 +621,8 @@ static int target_emulate_inquiry(struct se_cmd *cmd) { struct se_device *dev = cmd->se_dev; - unsigned char *buf = cmd->t_task.t_task_buf; - unsigned char *cdb = cmd->t_task.t_task_cdb; + unsigned char *buf = cmd->t_task_buf; + unsigned char *cdb = cmd->t_task_cdb; if (!(cdb[1] & 0x1)) return target_emulate_inquiry_std(cmd); @@ -666,7 +666,7 @@ static int target_emulate_readcapacity(struct se_cmd *cmd) { struct se_device *dev = cmd->se_dev; - unsigned char *buf = cmd->t_task.t_task_buf; + unsigned char *buf = cmd->t_task_buf; unsigned long long blocks_long = dev->transport->get_blocks(dev); u32 blocks; @@ -696,7 +696,7 @@ static int target_emulate_readcapacity_16(struct se_cmd *cmd) { struct se_device *dev = cmd->se_dev; - unsigned char *buf = cmd->t_task.t_task_buf; + unsigned char *buf = cmd->t_task_buf; unsigned long long blocks = dev->transport->get_blocks(dev); buf[0] = (blocks >> 56) & 0xff; @@ -831,8 +831,8 @@ static int target_emulate_modesense(struct se_cmd *cmd, int ten) { struct se_device *dev = cmd->se_dev; - char *cdb = cmd->t_task.t_task_cdb; - unsigned char *rbuf = cmd->t_task.t_task_buf; + char *cdb = cmd->t_task_cdb; + unsigned char *rbuf = cmd->t_task_buf; int type = dev->transport->get_device_type(dev); int offset = (ten) ? 8 : 4; int length = 0; @@ -903,8 +903,8 @@ target_emulate_modesense(struct se_cmd *cmd, int ten) static int target_emulate_request_sense(struct se_cmd *cmd) { - unsigned char *cdb = cmd->t_task.t_task_cdb; - unsigned char *buf = cmd->t_task.t_task_buf; + unsigned char *cdb = cmd->t_task_cdb; + unsigned char *buf = cmd->t_task_buf; u8 ua_asc = 0, ua_ascq = 0; if (cdb[1] & 0x01) { @@ -965,8 +965,8 @@ target_emulate_unmap(struct se_task *task) { struct se_cmd *cmd = task->task_se_cmd; struct se_device *dev = cmd->se_dev; - unsigned char *buf = cmd->t_task.t_task_buf, *ptr = NULL; - unsigned char *cdb = &cmd->t_task.t_task_cdb[0]; + unsigned char *buf = cmd->t_task_buf, *ptr = NULL; + unsigned char *cdb = &cmd->t_task_cdb[0]; sector_t lba; unsigned int size = cmd->data_length, range; int ret, offset; @@ -1012,7 +1012,8 @@ target_emulate_write_same(struct se_task *task, int write_same32) { struct se_cmd *cmd = task->task_se_cmd; struct se_device *dev = cmd->se_dev; - sector_t range, lba = cmd->t_task.t_task_lba; + sector_t range; + sector_t lba = cmd->t_task_lba; unsigned int num_blocks; int ret; /* @@ -1021,9 +1022,9 @@ target_emulate_write_same(struct se_task *task, int write_same32) * range based on ->get_blocks() - starting LBA. */ if (write_same32) - num_blocks = get_unaligned_be32(&cmd->t_task.t_task_cdb[28]); + num_blocks = get_unaligned_be32(&cmd->t_task_cdb[28]); else - num_blocks = get_unaligned_be32(&cmd->t_task.t_task_cdb[10]); + num_blocks = get_unaligned_be32(&cmd->t_task_cdb[10]); if (num_blocks != 0) range = num_blocks; @@ -1052,7 +1053,7 @@ transport_emulate_control_cdb(struct se_task *task) unsigned short service_action; int ret = 0; - switch (cmd->t_task.t_task_cdb[0]) { + switch (cmd->t_task_cdb[0]) { case INQUIRY: ret = target_emulate_inquiry(cmd); break; @@ -1066,13 +1067,13 @@ transport_emulate_control_cdb(struct se_task *task) ret = target_emulate_modesense(cmd, 1); break; case SERVICE_ACTION_IN: - switch (cmd->t_task.t_task_cdb[1] & 0x1f) { + switch (cmd->t_task_cdb[1] & 0x1f) { case SAI_READ_CAPACITY_16: ret = target_emulate_readcapacity_16(cmd); break; default: printk(KERN_ERR "Unsupported SA: 0x%02x\n", - cmd->t_task.t_task_cdb[1] & 0x1f); + cmd->t_task_cdb[1] & 0x1f); return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; } break; @@ -1097,7 +1098,7 @@ transport_emulate_control_cdb(struct se_task *task) break; case VARIABLE_LENGTH_CMD: service_action = - get_unaligned_be16(&cmd->t_task.t_task_cdb[8]); + get_unaligned_be16(&cmd->t_task_cdb[8]); switch (service_action) { case WRITE_SAME_32: if (!dev->transport->do_discard) { @@ -1136,7 +1137,7 @@ transport_emulate_control_cdb(struct se_task *task) break; default: printk(KERN_ERR "Unsupported SCSI Opcode: 0x%02x for %s\n", - cmd->t_task.t_task_cdb[0], dev->transport->name); + cmd->t_task_cdb[0], dev->transport->name); return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; } |