[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v7 4/9] ide: account UNMAP (TRIM) operations
From: |
Anton Nefedov |
Subject: |
[Qemu-block] [PATCH v7 4/9] ide: account UNMAP (TRIM) operations |
Date: |
Tue, 14 May 2019 12:10:44 +0000 |
Signed-off-by: Anton Nefedov <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
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);
+ }
+ }
+
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,
--
2.17.1
- [Qemu-block] [PATCH v7 0/9] discard blockstats, Anton Nefedov, 2019/05/14
- [Qemu-block] [PATCH v7 1/9] qapi: group BlockDeviceStats fields, Anton Nefedov, 2019/05/14
- [Qemu-block] [PATCH v7 5/9] scsi: store unmap offset and nb_sectors in request struct, Anton Nefedov, 2019/05/14
- [Qemu-block] [PATCH v7 2/9] qapi: add unmap to BlockDeviceStats, Anton Nefedov, 2019/05/14
- [Qemu-block] [PATCH v7 3/9] block: add empty account cookie type, Anton Nefedov, 2019/05/14
- [Qemu-block] [PATCH v7 4/9] ide: account UNMAP (TRIM) operations,
Anton Nefedov <=
- [Qemu-block] [PATCH v7 6/9] scsi: move unmap error checking to the complete callback, Anton Nefedov, 2019/05/14
- [Qemu-block] [PATCH v7 7/9] scsi: account unmap operations, Anton Nefedov, 2019/05/14
- [Qemu-block] [PATCH v7 8/9] file-posix: account discard operations, Anton Nefedov, 2019/05/14
- [Qemu-block] [PATCH v7 9/9] qapi: query-blockstat: add driver specific file-posix stats, Anton Nefedov, 2019/05/14