scsi, iscsi: accumulate data_transferred in iSCSI

Each SCSI task should only report its data_transferred; the
parent/subtask relationship should be handled in iSCSI.

Change-Id: Ibece110fd8cca4e94648942fe6b5e004a4fd8a80
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393212
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2017-12-28 15:31:46 -07:00 committed by Jim Harris
parent 891c12a63c
commit 380b3fc878
2 changed files with 6 additions and 7 deletions

View File

@ -1070,6 +1070,9 @@ spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task)
if (spdk_iscsi_task_is_read(primary)) { if (spdk_iscsi_task_is_read(primary)) {
process_read_task_completion(conn, task, primary); process_read_task_completion(conn, task, primary);
} else { } else {
if (task != primary) {
primary->scsi.data_transferred += task->scsi.data_transferred;
}
primary->bytes_completed += task->scsi.length; primary->bytes_completed += task->scsi.length;
if ((task != primary) && if ((task != primary) &&
(task->scsi.status != SPDK_SCSI_STATUS_GOOD)) { (task->scsi.status != SPDK_SCSI_STATUS_GOOD)) {

View File

@ -1362,7 +1362,6 @@ spdk_bdev_scsi_write(struct spdk_bdev *bdev,
uint64_t offset; uint64_t offset;
uint64_t nbytes; uint64_t nbytes;
int rc; int rc;
struct spdk_scsi_task *primary = task->parent;
blen = spdk_bdev_get_block_size(bdev); blen = spdk_bdev_get_block_size(bdev);
offset = lba * blen; offset = lba * blen;
@ -1395,17 +1394,12 @@ spdk_bdev_scsi_write(struct spdk_bdev *bdev,
SPDK_SCSI_ASC_NO_ADDITIONAL_SENSE, SPDK_SCSI_ASC_NO_ADDITIONAL_SENSE,
SPDK_SCSI_ASCQ_CAUSE_NOT_REPORTABLE); SPDK_SCSI_ASCQ_CAUSE_NOT_REPORTABLE);
return SPDK_SCSI_TASK_COMPLETE; return SPDK_SCSI_TASK_COMPLETE;
} else {
if (!primary) {
task->data_transferred += task->length;
} else {
primary->data_transferred += task->length;
}
} }
SPDK_DEBUGLOG(SPDK_LOG_SCSI, "Wrote %"PRIu64"/%"PRIu64" bytes\n", SPDK_DEBUGLOG(SPDK_LOG_SCSI, "Wrote %"PRIu64"/%"PRIu64" bytes\n",
(uint64_t)task->length, nbytes); (uint64_t)task->length, nbytes);
task->data_transferred = task->length;
task->status = SPDK_SCSI_STATUS_GOOD; task->status = SPDK_SCSI_STATUS_GOOD;
return SPDK_SCSI_TASK_PENDING; return SPDK_SCSI_TASK_PENDING;
} }
@ -1456,6 +1450,8 @@ spdk_bdev_scsi_readwrite(struct spdk_bdev *bdev,
{ {
uint32_t max_xfer_len; uint32_t max_xfer_len;
task->data_transferred = 0;
if (task->dxfer_dir != SPDK_SCSI_DIR_NONE && if (task->dxfer_dir != SPDK_SCSI_DIR_NONE &&
task->dxfer_dir != (is_read ? SPDK_SCSI_DIR_FROM_DEV : SPDK_SCSI_DIR_TO_DEV)) { task->dxfer_dir != (is_read ? SPDK_SCSI_DIR_FROM_DEV : SPDK_SCSI_DIR_TO_DEV)) {
SPDK_ERRLOG("Incorrect data direction\n"); SPDK_ERRLOG("Incorrect data direction\n");