^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ===============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Block layer statistics in /sys/block/<dev>/stat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ===============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) This file documents the contents of the /sys/block/<dev>/stat file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) The stat file provides several statistics about the state of block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) device <dev>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Q.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) Why are there multiple statistics in a single file? Doesn't sysfs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) normally contain a single value per file?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) A.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) By having a single file, the kernel can guarantee that the statistics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) represent a consistent snapshot of the state of the device. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) statistics were exported as multiple files containing one statistic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) each, it would be impossible to guarantee that a set of readings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) represent a single point in time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) The stat file consists of a single line of text containing 11 decimal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) values separated by whitespace. The fields are summarized in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) following table, and described in more detail below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) =============== ============= =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) Name units description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) =============== ============= =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) read I/Os requests number of read I/Os processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) read merges requests number of read I/Os merged with in-queue I/O
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) read sectors sectors number of sectors read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) read ticks milliseconds total wait time for read requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) write I/Os requests number of write I/Os processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) write merges requests number of write I/Os merged with in-queue I/O
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) write sectors sectors number of sectors written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) write ticks milliseconds total wait time for write requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) in_flight requests number of I/Os currently in flight
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) io_ticks milliseconds total time this block device has been active
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) time_in_queue milliseconds total wait time for all requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) discard I/Os requests number of discard I/Os processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) discard merges requests number of discard I/Os merged with in-queue I/O
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) discard sectors sectors number of sectors discarded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) discard ticks milliseconds total wait time for discard requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) flush I/Os requests number of flush I/Os processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) flush ticks milliseconds total wait time for flush requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) =============== ============= =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) read I/Os, write I/Os, discard I/0s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) ===================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) These values increment when an I/O request completes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) flush I/Os
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) These values increment when an flush I/O request completes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) Block layer combines flush requests and executes at most one at a time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) This counts flush requests executed by disk. Not tracked for partitions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) read merges, write merges, discard merges
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) =========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) These values increment when an I/O request is merged with an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) already-queued I/O request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) read sectors, write sectors, discard_sectors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) ============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) These values count the number of sectors read from, written to, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) discarded from this block device. The "sectors" in question are the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) standard UNIX 512-byte sectors, not any device- or filesystem-specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) block size. The counters are incremented when the I/O completes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) read ticks, write ticks, discard ticks, flush ticks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) ===================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) These values count the number of milliseconds that I/O requests have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) waited on this block device. If there are multiple I/O requests waiting,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) these values will increase at a rate greater than 1000/second; for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) example, if 60 read requests wait for an average of 30 ms, the read_ticks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) field will increase by 60*30 = 1800.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) in_flight
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) This value counts the number of I/O requests that have been issued to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) the device driver but have not yet completed. It does not include I/O
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) requests that are in the queue but not yet issued to the device driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) io_ticks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) This value counts the number of milliseconds during which the device has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) had I/O requests queued.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) time_in_queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) =============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) This value counts the number of milliseconds that I/O requests have waited
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) on this block device. If there are multiple I/O requests waiting, this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) value will increase as the product of the number of milliseconds times the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) number of requests waiting (see "read ticks" above for an example).