summaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorMichael Callahan <michaelcallahan@fb.com>2018-07-18 07:47:40 -0400
committerJens Axboe <axboe@kernel.dk>2018-07-18 10:44:22 -0400
commitbdca3c87fb7ad1cc61d231d37eb0d8f90d001e0c (patch)
treea5890cef3e0fb586f2a2b2a366423e71af96d821 /block/genhd.c
parentddcf35d397976421a4ec1d0d00fbcc027a8cb034 (diff)
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 'block/genhd.c')
-rw-r--r--block/genhd.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 0711a800d0d4..8cc719a37b32 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1333,8 +1333,11 @@ static int diskstats_show(struct seq_file *seqf, void *v)
1333 part_round_stats(gp->queue, cpu, hd); 1333 part_round_stats(gp->queue, cpu, hd);
1334 part_stat_unlock(); 1334 part_stat_unlock();
1335 part_in_flight(gp->queue, hd, inflight); 1335 part_in_flight(gp->queue, hd, inflight);
1336 seq_printf(seqf, "%4d %7d %s %lu %lu %lu " 1336 seq_printf(seqf, "%4d %7d %s "
1337 "%u %lu %lu %lu %u %u %u %u\n", 1337 "%lu %lu %lu %u "
1338 "%lu %lu %lu %u "
1339 "%u %u %u "
1340 "%lu %lu %lu %u\n",
1338 MAJOR(part_devt(hd)), MINOR(part_devt(hd)), 1341 MAJOR(part_devt(hd)), MINOR(part_devt(hd)),
1339 disk_name(gp, hd->partno, buf), 1342 disk_name(gp, hd->partno, buf),
1340 part_stat_read(hd, ios[STAT_READ]), 1343 part_stat_read(hd, ios[STAT_READ]),
@@ -1347,7 +1350,11 @@ static int diskstats_show(struct seq_file *seqf, void *v)
1347 jiffies_to_msecs(part_stat_read(hd, ticks[STAT_WRITE])), 1350 jiffies_to_msecs(part_stat_read(hd, ticks[STAT_WRITE])),
1348 inflight[0], 1351 inflight[0],
1349 jiffies_to_msecs(part_stat_read(hd, io_ticks)), 1352 jiffies_to_msecs(part_stat_read(hd, io_ticks)),
1350 jiffies_to_msecs(part_stat_read(hd, time_in_queue)) 1353 jiffies_to_msecs(part_stat_read(hd, time_in_queue)),
1354 part_stat_read(hd, ios[STAT_DISCARD]),
1355 part_stat_read(hd, merges[STAT_DISCARD]),
1356 part_stat_read(hd, sectors[STAT_DISCARD]),
1357 jiffies_to_msecs(part_stat_read(hd, ticks[STAT_DISCARD]))
1351 ); 1358 );
1352 } 1359 }
1353 disk_part_iter_exit(&piter); 1360 disk_part_iter_exit(&piter);