Skip to content

Commit

Permalink
iscsi: Convert iscsi_aiocb_info.cancel to .cancel_async
Browse files Browse the repository at this point in the history
Also drop the unused field "canceled".

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
Fam Zheng authored and stefanhaRH committed Sep 22, 2014
1 parent 9bb9da4 commit 722d933
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions block/iscsi.c
Expand Up @@ -88,7 +88,6 @@ typedef struct IscsiAIOCB {
struct scsi_task *task;
uint8_t *buf;
int status;
int canceled;
int64_t sector_num;
int nb_sectors;
#ifdef __linux__
Expand Down Expand Up @@ -120,9 +119,7 @@ iscsi_bh_cb(void *p)
g_free(acb->buf);
acb->buf = NULL;

if (acb->canceled == 0) {
acb->common.cb(acb->common.opaque, acb->status);
}
acb->common.cb(acb->common.opaque, acb->status);

if (acb->task != NULL) {
scsi_free_scsi_task(acb->task);
Expand Down Expand Up @@ -240,20 +237,15 @@ iscsi_aio_cancel(BlockDriverAIOCB *blockacb)
return;
}

acb->canceled = 1;

/* send a task mgmt call to the target to cancel the task on the target */
iscsi_task_mgmt_abort_task_async(iscsilun->iscsi, acb->task,
iscsi_abort_task_cb, acb);

while (acb->status == -EINPROGRESS) {
aio_poll(iscsilun->aio_context, true);
}
}

static const AIOCBInfo iscsi_aiocb_info = {
.aiocb_size = sizeof(IscsiAIOCB),
.cancel = iscsi_aio_cancel,
.cancel_async = iscsi_aio_cancel,
};


Expand Down Expand Up @@ -638,10 +630,6 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status,
g_free(acb->buf);
acb->buf = NULL;

if (acb->canceled != 0) {
return;
}

acb->status = 0;
if (status < 0) {
error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s",
Expand Down Expand Up @@ -683,7 +671,6 @@ static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);

acb->iscsilun = iscsilun;
acb->canceled = 0;
acb->bh = NULL;
acb->status = -EINPROGRESS;
acb->buf = NULL;
Expand Down

0 comments on commit 722d933

Please sign in to comment.