task IO accounting: move all IO statistics in struct task_io_accounting
Simplify the code of include/linux/task_io_accounting.h.
It is also more reasonable to have all the task i/o-related statistics in a
single struct (task_io_accounting).
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h
index e6f958e..4d090f9 100644
--- a/include/linux/task_io_accounting_ops.h
+++ b/include/linux/task_io_accounting_ops.h
@@ -9,7 +9,7 @@
#ifdef CONFIG_TASK_IO_ACCOUNTING
static inline void task_io_account_read(size_t bytes)
{
- current->ioac.blk.read_bytes += bytes;
+ current->ioac.read_bytes += bytes;
}
/*
@@ -18,12 +18,12 @@
*/
static inline unsigned long task_io_get_inblock(const struct task_struct *p)
{
- return p->ioac.blk.read_bytes >> 9;
+ return p->ioac.read_bytes >> 9;
}
static inline void task_io_account_write(size_t bytes)
{
- current->ioac.blk.write_bytes += bytes;
+ current->ioac.write_bytes += bytes;
}
/*
@@ -32,25 +32,25 @@
*/
static inline unsigned long task_io_get_oublock(const struct task_struct *p)
{
- return p->ioac.blk.write_bytes >> 9;
+ return p->ioac.write_bytes >> 9;
}
static inline void task_io_account_cancelled_write(size_t bytes)
{
- current->ioac.blk.cancelled_write_bytes += bytes;
+ current->ioac.cancelled_write_bytes += bytes;
}
-static inline void task_io_accounting_init(struct proc_io_accounting *ioac)
+static inline void task_io_accounting_init(struct task_io_accounting *ioac)
{
memset(ioac, 0, sizeof(*ioac));
}
-static inline void task_blk_io_accounting_add(struct proc_io_accounting *dst,
- struct proc_io_accounting *src)
+static inline void task_blk_io_accounting_add(struct task_io_accounting *dst,
+ struct task_io_accounting *src)
{
- dst->blk.read_bytes += src->blk.read_bytes;
- dst->blk.write_bytes += src->blk.write_bytes;
- dst->blk.cancelled_write_bytes += src->blk.cancelled_write_bytes;
+ dst->read_bytes += src->read_bytes;
+ dst->write_bytes += src->write_bytes;
+ dst->cancelled_write_bytes += src->cancelled_write_bytes;
}
#else
@@ -77,35 +77,35 @@
{
}
-static inline void task_io_accounting_init(struct proc_io_accounting *ioac)
+static inline void task_io_accounting_init(struct task_io_accounting *ioac)
{
}
-static inline void task_blk_io_accounting_add(struct proc_io_accounting *dst,
- struct proc_io_accounting *src)
+static inline void task_blk_io_accounting_add(struct task_io_accounting *dst,
+ struct task_io_accounting *src)
{
}
#endif /* CONFIG_TASK_IO_ACCOUNTING */
#ifdef CONFIG_TASK_XACCT
-static inline void task_chr_io_accounting_add(struct proc_io_accounting *dst,
- struct proc_io_accounting *src)
+static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
+ struct task_io_accounting *src)
{
- dst->chr.rchar += src->chr.rchar;
- dst->chr.wchar += src->chr.wchar;
- dst->chr.syscr += src->chr.syscr;
- dst->chr.syscw += src->chr.syscw;
+ dst->rchar += src->rchar;
+ dst->wchar += src->wchar;
+ dst->syscr += src->syscr;
+ dst->syscw += src->syscw;
}
#else
-static inline void task_chr_io_accounting_add(struct proc_io_accounting *dst,
- struct proc_io_accounting *src)
+static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
+ struct task_io_accounting *src)
{
}
#endif /* CONFIG_TASK_XACCT */
-static inline void task_io_accounting_add(struct proc_io_accounting *dst,
- struct proc_io_accounting *src)
+static inline void task_io_accounting_add(struct task_io_accounting *dst,
+ struct task_io_accounting *src)
{
task_chr_io_accounting_add(dst, src);
task_blk_io_accounting_add(dst, src);