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:
@@ -1082,8 +1082,9 @@ iscsi_verify10_task(struct iscsi_context *iscsi, int lun, unsigned char *data,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
outdata.data = data;
|
/* We only transfer data if BYTCHK is true */
|
||||||
outdata.size = datalen;
|
outdata.data = bytchk ? data : NULL;
|
||||||
|
outdata.size = bytchk ? datalen : 0;
|
||||||
|
|
||||||
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
|
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
|
||||||
private_data) != 0) {
|
private_data) != 0) {
|
||||||
@@ -1115,8 +1116,9 @@ iscsi_verify12_task(struct iscsi_context *iscsi, int lun, unsigned char *data,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
outdata.data = data;
|
/* We only transfer data if BYTCHK is true */
|
||||||
outdata.size = datalen;
|
outdata.data = bytchk ? data : NULL;
|
||||||
|
outdata.size = bytchk ? datalen : 0;
|
||||||
|
|
||||||
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
|
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
|
||||||
private_data) != 0) {
|
private_data) != 0) {
|
||||||
@@ -1148,8 +1150,9 @@ iscsi_verify16_task(struct iscsi_context *iscsi, int lun, unsigned char *data,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
outdata.data = data;
|
/* We only transfer data if BYTCHK is true */
|
||||||
outdata.size = datalen;
|
outdata.data = bytchk ? data : NULL;
|
||||||
|
outdata.size = bytchk ? datalen : 0;
|
||||||
|
|
||||||
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
|
if (iscsi_scsi_command_async(iscsi, lun, task, cb, &outdata,
|
||||||
private_data) != 0) {
|
private_data) != 0) {
|
||||||
|
|||||||
@@ -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);
|
*(uint16_t *)&task->cdb[7] = htons(xferlen/blocksize);
|
||||||
|
|
||||||
task->cdb_size = 10;
|
task->cdb_size = 10;
|
||||||
if (xferlen != 0) {
|
if (xferlen != 0 && bytchk) {
|
||||||
task->xfer_dir = SCSI_XFER_WRITE;
|
task->xfer_dir = SCSI_XFER_WRITE;
|
||||||
|
task->expxferlen = xferlen;
|
||||||
} else {
|
} else {
|
||||||
task->xfer_dir = SCSI_XFER_NONE;
|
task->xfer_dir = SCSI_XFER_NONE;
|
||||||
|
task->expxferlen = 0;
|
||||||
}
|
}
|
||||||
task->expxferlen = xferlen;
|
|
||||||
|
|
||||||
task->params.verify10.lba = lba;
|
task->params.verify10.lba = lba;
|
||||||
task->params.verify10.num_blocks = xferlen/blocksize;
|
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);
|
*(uint32_t *)&task->cdb[6] = htonl(xferlen/blocksize);
|
||||||
|
|
||||||
task->cdb_size = 12;
|
task->cdb_size = 12;
|
||||||
if (xferlen != 0) {
|
if (xferlen != 0 && bytchk) {
|
||||||
task->xfer_dir = SCSI_XFER_WRITE;
|
task->xfer_dir = SCSI_XFER_WRITE;
|
||||||
|
task->expxferlen = xferlen;
|
||||||
} else {
|
} else {
|
||||||
task->xfer_dir = SCSI_XFER_NONE;
|
task->xfer_dir = SCSI_XFER_NONE;
|
||||||
|
task->expxferlen = 0;
|
||||||
}
|
}
|
||||||
task->expxferlen = xferlen;
|
|
||||||
|
|
||||||
task->params.verify12.lba = lba;
|
task->params.verify12.lba = lba;
|
||||||
task->params.verify12.num_blocks = xferlen/blocksize;
|
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);
|
*(uint32_t *)&task->cdb[10] = htonl(xferlen/blocksize);
|
||||||
|
|
||||||
task->cdb_size = 16;
|
task->cdb_size = 16;
|
||||||
if (xferlen != 0) {
|
if (xferlen != 0 && bytchk) {
|
||||||
task->xfer_dir = SCSI_XFER_WRITE;
|
task->xfer_dir = SCSI_XFER_WRITE;
|
||||||
|
task->expxferlen = xferlen;
|
||||||
} else {
|
} else {
|
||||||
task->xfer_dir = SCSI_XFER_NONE;
|
task->xfer_dir = SCSI_XFER_NONE;
|
||||||
|
task->expxferlen = 0;
|
||||||
}
|
}
|
||||||
task->expxferlen = xferlen;
|
|
||||||
|
|
||||||
task->params.verify16.lba = lba;
|
task->params.verify16.lba = lba;
|
||||||
task->params.verify16.num_blocks = xferlen/blocksize;
|
task->params.verify16.num_blocks = xferlen/blocksize;
|
||||||
|
|||||||
Reference in New Issue
Block a user