Skip to content

Commit

Permalink
atapi: Account for failed and invalid operations in cd_read_sector()
Browse files Browse the repository at this point in the history
Commit 5f81724 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>
  • Loading branch information
bertogg authored and jnsnow committed Nov 24, 2015
1 parent a421f3c commit 36be092
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hw/ide/atapi.c
Expand Up @@ -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);
}
Expand All @@ -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;
}

Expand Down

0 comments on commit 36be092

Please sign in to comment.