OSDN Git Service

block: use nanosecond resolution for iostat
authorOmar Sandoval <osandov@fb.com>
Fri, 21 Sep 2018 23:44:34 +0000 (16:44 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 22 Sep 2018 02:26:59 +0000 (20:26 -0600)
commitb57e99b4b8b0ebdf9707424e7ddc0c392bdc5fe6
tree403679b552a10c8258d4375c561421b367504781
parentd611aaf336b2e8e81f98490eabf7b92889b15319
block: use nanosecond resolution for iostat

Klaus Kusche reported that the I/O busy time in /proc/diskstats was not
updating properly on 4.18. This is because we started using ktime to
track elapsed time, and we convert nanoseconds to jiffies when we update
the partition counter. However, this gets rounded down, so any I/Os that
take less than a jiffy are not accounted for. Previously in this case,
the value of jiffies would sometimes increment while we were doing I/O,
so at least some I/Os were accounted for.

Let's convert the stats to use nanoseconds internally. We still report
milliseconds as before, now more accurately than ever. The value is
still truncated to 32 bits for backwards compatibility.

Fixes: 522a777566f5 ("block: consolidate struct request timestamp fields")
Cc: stable@vger.kernel.org
Reported-by: Klaus Kusche <klaus.kusche@computerix.info>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c
block/blk-core.c
block/genhd.c
block/partition-generic.c
include/linux/genhd.h