aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
authorAnton Nefedov <anton.nefedov@virtuozzo.com>2017-12-08 15:10:32 +0300
committerJohn Snow <jsnow@redhat.com>2018-01-19 16:04:54 -0500
commitef0e64a9838c0a20b5cb8a0bd2dcbcc59b0b812d (patch)
tree519b4bed24e1bbf38bc2c3a83110c495e2e47bd8 /hw/ide
parentb384cd95eb9c6f73ad84ed1bb0717a26e29cc78f (diff)
ide: pass IDEState to trim AIO callback
It will be needed to handle invalid requests Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Message-id: 1512735034-35327-2-git-send-email-anton.nefedov@virtuozzo.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/core.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 1ea5812b7e..875f7b442d 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -382,7 +382,7 @@ static void ide_set_signature(IDEState *s)
typedef struct TrimAIOCB {
BlockAIOCB common;
- BlockBackend *blk;
+ IDEState *s;
QEMUBH *bh;
int ret;
QEMUIOVector *qiov;
@@ -425,6 +425,8 @@ static void ide_trim_bh_cb(void *opaque)
static void ide_issue_trim_cb(void *opaque, int ret)
{
TrimAIOCB *iocb = opaque;
+ IDEState *s = iocb->s;
+
if (ret >= 0) {
while (iocb->j < iocb->qiov->niov) {
int j = iocb->j;
@@ -442,7 +444,7 @@ static void ide_issue_trim_cb(void *opaque, int ret)
}
/* Got an entry! Submit and exit. */
- iocb->aiocb = blk_aio_pdiscard(iocb->blk,
+ iocb->aiocb = blk_aio_pdiscard(s->blk,
sector << BDRV_SECTOR_BITS,
count << BDRV_SECTOR_BITS,
ide_issue_trim_cb, opaque);
@@ -466,11 +468,11 @@ BlockAIOCB *ide_issue_trim(
int64_t offset, QEMUIOVector *qiov,
BlockCompletionFunc *cb, void *cb_opaque, void *opaque)
{
- BlockBackend *blk = opaque;
+ IDEState *s = opaque;
TrimAIOCB *iocb;
- iocb = blk_aio_get(&trim_aiocb_info, blk, cb, cb_opaque);
- iocb->blk = blk;
+ iocb = blk_aio_get(&trim_aiocb_info, s->blk, cb, cb_opaque);
+ iocb->s = s;
iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);
iocb->ret = 0;
iocb->qiov = qiov;
@@ -900,7 +902,7 @@ static void ide_dma_cb(void *opaque, int ret)
case IDE_DMA_TRIM:
s->bus->dma->aiocb = dma_blk_io(blk_get_aio_context(s->blk),
&s->sg, offset, BDRV_SECTOR_SIZE,
- ide_issue_trim, s->blk, ide_dma_cb, s,
+ ide_issue_trim, s, ide_dma_cb, s,
DMA_DIRECTION_TO_DEVICE);
break;
default: