VERIFY10/12/16 If BYTCHK is false we dont need to transfer any blocks to the target

If BYTCHK is false the target will perform a medium check of the indicated
LBAs only and not compare with anything out of the DATA-OUT buffers.
As such we dont need to/should not transfer any DAT-OUT to the target.
This commit is contained in:
Ronnie Sahlberg
2012-11-18 09:44:38 -08:00
parent e661c22875
commit f9767e729a
2 changed files with 18 additions and 12 deletions

View File

@@ -1082,8 +1082,9 @@ iscsi_verify10_task(struct iscsi_context *iscsi, int lun, unsigned char *data,
return NULL;
}
outdata.data = data;
outdata.size = datalen;
/* We only transfer data if BYTCHK is true */
outdata.data = bytchk ? data : NULL;
outdata.size = bytchk ? datalen : 0;
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
private_data) != 0) {
@@ -1115,8 +1116,9 @@ iscsi_verify12_task(struct iscsi_context *iscsi, int lun, unsigned char *data,
return NULL;
}
outdata.data = data;
outdata.size = datalen;
/* We only transfer data if BYTCHK is true */
outdata.data = bytchk ? data : NULL;
outdata.size = bytchk ? datalen : 0;
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
private_data) != 0) {
@@ -1148,8 +1150,9 @@ iscsi_verify16_task(struct iscsi_context *iscsi, int lun, unsigned char *data,
return NULL;
}
outdata.data = data;
outdata.size = datalen;
/* We only transfer data if BYTCHK is true */
outdata.data = bytchk ? data : NULL;
outdata.size = bytchk ? datalen : 0;
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
private_data) != 0) {

View File

@@ -1433,12 +1433,13 @@ scsi_cdb_verify10(uint32_t lba, uint32_t xferlen, int vprotect, int dpo, int byt
*(uint16_t *)&task->cdb[7] = htons(xferlen/blocksize);
task->cdb_size = 10;
if (xferlen != 0) {
if (xferlen != 0 && bytchk) {
task->xfer_dir = SCSI_XFER_WRITE;
task->expxferlen = xferlen;
} else {
task->xfer_dir = SCSI_XFER_NONE;
task->expxferlen = 0;
}
task->expxferlen = xferlen;
task->params.verify10.lba = lba;
task->params.verify10.num_blocks = xferlen/blocksize;
@@ -1479,12 +1480,13 @@ scsi_cdb_verify12(uint32_t lba, uint32_t xferlen, int vprotect, int dpo, int byt
*(uint32_t *)&task->cdb[6] = htonl(xferlen/blocksize);
task->cdb_size = 12;
if (xferlen != 0) {
if (xferlen != 0 && bytchk) {
task->xfer_dir = SCSI_XFER_WRITE;
task->expxferlen = xferlen;
} else {
task->xfer_dir = SCSI_XFER_NONE;
task->expxferlen = 0;
}
task->expxferlen = xferlen;
task->params.verify12.lba = lba;
task->params.verify12.num_blocks = xferlen/blocksize;
@@ -1526,12 +1528,13 @@ scsi_cdb_verify16(uint64_t lba, uint32_t xferlen, int vprotect, int dpo, int byt
*(uint32_t *)&task->cdb[10] = htonl(xferlen/blocksize);
task->cdb_size = 16;
if (xferlen != 0) {
if (xferlen != 0 && bytchk) {
task->xfer_dir = SCSI_XFER_WRITE;
task->expxferlen = xferlen;
} else {
task->xfer_dir = SCSI_XFER_NONE;
task->expxferlen = 0;
}
task->expxferlen = xferlen;
task->params.verify16.lba = lba;
task->params.verify16.num_blocks = xferlen/blocksize;