diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-04-23 11:35:29 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-06 18:02:59 -0400 |
commit | ed3102c678c6274933948f9097bb4e2b314e5f82 (patch) | |
tree | a1dabb18032a61539905fe932bc1949cb6e8dd80 /drivers/target | |
parent | 32d8d2e4300cabb0acbf4b60fa695924be27d0d1 (diff) |
target: remove target_get_task_cdb
Now that tasks are always the same size as the command there is no need
to rewrite a CDB in common code. Notw that we keep the separately allocated
CDB in the pscsi and stgt backends for now, to easy reintroducing any
command splitting local to these backends if nessecary.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_cdb.c | 49 | ||||
-rw-r--r-- | drivers/target/target_core_pscsi.c | 3 |
2 files changed, 2 insertions, 50 deletions
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index f6f6059f7f74..8e6b91d0380d 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
@@ -1148,52 +1148,3 @@ int target_emulate_noop(struct se_task *task) | |||
1148 | transport_complete_task(task, 1); | 1148 | transport_complete_task(task, 1); |
1149 | return 0; | 1149 | return 0; |
1150 | } | 1150 | } |
1151 | |||
1152 | /* | ||
1153 | * Write a CDB into @cdb that is based on the one the intiator sent us, | ||
1154 | * but updated to only cover the sectors that the current task handles. | ||
1155 | */ | ||
1156 | void target_get_task_cdb(struct se_task *task, unsigned char *cdb) | ||
1157 | { | ||
1158 | struct se_cmd *cmd = task->task_se_cmd; | ||
1159 | unsigned int cdb_len = scsi_command_size(cmd->t_task_cdb); | ||
1160 | |||
1161 | memcpy(cdb, cmd->t_task_cdb, cdb_len); | ||
1162 | if (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) { | ||
1163 | unsigned long long lba = task->task_lba; | ||
1164 | u32 sectors = task->task_sectors; | ||
1165 | |||
1166 | switch (cdb_len) { | ||
1167 | case 6: | ||
1168 | /* 21-bit LBA and 8-bit sectors */ | ||
1169 | cdb[1] = (lba >> 16) & 0x1f; | ||
1170 | cdb[2] = (lba >> 8) & 0xff; | ||
1171 | cdb[3] = lba & 0xff; | ||
1172 | cdb[4] = sectors & 0xff; | ||
1173 | break; | ||
1174 | case 10: | ||
1175 | /* 32-bit LBA and 16-bit sectors */ | ||
1176 | put_unaligned_be32(lba, &cdb[2]); | ||
1177 | put_unaligned_be16(sectors, &cdb[7]); | ||
1178 | break; | ||
1179 | case 12: | ||
1180 | /* 32-bit LBA and 32-bit sectors */ | ||
1181 | put_unaligned_be32(lba, &cdb[2]); | ||
1182 | put_unaligned_be32(sectors, &cdb[6]); | ||
1183 | break; | ||
1184 | case 16: | ||
1185 | /* 64-bit LBA and 32-bit sectors */ | ||
1186 | put_unaligned_be64(lba, &cdb[2]); | ||
1187 | put_unaligned_be32(sectors, &cdb[10]); | ||
1188 | break; | ||
1189 | case 32: | ||
1190 | /* 64-bit LBA and 32-bit sectors, extended CDB */ | ||
1191 | put_unaligned_be64(lba, &cdb[12]); | ||
1192 | put_unaligned_be32(sectors, &cdb[28]); | ||
1193 | break; | ||
1194 | default: | ||
1195 | BUG(); | ||
1196 | } | ||
1197 | } | ||
1198 | } | ||
1199 | EXPORT_SYMBOL(target_get_task_cdb); | ||
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 94c905fcbceb..94c7a4649632 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -1070,7 +1070,8 @@ static int pscsi_do_task(struct se_task *task) | |||
1070 | struct bio *hbio; | 1070 | struct bio *hbio; |
1071 | int ret; | 1071 | int ret; |
1072 | 1072 | ||
1073 | target_get_task_cdb(task, pt->pscsi_cdb); | 1073 | memcpy(pt->pscsi_cdb, cmd->t_task_cdb, |
1074 | scsi_command_size(cmd->t_task_cdb)); | ||
1074 | 1075 | ||
1075 | if (task->task_se_cmd->se_cmd_flags & SCF_SCSI_NON_DATA_CDB) { | 1076 | if (task->task_se_cmd->se_cmd_flags & SCF_SCSI_NON_DATA_CDB) { |
1076 | req = blk_get_request(pdv->pdv_sd->request_queue, | 1077 | req = blk_get_request(pdv->pdv_sd->request_queue, |