diff options
Diffstat (limited to 'include/linux/task_io_accounting_ops.h')
-rw-r--r-- | include/linux/task_io_accounting_ops.h | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h index ff46c6fad79d..4d090f9ee608 100644 --- a/include/linux/task_io_accounting_ops.h +++ b/include/linux/task_io_accounting_ops.h | |||
@@ -40,9 +40,17 @@ static inline void task_io_account_cancelled_write(size_t bytes) | |||
40 | current->ioac.cancelled_write_bytes += bytes; | 40 | current->ioac.cancelled_write_bytes += bytes; |
41 | } | 41 | } |
42 | 42 | ||
43 | static inline void task_io_accounting_init(struct task_struct *tsk) | 43 | static inline void task_io_accounting_init(struct task_io_accounting *ioac) |
44 | { | 44 | { |
45 | memset(&tsk->ioac, 0, sizeof(tsk->ioac)); | 45 | memset(ioac, 0, sizeof(*ioac)); |
46 | } | ||
47 | |||
48 | static inline void task_blk_io_accounting_add(struct task_io_accounting *dst, | ||
49 | struct task_io_accounting *src) | ||
50 | { | ||
51 | dst->read_bytes += src->read_bytes; | ||
52 | dst->write_bytes += src->write_bytes; | ||
53 | dst->cancelled_write_bytes += src->cancelled_write_bytes; | ||
46 | } | 54 | } |
47 | 55 | ||
48 | #else | 56 | #else |
@@ -69,9 +77,37 @@ static inline void task_io_account_cancelled_write(size_t bytes) | |||
69 | { | 77 | { |
70 | } | 78 | } |
71 | 79 | ||
72 | static inline void task_io_accounting_init(struct task_struct *tsk) | 80 | static inline void task_io_accounting_init(struct task_io_accounting *ioac) |
81 | { | ||
82 | } | ||
83 | |||
84 | static inline void task_blk_io_accounting_add(struct task_io_accounting *dst, | ||
85 | struct task_io_accounting *src) | ||
73 | { | 86 | { |
74 | } | 87 | } |
75 | 88 | ||
76 | #endif /* CONFIG_TASK_IO_ACCOUNTING */ | 89 | #endif /* CONFIG_TASK_IO_ACCOUNTING */ |
77 | #endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */ | 90 | |
91 | #ifdef CONFIG_TASK_XACCT | ||
92 | static inline void task_chr_io_accounting_add(struct task_io_accounting *dst, | ||
93 | struct task_io_accounting *src) | ||
94 | { | ||
95 | dst->rchar += src->rchar; | ||
96 | dst->wchar += src->wchar; | ||
97 | dst->syscr += src->syscr; | ||
98 | dst->syscw += src->syscw; | ||
99 | } | ||
100 | #else | ||
101 | static inline void task_chr_io_accounting_add(struct task_io_accounting *dst, | ||
102 | struct task_io_accounting *src) | ||
103 | { | ||
104 | } | ||
105 | #endif /* CONFIG_TASK_XACCT */ | ||
106 | |||
107 | static inline void task_io_accounting_add(struct task_io_accounting *dst, | ||
108 | struct task_io_accounting *src) | ||
109 | { | ||
110 | task_chr_io_accounting_add(dst, src); | ||
111 | task_blk_io_accounting_add(dst, src); | ||
112 | } | ||
113 | #endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */ | ||