Re: [Qemu-block] [PATCH v2 3/8] ide: account UNMAP (TRIM) operations
On Fri 19 Jan 2018 01:50:02 PM CET, Anton Nefedov wrote: > Signed-off-by: Anton NefedovReviewed-by: Alberto Garcia Berto
Re: [Qemu-block] [PATCH v2 3/8] ide: account UNMAP (TRIM) operations
On 22/1/2018 11:48 PM, Eric Blake wrote: On 01/19/2018 06:50 AM, Anton Nefedov wrote: Signed-off-by: Anton Nefedov--- hw/ide/core.c | 13 + 1 file changed, 13 insertions(+) @@ -460,10 +468,15 @@ 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->is_invalid = true; goto done; } +block_acct_start(blk_get_stats(s->blk), >acct, + count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNMAP); We're still mixing bytes- and block-based reporting; how easy or hard would it be to flip block_acct_start() and friends to be byte-based? Quite easy, they already are :)
Re: [Qemu-block] [PATCH v2 3/8] ide: account UNMAP (TRIM) operations
On 01/19/2018 06:50 AM, Anton Nefedov wrote: > Signed-off-by: Anton Nefedov> --- > hw/ide/core.c | 13 + > 1 file changed, 13 insertions(+) > > @@ -460,10 +468,15 @@ 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->is_invalid = true; > goto done; > } > > +block_acct_start(blk_get_stats(s->blk), >acct, > + count << BDRV_SECTOR_BITS, > BLOCK_ACCT_UNMAP); We're still mixing bytes- and block-based reporting; how easy or hard would it be to flip block_acct_start() and friends to be byte-based? But not the subject of this series, per se. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org signature.asc Description: OpenPGP digital signature
[Qemu-block] [PATCH v2 3/8] ide: account UNMAP (TRIM) operations
Signed-off-by: Anton Nefedov--- hw/ide/core.c | 13 + 1 file changed, 13 insertions(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 5be72d4..6fdc936 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -443,6 +443,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), >acct); +} else { +block_acct_failed(blk_get_stats(s->blk), >acct); +} +} + if (ret >= 0) { while (iocb->j < iocb->qiov->niov) { int j = iocb->j; @@ -460,10 +468,15 @@ 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->is_invalid = true; goto done; } +block_acct_start(blk_get_stats(s->blk), >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, -- 2.7.4