• Omar Sandoval's avatar
    block: use nanosecond resolution for iostat · b57e99b4
    Omar Sandoval authored
    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: 522a7775 ("block: consolidate struct request timestamp fields")
    Cc: stable@vger.kernel.org
    Reported-by: default avatarKlaus Kusche <klaus.kusche@computerix.info>
    Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    b57e99b4
bio.c 51.3 KB