aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2015-11-24 14:17:59 +0200
committerJohn Snow <jsnow@redhat.com>2015-11-24 14:56:48 -0500
commit36be0929f53260cb9b1e2720c7c22f6b5fb5910f (patch)
tree2c4dac4911a07fe54fcf1ba29c1cc4441c5c7348
parenta421f3c38509ee4ce47230ec68c5c3a184efb538 (diff)
atapi: Account for failed and invalid operations in cd_read_sector()
Commit 5f81724d made PIO read requests async but didn't add the relevant block_acct_failed() and block_acct_invalid() calls. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: 9b87e09d61019c128139b6c999ed0c07f0674170.1448367341.git.berto@igalia.com Signed-off-by: John Snow <jsnow@redhat.com>
-rw-r--r--hw/ide/atapi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 7b9f74c3b5..5e3791cd4a 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -148,17 +148,18 @@ static void cd_read_sector_cb(void *opaque, int ret)
{
IDEState *s = opaque;
- block_acct_done(blk_get_stats(s->blk), &s->acct);
-
#ifdef DEBUG_IDE_ATAPI
printf("cd_read_sector_cb: lba=%d ret=%d\n", s->lba, ret);
#endif
if (ret < 0) {
+ block_acct_failed(blk_get_stats(s->blk), &s->acct);
ide_atapi_io_error(s, ret);
return;
}
+ block_acct_done(blk_get_stats(s->blk), &s->acct);
+
if (s->cd_sector_size == 2352) {
cd_data_to_raw(s->io_buffer, s->lba);
}
@@ -173,6 +174,7 @@ static void cd_read_sector_cb(void *opaque, int ret)
static int cd_read_sector(IDEState *s)
{
if (s->cd_sector_size != 2048 && s->cd_sector_size != 2352) {
+ block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ);
return -EINVAL;
}