block: Track DISCARD statistics and output them in stat and diskstat
authorMichael Callahan <michaelcallahan@fb.com>
Wed, 18 Jul 2018 11:47:40 +0000 (04:47 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 18 Jul 2018 14:44:22 +0000 (08:44 -0600)
commitbdca3c87fb7ad1cc61d231d37eb0d8f90d001e0c
treea5890cef3e0fb586f2a2b2a366423e71af96d821
parentddcf35d397976421a4ec1d0d00fbcc027a8cb034
block: Track DISCARD statistics and output them in stat and diskstat

Add tracking of REQ_OP_DISCARD ios to the partition statistics and
append them to the various stat files in /sys as well as
/proc/diskstats.  These are tracked with the same four stats as reads
and writes:

Number of discard ios completed.
Number of discard ios merged
Number of discard sectors completed
Milliseconds spent on discard requests

This is done via adding a new STAT_DISCARD define to genhd.h and then
using it to index that stat field for discard requests.

tj: Refreshed on top of v4.17 and other previous updates.

Signed-off-by: Michael Callahan <michaelcallahan@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Andy Newell <newella@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Documentation/ABI/testing/procfs-diskstats
Documentation/block/stat.txt
Documentation/iostats.txt
block/genhd.c
block/partition-generic.c
include/linux/blk_types.h
include/linux/genhd.h