diff options
Diffstat (limited to 'include/linux/task_io_accounting_ops.h')
-rw-r--r-- | include/linux/task_io_accounting_ops.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h new file mode 100644 index 000000000000..df2a319106b2 --- /dev/null +++ b/include/linux/task_io_accounting_ops.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Task I/O accounting operations | ||
3 | */ | ||
4 | #ifndef __TASK_IO_ACCOUNTING_OPS_INCLUDED | ||
5 | #define __TASK_IO_ACCOUNTING_OPS_INCLUDED | ||
6 | |||
7 | #ifdef CONFIG_TASK_IO_ACCOUNTING | ||
8 | static inline void task_io_account_read(size_t bytes) | ||
9 | { | ||
10 | current->ioac.read_bytes += bytes; | ||
11 | } | ||
12 | |||
13 | static inline void task_io_account_write(size_t bytes) | ||
14 | { | ||
15 | current->ioac.write_bytes += bytes; | ||
16 | } | ||
17 | |||
18 | static inline void task_io_account_cancelled_write(size_t bytes) | ||
19 | { | ||
20 | current->ioac.cancelled_write_bytes += bytes; | ||
21 | } | ||
22 | |||
23 | static inline void task_io_accounting_init(struct task_struct *tsk) | ||
24 | { | ||
25 | memset(&tsk->ioac, 0, sizeof(tsk->ioac)); | ||
26 | } | ||
27 | |||
28 | #else | ||
29 | |||
30 | static inline void task_io_account_read(size_t bytes) | ||
31 | { | ||
32 | } | ||
33 | |||
34 | static inline void task_io_account_write(size_t bytes) | ||
35 | { | ||
36 | } | ||
37 | |||
38 | static inline void task_io_account_cancelled_write(size_t bytes) | ||
39 | { | ||
40 | } | ||
41 | |||
42 | static inline void task_io_accounting_init(struct task_struct *tsk) | ||
43 | { | ||
44 | } | ||
45 | |||
46 | #endif /* CONFIG_TASK_IO_ACCOUNTING */ | ||
47 | #endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */ | ||