All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/8] discard blockstats
@ 2018-01-19 12:49 Anton Nefedov
  2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 1/8] qapi: group BlockDeviceStats fields Anton Nefedov
                   ` (7 more replies)
  0 siblings, 8 replies; 35+ messages in thread
From: Anton Nefedov @ 2018-01-19 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-block, kwolf, mreitz, armbru, jsnow, pbonzini, eblake, den,
	Anton Nefedov

v2: - rebased on top of series 'ide: abort TRIM operation for invalid range'
      (http://lists.nongnu.org/archive/html/qemu-devel/2017-12/msg01432.html)
      Now invalid trim requests are properly accounted

    - patches 1/2 - qapi fields regrouped together

v1: http://lists.nongnu.org/archive/html/qemu-devel/2017-11/msg03664.html

----

qmp query-blockstats provides stats info for write/read/flush ops.

Patches 1-5 implement the similar for discard (unmap) command for scsi
and ide disks.
Discard stat "unmap_ops / unmap_bytes" is supposed to account the ops that
have completed without an error.

However, discard operation is advisory. Specifically,
 - common block layer ignores ENOTSUP error code.
   That might be returned if the block driver does not support discard,
   or discard has been configured to be ignored.
 - format drivers such as qcow2 may ignore discard if they were configured
   to ignore that, or if the corresponding area is already marked unused
   (unallocated / zero clusters).

And what is actually useful is the number of bytes actually discarded
down on the host filesystem.
To achieve that, driver-specific statistics has been added to blockstats
(patch 7).
With patch 6, file-posix driver accounts discard operations on its level too.

query-blockstat result:

(note the difference between blockdevice unmap and file discard stats. qcow2
sends a few ops down to the file as the clusters are actually unallocated
on qcow2 level)

{"return": [
{"device": "drive-scsi0-0-0-0"
  "parent": {
    "stats": {
>      "unmap_operations": 0
>      "unmap_merged": 0
      "flush_total_time_ns": 0
      "wr_highest_offset": 8111718400
      [..]
      "invalid_wr_operations": 0
      "invalid_rd_operations": 0}
    "node-name": "#block047"
>    "driver_stats": {
>      "type": "file"
>      "data": {
>        "discard_bytes_ok": 1572864
>        "discard_nb_failed": 0
>        "discard_nb_ok": 5}}}
  "stats": {
>   "unmap_operations": 472
>   "unmap_merged": 0
    "flush_total_time_ns": 44530540
    "wr_highest_offset": 7106662400
    "wr_total_time_ns": 45518856
    "failed_wr_operations": 0
    "failed_rd_operations": 0
    "wr_merged": 0
    "wr_bytes": 889856
    "timed_stats": []
>    "failed_unmap_operations": 0
    "failed_flush_operations": 0
    "account_invalid": true
    "rd_total_time_ns": 3306264098
>    "invalid_unmap_operations": 0
    "flush_operations": 18
    "wr_operations": 120
>    "unmap_bytes": 12312014848
    "rd_merged": 0
    "rd_bytes": 137103360
>    "unmap_total_time_ns": 22664692
    "invalid_flush_operations": 0
    "account_failed": true
    "idle_time_ns": 437316567
    "rd_operations": 5636
    "invalid_wr_operations": 0
    "invalid_rd_operations": 0}
  "node-name": "#block128"}

  {"device": "drive-ide0-0-0"
  [..]

Anton Nefedov (8):
  qapi: group BlockDeviceStats fields
  qapi: add unmap to BlockDeviceStats
  ide: account UNMAP (TRIM) operations
  scsi: store unmap offset and nb_sectors in request struct
  scsi: move unmap error checking to the complete callback
  scsi: account unmap operations
  file-posix: account discard operations
  qapi: query-blockstat: add driver specific file-posix stats

 qapi/block-core.json       | 78 ++++++++++++++++++++++++++++++++++++++++++----
 include/block/accounting.h |  1 +
 include/block/block.h      |  1 +
 include/block/block_int.h  |  1 +
 block.c                    |  9 ++++++
 block/file-posix.c         | 42 +++++++++++++++++++++++--
 block/qapi.c               | 11 +++++++
 hw/ide/core.c              | 13 ++++++++
 hw/scsi/scsi-disk.c        | 29 ++++++++++-------
 9 files changed, 166 insertions(+), 19 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2018-06-13 11:40 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 12:49 [Qemu-devel] [PATCH v2 0/8] discard blockstats Anton Nefedov
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 1/8] qapi: group BlockDeviceStats fields Anton Nefedov
2018-02-06 13:12   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-02-12 16:18     ` Anton Nefedov
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 2/8] qapi: add unmap to BlockDeviceStats Anton Nefedov
2018-01-22 20:47   ` Eric Blake
2018-01-23 10:35     ` Anton Nefedov
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 3/8] ide: account UNMAP (TRIM) operations Anton Nefedov
2018-01-22 20:48   ` Eric Blake
2018-01-23 10:39     ` Anton Nefedov
2018-02-07 14:39   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 4/8] scsi: store unmap offset and nb_sectors in request struct Anton Nefedov
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 5/8] scsi: move unmap error checking to the complete callback Anton Nefedov
2018-02-07 15:00   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 6/8] scsi: account unmap operations Anton Nefedov
2018-02-07 15:03   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 7/8] file-posix: account discard operations Anton Nefedov
2018-02-07 15:10   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-02-12 16:19     ` Anton Nefedov
2018-02-16 11:36       ` Alberto Garcia
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 8/8] qapi: query-blockstat: add driver specific file-posix stats Anton Nefedov
2018-01-22 20:55   ` Eric Blake
2018-01-23 11:28     ` Anton Nefedov
2018-01-23 14:53       ` Eric Blake
2018-02-03 15:59     ` Markus Armbruster
2018-02-12 16:38       ` Anton Nefedov
2018-02-15 10:23         ` Anton Nefedov
2018-02-15 14:32           ` Eric Blake
2018-06-07 14:32       ` Anton Nefedov
2018-06-07 15:09         ` Markus Armbruster
2018-06-07 15:23           ` Anton Nefedov
2018-06-07 18:45             ` Eric Blake
2018-06-08  5:29               ` Markus Armbruster
2018-06-13 10:36                 ` Anton Nefedov
2018-06-13 11:40                   ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.