diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | include/linux/task_io_accounting_ops.h | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 17b72d88c4cb..75f44379b7e9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -469,6 +469,7 @@ struct signal_struct { | |||
469 | cputime_t utime, stime, cutime, cstime; | 469 | cputime_t utime, stime, cutime, cstime; |
470 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; | 470 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; |
471 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; | 471 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; |
472 | unsigned long inblock, oublock, cinblock, coublock; | ||
472 | 473 | ||
473 | /* | 474 | /* |
474 | * Cumulative ns of scheduled CPU time for dead threads in the | 475 | * Cumulative ns of scheduled CPU time for dead threads in the |
diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h index df2a319106b2..1218733ec6b5 100644 --- a/include/linux/task_io_accounting_ops.h +++ b/include/linux/task_io_accounting_ops.h | |||
@@ -10,11 +10,29 @@ static inline void task_io_account_read(size_t bytes) | |||
10 | current->ioac.read_bytes += bytes; | 10 | current->ioac.read_bytes += bytes; |
11 | } | 11 | } |
12 | 12 | ||
13 | /* | ||
14 | * We approximate number of blocks, because we account bytes only. | ||
15 | * A 'block' is 512 bytes | ||
16 | */ | ||
17 | static inline unsigned long task_io_get_inblock(const struct task_struct *p) | ||
18 | { | ||
19 | return p->ioac.read_bytes >> 9; | ||
20 | } | ||
21 | |||
13 | static inline void task_io_account_write(size_t bytes) | 22 | static inline void task_io_account_write(size_t bytes) |
14 | { | 23 | { |
15 | current->ioac.write_bytes += bytes; | 24 | current->ioac.write_bytes += bytes; |
16 | } | 25 | } |
17 | 26 | ||
27 | /* | ||
28 | * We approximate number of blocks, because we account bytes only. | ||
29 | * A 'block' is 512 bytes | ||
30 | */ | ||
31 | static inline unsigned long task_io_get_oublock(const struct task_struct *p) | ||
32 | { | ||
33 | return p->ioac.write_bytes >> 9; | ||
34 | } | ||
35 | |||
18 | static inline void task_io_account_cancelled_write(size_t bytes) | 36 | static inline void task_io_account_cancelled_write(size_t bytes) |
19 | { | 37 | { |
20 | current->ioac.cancelled_write_bytes += bytes; | 38 | current->ioac.cancelled_write_bytes += bytes; |
@@ -31,10 +49,20 @@ static inline void task_io_account_read(size_t bytes) | |||
31 | { | 49 | { |
32 | } | 50 | } |
33 | 51 | ||
52 | static inline unsigned long task_io_get_inblock(const struct task_struct *p) | ||
53 | { | ||
54 | return 0; | ||
55 | } | ||
56 | |||
34 | static inline void task_io_account_write(size_t bytes) | 57 | static inline void task_io_account_write(size_t bytes) |
35 | { | 58 | { |
36 | } | 59 | } |
37 | 60 | ||
61 | static inline unsigned long task_io_get_oublock(const struct task_struct *p) | ||
62 | { | ||
63 | return 0; | ||
64 | } | ||
65 | |||
38 | static inline void task_io_account_cancelled_write(size_t bytes) | 66 | static inline void task_io_account_cancelled_write(size_t bytes) |
39 | { | 67 | { |
40 | } | 68 | } |