blob: 6f6acce064dea535b0a4e6fe84d20a99a3c9a9dd [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Andrew Morton7c3ab732006-12-10 02:19:19 -08002/*
Andrea Righi940389b2008-07-28 00:48:12 +02003 * task_io_accounting: a structure which is used for recording a single task's
Andrew Morton7c3ab732006-12-10 02:19:19 -08004 * IO statistics.
5 *
6 * Don't include this header file directly - it is designed to be dragged in via
7 * sched.h.
8 *
Francois Camie1f8e872008-10-15 22:01:59 -07009 * Blame Andrew Morton for all this.
Andrew Morton7c3ab732006-12-10 02:19:19 -080010 */
11
Andrea Righi940389b2008-07-28 00:48:12 +020012struct task_io_accounting {
Andrea Righi59954772008-07-27 17:29:15 +020013#ifdef CONFIG_TASK_XACCT
Andrea Righi59954772008-07-27 17:29:15 +020014 /* bytes read */
15 u64 rchar;
16 /* bytes written */
17 u64 wchar;
18 /* # of read syscalls */
19 u64 syscr;
20 /* # of write syscalls */
21 u64 syscw;
Andrea Righi59954772008-07-27 17:29:15 +020022#endif /* CONFIG_TASK_XACCT */
23
Andrew Morton7c3ab732006-12-10 02:19:19 -080024#ifdef CONFIG_TASK_IO_ACCOUNTING
Andrew Morton7c3ab732006-12-10 02:19:19 -080025 /*
26 * The number of bytes which this task has caused to be read from
27 * storage.
28 */
29 u64 read_bytes;
30
31 /*
32 * The number of bytes which this task has caused, or shall cause to be
33 * written to disk.
34 */
35 u64 write_bytes;
36
37 /*
38 * A task can cause "negative" IO too. If this task truncates some
39 * dirty pagecache, some IO which another task has been accounted for
40 * (in its write_bytes) will not be happening. We _could_ just
41 * subtract that from the truncating task's write_bytes, but there is
42 * information loss in doing that.
43 */
44 u64 cancelled_write_bytes;
Andrea Righi59954772008-07-27 17:29:15 +020045#endif /* CONFIG_TASK_IO_ACCOUNTING */
Andrea Righi59954772008-07-27 17:29:15 +020046};