hw/ide: drop iov field from IDEState
@iov is used only to initialize @qiov. Let's use new qemu_iovec_init_buf() instead, which simplifies the code. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20190218140926.333779-16-vsementsov@virtuozzo.com Message-Id: <20190218140926.333779-16-vsementsov@virtuozzo.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
405d8fe0ba
commit
e5863d49e4
@ -174,16 +174,15 @@ static void cd_read_sector_cb(void *opaque, int ret)
|
|||||||
|
|
||||||
static int cd_read_sector(IDEState *s)
|
static int cd_read_sector(IDEState *s)
|
||||||
{
|
{
|
||||||
|
void *buf;
|
||||||
|
|
||||||
if (s->cd_sector_size != 2048 && s->cd_sector_size != 2352) {
|
if (s->cd_sector_size != 2048 && s->cd_sector_size != 2352) {
|
||||||
block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ);
|
block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->iov.iov_base = (s->cd_sector_size == 2352) ?
|
buf = (s->cd_sector_size == 2352) ? s->io_buffer + 16 : s->io_buffer;
|
||||||
s->io_buffer + 16 : s->io_buffer;
|
qemu_iovec_init_buf(&s->qiov, buf, ATAPI_SECTOR_SIZE);
|
||||||
|
|
||||||
s->iov.iov_len = ATAPI_SECTOR_SIZE;
|
|
||||||
qemu_iovec_init_external(&s->qiov, &s->iov, 1);
|
|
||||||
|
|
||||||
trace_cd_read_sector(s->lba);
|
trace_cd_read_sector(s->lba);
|
||||||
|
|
||||||
|
@ -774,9 +774,7 @@ static void ide_sector_read(IDEState *s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->iov.iov_base = s->io_buffer;
|
qemu_iovec_init_buf(&s->qiov, s->io_buffer, n * BDRV_SECTOR_SIZE);
|
||||||
s->iov.iov_len = n * BDRV_SECTOR_SIZE;
|
|
||||||
qemu_iovec_init_external(&s->qiov, &s->iov, 1);
|
|
||||||
|
|
||||||
block_acct_start(blk_get_stats(s->blk), &s->acct,
|
block_acct_start(blk_get_stats(s->blk), &s->acct,
|
||||||
n * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);
|
n * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);
|
||||||
@ -1045,9 +1043,7 @@ static void ide_sector_write(IDEState *s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->iov.iov_base = s->io_buffer;
|
qemu_iovec_init_buf(&s->qiov, s->io_buffer, n * BDRV_SECTOR_SIZE);
|
||||||
s->iov.iov_len = n * BDRV_SECTOR_SIZE;
|
|
||||||
qemu_iovec_init_external(&s->qiov, &s->iov, 1);
|
|
||||||
|
|
||||||
block_acct_start(blk_get_stats(s->blk), &s->acct,
|
block_acct_start(blk_get_stats(s->blk), &s->acct,
|
||||||
n * BDRV_SECTOR_SIZE, BLOCK_ACCT_WRITE);
|
n * BDRV_SECTOR_SIZE, BLOCK_ACCT_WRITE);
|
||||||
|
@ -405,7 +405,6 @@ struct IDEState {
|
|||||||
int atapi_dma; /* true if dma is requested for the packet cmd */
|
int atapi_dma; /* true if dma is requested for the packet cmd */
|
||||||
BlockAcctCookie acct;
|
BlockAcctCookie acct;
|
||||||
BlockAIOCB *pio_aiocb;
|
BlockAIOCB *pio_aiocb;
|
||||||
struct iovec iov;
|
|
||||||
QEMUIOVector qiov;
|
QEMUIOVector qiov;
|
||||||
QLIST_HEAD(, IDEBufferedRequest) buffered_requests;
|
QLIST_HEAD(, IDEBufferedRequest) buffered_requests;
|
||||||
/* ATA DMA state */
|
/* ATA DMA state */
|
||||||
|
Loading…
Reference in New Issue
Block a user