mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-29 06:20:26 +00:00
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>
This commit is contained in:
parent
a421f3c385
commit
36be0929f5
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user