scsi: set free_fn in spdk_scsi_task_construct()
The task free callback function is required, so make its assignment part of task construction. Change-Id: I2f5fdf73b064653ee85b4e7961cb1653a0a4107d Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
1aea6c5b6f
commit
7145cf62c6
@ -213,6 +213,7 @@ const char *spdk_scsi_port_get_name(const struct spdk_scsi_port *port);
|
|||||||
|
|
||||||
|
|
||||||
void spdk_scsi_task_construct(struct spdk_scsi_task *task, uint32_t *owner_task_ctr,
|
void spdk_scsi_task_construct(struct spdk_scsi_task *task, uint32_t *owner_task_ctr,
|
||||||
|
void (*free_fn)(struct spdk_scsi_task *task),
|
||||||
struct spdk_scsi_task *parent);
|
struct spdk_scsi_task *parent);
|
||||||
void spdk_scsi_task_put(struct spdk_scsi_task *task);
|
void spdk_scsi_task_put(struct spdk_scsi_task *task);
|
||||||
|
|
||||||
|
@ -59,11 +59,11 @@ spdk_iscsi_task_get(uint32_t *owner_task_ctr, struct spdk_iscsi_task *parent)
|
|||||||
|
|
||||||
memset(task, 0, sizeof(*task));
|
memset(task, 0, sizeof(*task));
|
||||||
spdk_scsi_task_construct((struct spdk_scsi_task *)task, owner_task_ctr,
|
spdk_scsi_task_construct((struct spdk_scsi_task *)task, owner_task_ctr,
|
||||||
|
spdk_iscsi_task_free,
|
||||||
(struct spdk_scsi_task *)parent);
|
(struct spdk_scsi_task *)parent);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
task->tag = parent->tag;
|
task->tag = parent->tag;
|
||||||
}
|
}
|
||||||
task->scsi.free_fn = spdk_iscsi_task_free;
|
|
||||||
|
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,12 @@ spdk_scsi_task_put(struct spdk_scsi_task *task)
|
|||||||
|
|
||||||
void
|
void
|
||||||
spdk_scsi_task_construct(struct spdk_scsi_task *task, uint32_t *owner_task_ctr,
|
spdk_scsi_task_construct(struct spdk_scsi_task *task, uint32_t *owner_task_ctr,
|
||||||
|
void (*free_fn)(struct spdk_scsi_task *task),
|
||||||
struct spdk_scsi_task *parent)
|
struct spdk_scsi_task *parent)
|
||||||
{
|
{
|
||||||
|
assert(free_fn != NULL);
|
||||||
|
task->free_fn = free_fn;
|
||||||
|
|
||||||
task->ref++;
|
task->ref++;
|
||||||
|
|
||||||
assert(owner_task_ctr != NULL);
|
assert(owner_task_ctr != NULL);
|
||||||
|
@ -83,8 +83,7 @@ spdk_vhost_task_get(uint32_t *owner_task_ctr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(task, 0, sizeof(*task));
|
memset(task, 0, sizeof(*task));
|
||||||
spdk_scsi_task_construct(&task->scsi, owner_task_ctr, NULL);
|
spdk_scsi_task_construct(&task->scsi, owner_task_ctr, spdk_vhost_task_free_cb, NULL);
|
||||||
task->scsi.free_fn = spdk_vhost_task_free_cb;
|
|
||||||
|
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,7 @@ spdk_get_task(uint32_t *owner_task_ctr)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
spdk_scsi_task_construct(task, &g_task_count, NULL);
|
spdk_scsi_task_construct(task, &g_task_count, spdk_lun_ut_free_task, NULL);
|
||||||
task->free_fn = spdk_lun_ut_free_task;
|
|
||||||
|
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user