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