aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-19 08:50:47 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-19 08:50:47 -0600
commitddf83d0173c6a64a95a6640e4bfcea4cd789cad2 (patch)
treed515cadede7bae9ee72e66a57140a7288b5aac36 /hw
parentea830ebb74461c5ad6d199857fb000d2e0284c69 (diff)
parentbd83b3620517ef9f2079cfda465953e60263f623 (diff)
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Diffstat (limited to 'hw')
-rw-r--r--hw/ide/atapi.c8
-rw-r--r--hw/ide/core.c13
-rw-r--r--hw/ide/macio.c11
-rw-r--r--hw/scsi-disk.c9
-rw-r--r--hw/scsi-generic.c4
-rw-r--r--hw/virtio-blk.c19
6 files changed, 7 insertions, 57 deletions
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 8af1cfdd7e..0adb27b799 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -352,14 +352,8 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret)
s->bus->dma->aiocb = bdrv_aio_readv(s->bs, (int64_t)s->lba << 2,
&s->bus->dma->qiov, n * 4,
ide_atapi_cmd_read_dma_cb, s);
- if (!s->bus->dma->aiocb) {
- /* Note: media not present is the most likely case */
- ide_atapi_cmd_error(s, NOT_READY,
- ASC_MEDIUM_NOT_PRESENT);
- goto eot;
- }
-
return;
+
eot:
bdrv_acct_done(s->bs, &s->acct);
s->bus->dma->ops->add_status(s->bus->dma, BM_STATUS_INT);
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 49847bd3ea..de9ed411a2 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -549,7 +549,6 @@ void ide_dma_cb(void *opaque, int ret)
int n;
int64_t sector_num;
-handle_rw_error:
if (ret < 0) {
int op = BM_STATUS_DMA_RETRY;
@@ -608,11 +607,6 @@ handle_rw_error:
ide_issue_trim, ide_dma_cb, s, true);
break;
}
-
- if (!s->bus->dma->aiocb) {
- ret = -1;
- goto handle_rw_error;
- }
return;
eot:
@@ -718,18 +712,13 @@ static void ide_flush_cb(void *opaque, int ret)
void ide_flush_cache(IDEState *s)
{
- BlockDriverAIOCB *acb;
-
if (s->bs == NULL) {
ide_flush_cb(s, 0);
return;
}
bdrv_acct_start(s->bs, &s->acct, 0, BDRV_ACCT_FLUSH);
- acb = bdrv_aio_flush(s->bs, ide_flush_cb, s);
- if (acb == NULL) {
- ide_flush_cb(s, -EIO);
- }
+ bdrv_aio_flush(s->bs, ide_flush_cb, s);
}
static void ide_cfata_metadata_inquiry(IDEState *s)
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index c09d2e0a35..abbc41b59e 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -84,13 +84,6 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
m->aiocb = dma_bdrv_read(s->bs, &s->sg,
(int64_t)(s->lba << 2) + (s->io_buffer_index >> 9),
pmac_ide_atapi_transfer_cb, io);
- if (!m->aiocb) {
- qemu_sglist_destroy(&s->sg);
- /* Note: media not present is the most likely case */
- ide_atapi_cmd_error(s, NOT_READY,
- ASC_MEDIUM_NOT_PRESENT);
- goto done;
- }
return;
done:
@@ -159,10 +152,8 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
ide_issue_trim, pmac_ide_transfer_cb, s, true);
break;
}
-
- if (!m->aiocb)
- pmac_ide_transfer_cb(io, -1);
return;
+
done:
if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) {
bdrv_acct_done(s->bs, &s->acct);
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 673948c51f..505accdde5 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -217,9 +217,6 @@ static void scsi_read_data(SCSIRequest *req)
bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);
r->req.aiocb = bdrv_aio_readv(s->qdev.conf.bs, r->sector, &r->qiov, n,
scsi_read_complete, r);
- if (r->req.aiocb == NULL) {
- scsi_read_complete(r, -EIO);
- }
}
/*
@@ -327,9 +324,6 @@ static void scsi_write_data(SCSIRequest *req)
bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_WRITE);
r->req.aiocb = bdrv_aio_writev(s->qdev.conf.bs, r->sector, &r->qiov, n,
scsi_write_complete, r);
- if (r->req.aiocb == NULL) {
- scsi_write_complete(r, -ENOMEM);
- }
} else {
/* Called for the first time. Ask the driver to send us more data. */
scsi_write_complete(r, 0);
@@ -1332,9 +1326,6 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf)
scsi_req_ref(&r->req);
bdrv_acct_start(s->qdev.conf.bs, &r->acct, 0, BDRV_ACCT_FLUSH);
r->req.aiocb = bdrv_aio_flush(s->qdev.conf.bs, scsi_flush_complete, r);
- if (r->req.aiocb == NULL) {
- scsi_flush_complete(r, -EIO);
- }
return 0;
case READ_6:
case READ_10:
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index e62044f395..6f7d3db775 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -152,10 +152,6 @@ static int execute_command(BlockDriverState *bdrv,
r->io_header.flags |= SG_FLAG_DIRECT_IO;
r->req.aiocb = bdrv_aio_ioctl(bdrv, SG_IO, &r->io_header, complete, r);
- if (r->req.aiocb == NULL) {
- BADF("execute_command: read failed !\n");
- return -ENOMEM;
- }
return 0;
}
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 4b0d113ba8..ef27421d46 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -288,19 +288,13 @@ static void virtio_submit_multiwrite(BlockDriverState *bs, MultiReqBuffer *mrb)
static void virtio_blk_handle_flush(VirtIOBlockReq *req, MultiReqBuffer *mrb)
{
- BlockDriverAIOCB *acb;
-
bdrv_acct_start(req->dev->bs, &req->acct, 0, BDRV_ACCT_FLUSH);
/*
* Make sure all outstanding writes are posted to the backing device.
*/
virtio_submit_multiwrite(req->dev->bs, mrb);
-
- acb = bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req);
- if (!acb) {
- virtio_blk_flush_complete(req, -EIO);
- }
+ bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req);
}
static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb)
@@ -340,7 +334,6 @@ static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb)
static void virtio_blk_handle_read(VirtIOBlockReq *req)
{
- BlockDriverAIOCB *acb;
uint64_t sector;
sector = ldq_p(&req->out->sector);
@@ -355,13 +348,9 @@ static void virtio_blk_handle_read(VirtIOBlockReq *req)
virtio_blk_rw_complete(req, -EIO);
return;
}
-
- acb = bdrv_aio_readv(req->dev->bs, sector, &req->qiov,
- req->qiov.size / BDRV_SECTOR_SIZE,
- virtio_blk_rw_complete, req);
- if (!acb) {
- virtio_blk_rw_complete(req, -EIO);
- }
+ bdrv_aio_readv(req->dev->bs, sector, &req->qiov,
+ req->qiov.size / BDRV_SECTOR_SIZE,
+ virtio_blk_rw_complete, req);
}
static void virtio_blk_handle_request(VirtIOBlockReq *req,