1898bd37aSMauro Carvalho Chehab=============================================== 237a32795SAndy IsaacsonBlock layer statistics in /sys/block/<dev>/stat 337a32795SAndy Isaacson=============================================== 437a32795SAndy Isaacson 537a32795SAndy IsaacsonThis file documents the contents of the /sys/block/<dev>/stat file. 637a32795SAndy Isaacson 737a32795SAndy IsaacsonThe stat file provides several statistics about the state of block 837a32795SAndy Isaacsondevice <dev>. 937a32795SAndy Isaacson 10898bd37aSMauro Carvalho ChehabQ. 11898bd37aSMauro Carvalho Chehab Why are there multiple statistics in a single file? Doesn't sysfs 1237a32795SAndy Isaacson normally contain a single value per file? 13898bd37aSMauro Carvalho Chehab 14898bd37aSMauro Carvalho ChehabA. 15898bd37aSMauro Carvalho Chehab By having a single file, the kernel can guarantee that the statistics 1637a32795SAndy Isaacson represent a consistent snapshot of the state of the device. If the 1737a32795SAndy Isaacson statistics were exported as multiple files containing one statistic 1837a32795SAndy Isaacson each, it would be impossible to guarantee that a set of readings 1937a32795SAndy Isaacson represent a single point in time. 2037a32795SAndy Isaacson 21e53eeac9SGao MingfeiThe stat file consists of a single line of text containing 17 decimal 2237a32795SAndy Isaacsonvalues separated by whitespace. The fields are summarized in the 2337a32795SAndy Isaacsonfollowing table, and described in more detail below. 2437a32795SAndy Isaacson 25898bd37aSMauro Carvalho Chehab 26898bd37aSMauro Carvalho Chehab=============== ============= ================================================= 2737a32795SAndy IsaacsonName units description 28898bd37aSMauro Carvalho Chehab=============== ============= ================================================= 2937a32795SAndy Isaacsonread I/Os requests number of read I/Os processed 3037a32795SAndy Isaacsonread merges requests number of read I/Os merged with in-queue I/O 3137a32795SAndy Isaacsonread sectors sectors number of sectors read 3237a32795SAndy Isaacsonread ticks milliseconds total wait time for read requests 3337a32795SAndy Isaacsonwrite I/Os requests number of write I/Os processed 3437a32795SAndy Isaacsonwrite merges requests number of write I/Os merged with in-queue I/O 3537a32795SAndy Isaacsonwrite sectors sectors number of sectors written 3637a32795SAndy Isaacsonwrite ticks milliseconds total wait time for write requests 3737a32795SAndy Isaacsonin_flight requests number of I/Os currently in flight 3837a32795SAndy Isaacsonio_ticks milliseconds total time this block device has been active 3937a32795SAndy Isaacsontime_in_queue milliseconds total wait time for all requests 40bdca3c87SMichael Callahandiscard I/Os requests number of discard I/Os processed 41bdca3c87SMichael Callahandiscard merges requests number of discard I/Os merged with in-queue I/O 42bdca3c87SMichael Callahandiscard sectors sectors number of sectors discarded 43bdca3c87SMichael Callahandiscard ticks milliseconds total wait time for discard requests 44b6866318SKonstantin Khlebnikovflush I/Os requests number of flush I/Os processed 45b6866318SKonstantin Khlebnikovflush ticks milliseconds total wait time for flush requests 46898bd37aSMauro Carvalho Chehab=============== ============= ================================================= 4737a32795SAndy Isaacson 48bdca3c87SMichael Callahanread I/Os, write I/Os, discard I/0s 49bdca3c87SMichael Callahan=================================== 5037a32795SAndy Isaacson 5137a32795SAndy IsaacsonThese values increment when an I/O request completes. 5237a32795SAndy Isaacson 53b6866318SKonstantin Khlebnikovflush I/Os 54b6866318SKonstantin Khlebnikov========== 55b6866318SKonstantin Khlebnikov 56b6866318SKonstantin KhlebnikovThese values increment when an flush I/O request completes. 57b6866318SKonstantin Khlebnikov 58b6866318SKonstantin KhlebnikovBlock layer combines flush requests and executes at most one at a time. 59b6866318SKonstantin KhlebnikovThis counts flush requests executed by disk. Not tracked for partitions. 60b6866318SKonstantin Khlebnikov 61bdca3c87SMichael Callahanread merges, write merges, discard merges 62bdca3c87SMichael Callahan========================================= 6337a32795SAndy Isaacson 6437a32795SAndy IsaacsonThese values increment when an I/O request is merged with an 6537a32795SAndy Isaacsonalready-queued I/O request. 6637a32795SAndy Isaacson 67bdca3c87SMichael Callahanread sectors, write sectors, discard_sectors 68bdca3c87SMichael Callahan============================================ 6937a32795SAndy Isaacson 70bdca3c87SMichael CallahanThese values count the number of sectors read from, written to, or 71bdca3c87SMichael Callahandiscarded from this block device. The "sectors" in question are the 72bdca3c87SMichael Callahanstandard UNIX 512-byte sectors, not any device- or filesystem-specific 73bdca3c87SMichael Callahanblock size. The counters are incremented when the I/O completes. 7437a32795SAndy Isaacson 75b6866318SKonstantin Khlebnikovread ticks, write ticks, discard ticks, flush ticks 76b6866318SKonstantin Khlebnikov=================================================== 7737a32795SAndy Isaacson 7837a32795SAndy IsaacsonThese values count the number of milliseconds that I/O requests have 7937a32795SAndy Isaacsonwaited on this block device. If there are multiple I/O requests waiting, 8037a32795SAndy Isaacsonthese values will increase at a rate greater than 1000/second; for 8137a32795SAndy Isaacsonexample, if 60 read requests wait for an average of 30 ms, the read_ticks 8237a32795SAndy Isaacsonfield will increase by 60*30 = 1800. 8337a32795SAndy Isaacson 8437a32795SAndy Isaacsonin_flight 8537a32795SAndy Isaacson========= 8637a32795SAndy Isaacson 8737a32795SAndy IsaacsonThis value counts the number of I/O requests that have been issued to 8837a32795SAndy Isaacsonthe device driver but have not yet completed. It does not include I/O 8937a32795SAndy Isaacsonrequests that are in the queue but not yet issued to the device driver. 9037a32795SAndy Isaacson 9137a32795SAndy Isaacsonio_ticks 9237a32795SAndy Isaacson======== 9337a32795SAndy Isaacson 9437a32795SAndy IsaacsonThis value counts the number of milliseconds during which the device has 9537a32795SAndy Isaacsonhad I/O requests queued. 9637a32795SAndy Isaacson 9737a32795SAndy Isaacsontime_in_queue 9837a32795SAndy Isaacson============= 9937a32795SAndy Isaacson 10037a32795SAndy IsaacsonThis value counts the number of milliseconds that I/O requests have waited 10137a32795SAndy Isaacsonon this block device. If there are multiple I/O requests waiting, this 10237a32795SAndy Isaacsonvalue will increase as the product of the number of milliseconds times the 10337a32795SAndy Isaacsonnumber of requests waiting (see "read ticks" above for an example). 104