On 16.05.19 16:33, Anton Nefedov wrote: > Signed-off-by: Anton Nefedov > Reviewed-by: Vladimir Sementsov-Ogievskiy > --- > hw/ide/core.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/hw/ide/core.c b/hw/ide/core.c > index 6afadf894f..3a7ac93777 100644 > --- a/hw/ide/core.c > +++ b/hw/ide/core.c > @@ -441,6 +441,14 @@ static void ide_issue_trim_cb(void *opaque, int ret) > TrimAIOCB *iocb = opaque; > IDEState *s = iocb->s; > > + if (iocb->i >= 0) { > + if (ret >= 0) { > + block_acct_done(blk_get_stats(s->blk), &s->acct); > + } else { > + block_acct_failed(blk_get_stats(s->blk), &s->acct); Hmm, in other places (ide_handle_rw_error() here or scsi_handle_rw_error() in scsi-disk) only report this with BLOCK_ERROR_ACTION_REPORT. So I’m wondering whether the same should be done here. Max > + } > + } > + > if (ret >= 0) { > while (iocb->j < iocb->qiov->niov) { > int j = iocb->j; > @@ -458,10 +466,14 @@ static void ide_issue_trim_cb(void *opaque, int ret) > } > > if (!ide_sect_range_ok(s, sector, count)) { > + block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_UNMAP); > iocb->ret = -EINVAL; > goto done; > } > > + block_acct_start(blk_get_stats(s->blk), &s->acct, > + count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNMAP); > + > /* Got an entry! Submit and exit. */ > iocb->aiocb = blk_aio_pdiscard(s->blk, > sector << BDRV_SECTOR_BITS, >