blob: 2dd338fdf8815144554d61794ab823e8fbb9f388 [file] [log] [blame]
Andrew Morton7c3ab732006-12-10 02:19:19 -08001/*
Andrea Righi940389b2008-07-28 00:48:12 +02002 * task_io_accounting: a structure which is used for recording a single task's
Andrew Morton7c3ab732006-12-10 02:19:19 -08003 * IO statistics.
4 *
5 * Don't include this header file directly - it is designed to be dragged in via
6 * sched.h.
7 *
Francois Camie1f8e872008-10-15 22:01:59 -07008 * Blame Andrew Morton for all this.
Andrew Morton7c3ab732006-12-10 02:19:19 -08009 */
10
Andrea Righi940389b2008-07-28 00:48:12 +020011struct task_io_accounting {
Andrea Righi59954772008-07-27 17:29:15 +020012#ifdef CONFIG_TASK_XACCT
Andrea Righi59954772008-07-27 17:29:15 +020013 /* bytes read */
14 u64 rchar;
15 /* bytes written */
16 u64 wchar;
17 /* # of read syscalls */
18 u64 syscr;
19 /* # of write syscalls */
20 u64 syscw;
Jin Qiane61abd82017-03-02 13:32:59 -080021 /* # of fsync syscalls */
22 u64 syscfs;
Andrea Righi59954772008-07-27 17:29:15 +020023#endif /* CONFIG_TASK_XACCT */
24
Andrew Morton7c3ab732006-12-10 02:19:19 -080025#ifdef CONFIG_TASK_IO_ACCOUNTING
Andrew Morton7c3ab732006-12-10 02:19:19 -080026 /*
27 * The number of bytes which this task has caused to be read from
28 * storage.
29 */
30 u64 read_bytes;
31
32 /*
33 * The number of bytes which this task has caused, or shall cause to be
34 * written to disk.
35 */
36 u64 write_bytes;
37
38 /*
39 * A task can cause "negative" IO too. If this task truncates some
40 * dirty pagecache, some IO which another task has been accounted for
41 * (in its write_bytes) will not be happening. We _could_ just
42 * subtract that from the truncating task's write_bytes, but there is
43 * information loss in doing that.
44 */
45 u64 cancelled_write_bytes;
Andrea Righi59954772008-07-27 17:29:15 +020046#endif /* CONFIG_TASK_IO_ACCOUNTING */
Andrea Righi59954772008-07-27 17:29:15 +020047};