2 * Task I/O accounting operations
4 #ifndef __TASK_IO_ACCOUNTING_OPS_INCLUDED
5 #define __TASK_IO_ACCOUNTING_OPS_INCLUDED
7 #ifdef CONFIG_TASK_IO_ACCOUNTING
8 static inline void task_io_account_read(size_t bytes)
10 current->ioac.read_bytes += bytes;
14 * We approximate number of blocks, because we account bytes only.
15 * A 'block' is 512 bytes
17 static inline unsigned long task_io_get_inblock(const struct task_struct *p)
19 return p->ioac.read_bytes >> 9;
22 static inline void task_io_account_write(size_t bytes)
24 current->ioac.write_bytes += bytes;
28 * We approximate number of blocks, because we account bytes only.
29 * A 'block' is 512 bytes
31 static inline unsigned long task_io_get_oublock(const struct task_struct *p)
33 return p->ioac.write_bytes >> 9;
36 static inline void task_io_account_cancelled_write(size_t bytes)
38 current->ioac.cancelled_write_bytes += bytes;
41 static inline void task_io_accounting_init(struct task_struct *tsk)
43 memset(&tsk->ioac, 0, sizeof(tsk->ioac));
48 static inline void task_io_account_read(size_t bytes)
52 static inline unsigned long task_io_get_inblock(const struct task_struct *p)
57 static inline void task_io_account_write(size_t bytes)
61 static inline unsigned long task_io_get_oublock(const struct task_struct *p)
66 static inline void task_io_account_cancelled_write(size_t bytes)
70 static inline void task_io_accounting_init(struct task_struct *tsk)
74 #endif /* CONFIG_TASK_IO_ACCOUNTING */
75 #endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */