fix irq flags in rtc-ds1511
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / linux / task_io_accounting_ops.h
blobff46c6fad79da300afaa621a41abcfb1bf4c787f
1 /*
2 * Task I/O accounting operations
3 */
4 #ifndef __TASK_IO_ACCOUNTING_OPS_INCLUDED
5 #define __TASK_IO_ACCOUNTING_OPS_INCLUDED
7 #include <linux/sched.h>
9 #ifdef CONFIG_TASK_IO_ACCOUNTING
10 static inline void task_io_account_read(size_t bytes)
12 current->ioac.read_bytes += bytes;
16 * We approximate number of blocks, because we account bytes only.
17 * A 'block' is 512 bytes
19 static inline unsigned long task_io_get_inblock(const struct task_struct *p)
21 return p->ioac.read_bytes >> 9;
24 static inline void task_io_account_write(size_t bytes)
26 current->ioac.write_bytes += bytes;
30 * We approximate number of blocks, because we account bytes only.
31 * A 'block' is 512 bytes
33 static inline unsigned long task_io_get_oublock(const struct task_struct *p)
35 return p->ioac.write_bytes >> 9;
38 static inline void task_io_account_cancelled_write(size_t bytes)
40 current->ioac.cancelled_write_bytes += bytes;
43 static inline void task_io_accounting_init(struct task_struct *tsk)
45 memset(&tsk->ioac, 0, sizeof(tsk->ioac));
48 #else
50 static inline void task_io_account_read(size_t bytes)
54 static inline unsigned long task_io_get_inblock(const struct task_struct *p)
56 return 0;
59 static inline void task_io_account_write(size_t bytes)
63 static inline unsigned long task_io_get_oublock(const struct task_struct *p)
65 return 0;
68 static inline void task_io_account_cancelled_write(size_t bytes)
72 static inline void task_io_accounting_init(struct task_struct *tsk)
76 #endif /* CONFIG_TASK_IO_ACCOUNTING */
77 #endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */