diff options
author | Seymour, Shane M <shane.seymour@hp.com> | 2015-05-05 21:37:20 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-06-02 11:03:25 -0400 |
commit | 05545c92db9637318a98d3d59d400beb819decc7 (patch) | |
tree | 56c911568dd7dd6507aac24f7c8c90b657f7bda0 /Documentation/scsi/st.txt | |
parent | ba929992522b6d1f866b7021bc50da66f8fdd743 (diff) |
st: implement tape statistics
This patch implements tape statistics in the st module via
sysfs. Current no statistics are available for tape I/O and there
is no easy way to reuse the block layer statistics for tape
as tape is a character device and does not have perform I/O in
sector sized chunks (the size of the data written to tape
can change). For tapes we also need extra stats related to
things like tape movement (via other I/O).
There have been multiple end users requesting statistics
including AT&T (and some HP customers who have not given
permission to be named). It is impossible for them
to investigate any issues related to tape performance
in a non-invasive way.
[jejb: eliminate PRId64]
Signed-off-by: Shane Seymour <shane.seymour@hp.com>
Tested-by: Shane Seymour <shane.seymour@hp.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'Documentation/scsi/st.txt')
-rw-r--r-- | Documentation/scsi/st.txt | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/Documentation/scsi/st.txt b/Documentation/scsi/st.txt index 0d5bdb153d3b..f29fa550665a 100644 --- a/Documentation/scsi/st.txt +++ b/Documentation/scsi/st.txt | |||
@@ -151,6 +151,65 @@ A link named 'tape' is made from the SCSI device directory to the class | |||
151 | directory corresponding to the mode 0 auto-rewind device (e.g., st0). | 151 | directory corresponding to the mode 0 auto-rewind device (e.g., st0). |
152 | 152 | ||
153 | 153 | ||
154 | SYSFS AND STATISTICS FOR TAPE DEVICES | ||
155 | |||
156 | The st driver maintains statistics for tape drives inside the sysfs filesystem. | ||
157 | The following method can be used to locate the statistics that are | ||
158 | available (assuming that sysfs is mounted at /sys): | ||
159 | |||
160 | 1. Use opendir(3) on the directory /sys/class/scsi_tape | ||
161 | 2. Use readdir(3) to read the directory contents | ||
162 | 3. Use regcomp(3)/regexec(3) to match directory entries to the extended | ||
163 | regular expression "^st[0-9]+$" | ||
164 | 4. Access the statistics from the /sys/class/scsi_tape/<match>/stats | ||
165 | directory (where <match> is a directory entry from /sys/class/scsi_tape | ||
166 | that matched the extended regular expression) | ||
167 | |||
168 | The reason for using this approach is that all the character devices | ||
169 | pointing to the same tape drive use the same statistics. That means | ||
170 | that st0 would have the same statistics as nst0. | ||
171 | |||
172 | The directory contains the following statistics files: | ||
173 | |||
174 | 1. in_flight - The number of I/Os currently outstanding to this device. | ||
175 | 2. io_ns - The amount of time spent waiting (in nanoseconds) for all I/O | ||
176 | to complete (including read and write). This includes tape movement | ||
177 | commands such as seeking between file or set marks and implicit tape | ||
178 | movement such as when rewind on close tape devices are used. | ||
179 | 3. other_cnt - The number of I/Os issued to the tape drive other than read or | ||
180 | write commands. The time taken to complete these commands uses the | ||
181 | following calculation io_ms-read_ms-write_ms. | ||
182 | 4. read_byte_cnt - The number of bytes read from the tape drive. | ||
183 | 5. read_cnt - The number of read requests issued to the tape drive. | ||
184 | 6. read_ns - The amount of time (in nanoseconds) spent waiting for read | ||
185 | requests to complete. | ||
186 | 7. write_byte_cnt - The number of bytes written to the tape drive. | ||
187 | 8. write_cnt - The number of write requests issued to the tape drive. | ||
188 | 9. write_ns - The amount of time (in nanoseconds) spent waiting for write | ||
189 | requests to complete. | ||
190 | 10. resid_cnt - The number of times during a read or write we found | ||
191 | the residual amount to be non-zero. This should mean that a program | ||
192 | is issuing a read larger thean the block size on tape. For write | ||
193 | not all data made it to tape. | ||
194 | |||
195 | Note: The in_flight value is incremented when an I/O starts the I/O | ||
196 | itself is not added to the statistics until it completes. | ||
197 | |||
198 | The total of read_cnt, write_cnt, and other_cnt may not total to the same | ||
199 | value as iodone_cnt at the device level. The tape statistics only count | ||
200 | I/O issued via the st module. | ||
201 | |||
202 | When read the statistics may not be temporally consistent while I/O is in | ||
203 | progress. The individual values are read and written to atomically however | ||
204 | when reading them back via sysfs they may be in the process of being | ||
205 | updated when starting an I/O or when it is completed. | ||
206 | |||
207 | The value shown in in_flight is incremented before any statstics are | ||
208 | updated and decremented when an I/O completes after updating statistics. | ||
209 | The value of in_flight is 0 when there are no I/Os outstanding that are | ||
210 | issued by the st driver. Tape statistics do not take into account any | ||
211 | I/O performed via the sg device. | ||
212 | |||
154 | BSD AND SYS V SEMANTICS | 213 | BSD AND SYS V SEMANTICS |
155 | 214 | ||
156 | The user can choose between these two behaviours of the tape driver by | 215 | The user can choose between these two behaviours of the tape driver by |