aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
authorMichael Callahan <michaelcallahan@fb.com>2018-07-18 04:47:40 -0700
committerJens Axboe <axboe@kernel.dk>2018-07-18 08:44:22 -0600
commitbdca3c87fb7ad1cc61d231d37eb0d8f90d001e0c (patch)
treea5890cef3e0fb586f2a2b2a366423e71af96d821 /include/linux/genhd.h
parentblock: Add and use op_stat_group() for indexing disk_stat fields. (diff)
downloadwireguard-linux-bdca3c87fb7ad1cc61d231d37eb0d8f90d001e0c.tar.xz
wireguard-linux-bdca3c87fb7ad1cc61d231d37eb0d8f90d001e0c.zip
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>
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r--include/linux/genhd.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index a75445446974..57864422a2c8 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -356,7 +356,8 @@ static inline void free_part_stats(struct hd_struct *part)
#define part_stat_read_accum(part, field) \
(part_stat_read(part, field[STAT_READ]) + \
- part_stat_read(part, field[STAT_WRITE]))
+ part_stat_read(part, field[STAT_WRITE]) + \
+ part_stat_read(part, field[STAT_DISCARD]))
#define part_stat_add(cpu, part, field, addnd) do { \
__part_stat_add((cpu), (part), field, addnd); \