1898bd37aSMauro Carvalho Chehab=============================================== 2898bd37aSMauro Carvalho ChehabBlock layer statistics in /sys/block/<dev>/stat 3898bd37aSMauro Carvalho Chehab=============================================== 4898bd37aSMauro Carvalho Chehab 5898bd37aSMauro Carvalho ChehabThis file documents the contents of the /sys/block/<dev>/stat file. 6898bd37aSMauro Carvalho Chehab 7898bd37aSMauro Carvalho ChehabThe stat file provides several statistics about the state of block 8898bd37aSMauro Carvalho Chehabdevice <dev>. 9898bd37aSMauro Carvalho Chehab 10898bd37aSMauro Carvalho ChehabQ. 11898bd37aSMauro Carvalho Chehab Why are there multiple statistics in a single file? Doesn't sysfs 12898bd37aSMauro Carvalho Chehab 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 16898bd37aSMauro Carvalho Chehab represent a consistent snapshot of the state of the device. If the 17898bd37aSMauro Carvalho Chehab statistics were exported as multiple files containing one statistic 18898bd37aSMauro Carvalho Chehab each, it would be impossible to guarantee that a set of readings 19898bd37aSMauro Carvalho Chehab represent a single point in time. 20898bd37aSMauro Carvalho Chehab 21*e53eeac9SGao MingfeiThe stat file consists of a single line of text containing 17 decimal 22898bd37aSMauro Carvalho Chehabvalues separated by whitespace. The fields are summarized in the 23898bd37aSMauro Carvalho Chehabfollowing table, and described in more detail below. 24898bd37aSMauro Carvalho Chehab 25898bd37aSMauro Carvalho Chehab 26898bd37aSMauro Carvalho Chehab=============== ============= ================================================= 27898bd37aSMauro Carvalho ChehabName units description 28898bd37aSMauro Carvalho Chehab=============== ============= ================================================= 29898bd37aSMauro Carvalho Chehabread I/Os requests number of read I/Os processed 30898bd37aSMauro Carvalho Chehabread merges requests number of read I/Os merged with in-queue I/O 31898bd37aSMauro Carvalho Chehabread sectors sectors number of sectors read 32898bd37aSMauro Carvalho Chehabread ticks milliseconds total wait time for read requests 33898bd37aSMauro Carvalho Chehabwrite I/Os requests number of write I/Os processed 34898bd37aSMauro Carvalho Chehabwrite merges requests number of write I/Os merged with in-queue I/O 35898bd37aSMauro Carvalho Chehabwrite sectors sectors number of sectors written 36898bd37aSMauro Carvalho Chehabwrite ticks milliseconds total wait time for write requests 37898bd37aSMauro Carvalho Chehabin_flight requests number of I/Os currently in flight 38898bd37aSMauro Carvalho Chehabio_ticks milliseconds total time this block device has been active 39898bd37aSMauro Carvalho Chehabtime_in_queue milliseconds total wait time for all requests 40898bd37aSMauro Carvalho Chehabdiscard I/Os requests number of discard I/Os processed 41898bd37aSMauro Carvalho Chehabdiscard merges requests number of discard I/Os merged with in-queue I/O 42898bd37aSMauro Carvalho Chehabdiscard sectors sectors number of sectors discarded 43898bd37aSMauro Carvalho Chehabdiscard 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=============== ============= ================================================= 47898bd37aSMauro Carvalho Chehab 48898bd37aSMauro Carvalho Chehabread I/Os, write I/Os, discard I/0s 49898bd37aSMauro Carvalho Chehab=================================== 50898bd37aSMauro Carvalho Chehab 51898bd37aSMauro Carvalho ChehabThese values increment when an I/O request completes. 52898bd37aSMauro Carvalho Chehab 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 61898bd37aSMauro Carvalho Chehabread merges, write merges, discard merges 62898bd37aSMauro Carvalho Chehab========================================= 63898bd37aSMauro Carvalho Chehab 64898bd37aSMauro Carvalho ChehabThese values increment when an I/O request is merged with an 65898bd37aSMauro Carvalho Chehabalready-queued I/O request. 66898bd37aSMauro Carvalho Chehab 67898bd37aSMauro Carvalho Chehabread sectors, write sectors, discard_sectors 68898bd37aSMauro Carvalho Chehab============================================ 69898bd37aSMauro Carvalho Chehab 70898bd37aSMauro Carvalho ChehabThese values count the number of sectors read from, written to, or 71898bd37aSMauro Carvalho Chehabdiscarded from this block device. The "sectors" in question are the 72898bd37aSMauro Carvalho Chehabstandard UNIX 512-byte sectors, not any device- or filesystem-specific 73898bd37aSMauro Carvalho Chehabblock size. The counters are incremented when the I/O completes. 74898bd37aSMauro Carvalho Chehab 75b6866318SKonstantin Khlebnikovread ticks, write ticks, discard ticks, flush ticks 76b6866318SKonstantin Khlebnikov=================================================== 77898bd37aSMauro Carvalho Chehab 78898bd37aSMauro Carvalho ChehabThese values count the number of milliseconds that I/O requests have 79898bd37aSMauro Carvalho Chehabwaited on this block device. If there are multiple I/O requests waiting, 80898bd37aSMauro Carvalho Chehabthese values will increase at a rate greater than 1000/second; for 81898bd37aSMauro Carvalho Chehabexample, if 60 read requests wait for an average of 30 ms, the read_ticks 82898bd37aSMauro Carvalho Chehabfield will increase by 60*30 = 1800. 83898bd37aSMauro Carvalho Chehab 84898bd37aSMauro Carvalho Chehabin_flight 85898bd37aSMauro Carvalho Chehab========= 86898bd37aSMauro Carvalho Chehab 87898bd37aSMauro Carvalho ChehabThis value counts the number of I/O requests that have been issued to 88898bd37aSMauro Carvalho Chehabthe device driver but have not yet completed. It does not include I/O 89898bd37aSMauro Carvalho Chehabrequests that are in the queue but not yet issued to the device driver. 90898bd37aSMauro Carvalho Chehab 91898bd37aSMauro Carvalho Chehabio_ticks 92898bd37aSMauro Carvalho Chehab======== 93898bd37aSMauro Carvalho Chehab 94898bd37aSMauro Carvalho ChehabThis value counts the number of milliseconds during which the device has 95898bd37aSMauro Carvalho Chehabhad I/O requests queued. 96898bd37aSMauro Carvalho Chehab 97898bd37aSMauro Carvalho Chehabtime_in_queue 98898bd37aSMauro Carvalho Chehab============= 99898bd37aSMauro Carvalho Chehab 100898bd37aSMauro Carvalho ChehabThis value counts the number of milliseconds that I/O requests have waited 101898bd37aSMauro Carvalho Chehabon this block device. If there are multiple I/O requests waiting, this 102898bd37aSMauro Carvalho Chehabvalue will increase as the product of the number of milliseconds times the 103898bd37aSMauro Carvalho Chehabnumber of requests waiting (see "read ticks" above for an example). 104