aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/task_io_accounting_ops.h
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-07-27 17:11:53 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-27 17:11:53 -0400
commiteb703027ac4ed563823e4d7824f68afed637d89a (patch)
treede35552440e7d2c7b74d0020c6a3cc1a8ed8b060 /include/linux/task_io_accounting_ops.h
parent429e90893c9ad2c266d541c94d6ca69a34a7701d (diff)
parent837b41b5de356aa67abb2cadb5eef3efc7776f91 (diff)
Merge ../linux-2.6
Diffstat (limited to 'include/linux/task_io_accounting_ops.h')
-rw-r--r--include/linux/task_io_accounting_ops.h56
1 files changed, 46 insertions, 10 deletions
diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h
index ff46c6fad79d..e6f958ebe97f 100644
--- a/include/linux/task_io_accounting_ops.h
+++ b/include/linux/task_io_accounting_ops.h
@@ -9,7 +9,7 @@
9#ifdef CONFIG_TASK_IO_ACCOUNTING 9#ifdef CONFIG_TASK_IO_ACCOUNTING
10static inline void task_io_account_read(size_t bytes) 10static inline void task_io_account_read(size_t bytes)
11{ 11{
12 current->ioac.read_bytes += bytes; 12 current->ioac.blk.read_bytes += bytes;
13} 13}
14 14
15/* 15/*
@@ -18,12 +18,12 @@ static inline void task_io_account_read(size_t bytes)
18 */ 18 */
19static inline unsigned long task_io_get_inblock(const struct task_struct *p) 19static inline unsigned long task_io_get_inblock(const struct task_struct *p)
20{ 20{
21 return p->ioac.read_bytes >> 9; 21 return p->ioac.blk.read_bytes >> 9;
22} 22}
23 23
24static inline void task_io_account_write(size_t bytes) 24static inline void task_io_account_write(size_t bytes)
25{ 25{
26 current->ioac.write_bytes += bytes; 26 current->ioac.blk.write_bytes += bytes;
27} 27}
28 28
29/* 29/*
@@ -32,17 +32,25 @@ static inline void task_io_account_write(size_t bytes)
32 */ 32 */
33static inline unsigned long task_io_get_oublock(const struct task_struct *p) 33static inline unsigned long task_io_get_oublock(const struct task_struct *p)
34{ 34{
35 return p->ioac.write_bytes >> 9; 35 return p->ioac.blk.write_bytes >> 9;
36} 36}
37 37
38static inline void task_io_account_cancelled_write(size_t bytes) 38static inline void task_io_account_cancelled_write(size_t bytes)
39{ 39{
40 current->ioac.cancelled_write_bytes += bytes; 40 current->ioac.blk.cancelled_write_bytes += bytes;
41} 41}
42 42
43static inline void task_io_accounting_init(struct task_struct *tsk) 43static inline void task_io_accounting_init(struct proc_io_accounting *ioac)
44{ 44{
45 memset(&tsk->ioac, 0, sizeof(tsk->ioac)); 45 memset(ioac, 0, sizeof(*ioac));
46}
47
48static inline void task_blk_io_accounting_add(struct proc_io_accounting *dst,
49 struct proc_io_accounting *src)
50{
51 dst->blk.read_bytes += src->blk.read_bytes;
52 dst->blk.write_bytes += src->blk.write_bytes;
53 dst->blk.cancelled_write_bytes += src->blk.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
72static inline void task_io_accounting_init(struct task_struct *tsk) 80static inline void task_io_accounting_init(struct proc_io_accounting *ioac)
81{
82}
83
84static inline void task_blk_io_accounting_add(struct proc_io_accounting *dst,
85 struct proc_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
92static inline void task_chr_io_accounting_add(struct proc_io_accounting *dst,
93 struct proc_io_accounting *src)
94{
95 dst->chr.rchar += src->chr.rchar;
96 dst->chr.wchar += src->chr.wchar;
97 dst->chr.syscr += src->chr.syscr;
98 dst->chr.syscw += src->chr.syscw;
99}
100#else
101static inline void task_chr_io_accounting_add(struct proc_io_accounting *dst,
102 struct proc_io_accounting *src)
103{
104}
105#endif /* CONFIG_TASK_XACCT */
106
107static inline void task_io_accounting_add(struct proc_io_accounting *dst,
108 struct proc_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 */