[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 23/59] ide: Convert trim_aiocb_info.cancel to .can
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL v2 23/59] ide: Convert trim_aiocb_info.cancel to .cancel_async |
Date: |
Mon, 22 Sep 2014 12:41:54 +0100 |
From: Fam Zheng <address@hidden>
We know that either bh is scheduled or ide_issue_trim_cb will be called
again, so we just set i, j and ret to the right values. In both cases,
ide_trim_bh_cb will be called.
Also forward the cancellation to the iocb->aiocb which we get from
bdrv_aio_discard.
Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/ide/core.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index f15c026..055d150 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -372,23 +372,21 @@ static void trim_aio_cancel(BlockDriverAIOCB *acb)
{
TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common);
- /* Exit the loop in case bdrv_aio_cancel calls ide_issue_trim_cb again. */
+ /* Exit the loop so ide_issue_trim_cb will not continue */
iocb->j = iocb->qiov->niov - 1;
iocb->i = (iocb->qiov->iov[iocb->j].iov_len / 8) - 1;
- /* Tell ide_issue_trim_cb not to trigger the completion, too. */
- qemu_bh_delete(iocb->bh);
- iocb->bh = NULL;
+ iocb->ret = -ECANCELED;
if (iocb->aiocb) {
- bdrv_aio_cancel(iocb->aiocb);
+ bdrv_aio_cancel_async(iocb->aiocb);
+ iocb->aiocb = NULL;
}
- qemu_aio_release(iocb);
}
static const AIOCBInfo trim_aiocb_info = {
.aiocb_size = sizeof(TrimAIOCB),
- .cancel = trim_aio_cancel,
+ .cancel_async = trim_aio_cancel,
};
static void ide_trim_bh_cb(void *opaque)
--
1.9.3
- [Qemu-devel] [PULL v2 13/59] archipelago: Drop archipelago_aiocb_info.cancel, (continued)
- [Qemu-devel] [PULL v2 13/59] archipelago: Drop archipelago_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 14/59] blkdebug: Drop blkdebug_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 12/59] iscsi: Convert iscsi_aiocb_info.cancel to .cancel_async, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 16/59] curl: Drop curl_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 15/59] blkverify: Drop blkverify_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 17/59] qed: Drop qed_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 19/59] quorum: Convert quorum_aiocb_info.cancel to .cancel_async, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 21/59] sheepdog: Convert sd_aiocb_info.cancel to .cancel_async, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 20/59] rbd: Drop rbd_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 22/59] win32-aio: Drop win32_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 23/59] ide: Convert trim_aiocb_info.cancel to .cancel_async,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL v2 18/59] quorum: fix quorum_aio_cancel(), Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 24/59] block: Drop AIOCBInfo.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 25/59] block: Rename qemu_aio_release -> qemu_aio_unref, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 27/59] aio-win32: avoid out-of-bounds access to the events array, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 28/59] block: Introduce "null" drivers, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 29/59] qapi: Sort BlockdevDriver enum data list, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 26/59] qdev-monitor: fix segmentation fault on qdev_device_help(), Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 30/59] qapi: Sort items in BlockdevOptions definition, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 31/59] qapi/block: Add "fatal" to BLOCK_IMAGE_CORRUPTED, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 35/59] iotests: Add more tests for qcow2 corruption, Stefan Hajnoczi, 2014/09/22