diff --git a/scst/include/scst.h b/scst/include/scst.h index 0128eaa4b..221fd8ceb 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2116,13 +2116,11 @@ struct scst_cmd { /* * List of parsed data descriptors for commands operating with - * several lba and data_len pairs, like UNMAP. + * several lba and data_len pairs, like UNMAP, finished with zero + * length entry. */ void *cmd_data_descriptors; - /* Count of entries in the descriptors array */ - int cmd_data_descriptors_cnt; - #ifdef CONFIG_SCST_MEASURE_LATENCY /* * Must be the last to allow to work with drivers who don't know diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 3dfca7ee2..1bfa90749 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2034,8 +2034,7 @@ static enum compl_status_e vdisk_exec_unmap(struct vdisk_cmd_params *p) if (pd == NULL) goto out; - for (i = 0; i < cmd->cmd_data_descriptors_cnt; i++) { - struct scst_data_descriptor *d; + for (i = 0; pd[i].sdd_len != 0; i++) { int rc; if (unlikely(test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))) { @@ -2043,8 +2042,7 @@ static enum compl_status_e vdisk_exec_unmap(struct vdisk_cmd_params *p) goto out; } - d = &pd[i]; - rc = vdisk_unmap_range(cmd, virt_dev, d->sdd_lba, d->sdd_len); + rc = vdisk_unmap_range(cmd, virt_dev, pd[i].sdd_lba, pd[i].sdd_len); if (rc != 0) goto out; } diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 4ef2f1ffd..dc32c30b2 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -8217,7 +8217,6 @@ static bool scst_parse_unmap_descriptors(struct scst_cmd *cmd) } cmd->cmd_data_descriptors = pd; - cmd->cmd_data_descriptors_cnt = cnt; out_put: scst_put_buf_full(cmd, address);