]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/proc/base.c
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
[linux-2.6-omap-h63xx.git] / fs / proc / base.c
index e74308bdabd3dc9d5b317dbf8eeadb4dc4f8ceab..a28840b11b89b5ca0b544f44ce58182544f51eef 100644 (file)
@@ -53,6 +53,7 @@
 #include <linux/time.h>
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
+#include <linux/task_io_accounting_ops.h>
 #include <linux/init.h>
 #include <linux/capability.h>
 #include <linux/file.h>
@@ -2402,44 +2403,17 @@ static int proc_base_fill_cache(struct file *filp, void *dirent,
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
 {
-       u64 rchar, wchar, syscr, syscw;
-       struct task_io_accounting ioac;
-
-       rchar = task->rchar;
-       wchar = task->wchar;
-       syscr = task->syscr;
-       syscw = task->syscw;
-       memcpy(&ioac, &task->ioac, sizeof(ioac));
-
-       if (whole) {
-               unsigned long flags;
-
-               if (lock_task_sighand(task, &flags)) {
-                       struct signal_struct *sig = task->signal;
-                       struct task_struct *t = task;
-
-                       rchar += sig->rchar;
-                       wchar += sig->wchar;
-                       syscr += sig->syscr;
-                       syscw += sig->syscw;
-
-                       ioac.read_bytes += sig->ioac.read_bytes;
-                       ioac.write_bytes += sig->ioac.write_bytes;
-                       ioac.cancelled_write_bytes +=
-                                       sig->ioac.cancelled_write_bytes;
-                       while_each_thread(task, t) {
-                               rchar += t->rchar;
-                               wchar += t->wchar;
-                               syscr += t->syscr;
-                               syscw += t->syscw;
-
-                               ioac.read_bytes += t->ioac.read_bytes;
-                               ioac.write_bytes += t->ioac.write_bytes;
-                               ioac.cancelled_write_bytes +=
-                                       t->ioac.cancelled_write_bytes;
-                       }
-                       unlock_task_sighand(task, &flags);
-               }
+       struct task_io_accounting acct = task->ioac;
+       unsigned long flags;
+
+       if (whole && lock_task_sighand(task, &flags)) {
+               struct task_struct *t = task;
+
+               task_io_accounting_add(&acct, &task->signal->ioac);
+               while_each_thread(task, t)
+                       task_io_accounting_add(&acct, &t->ioac);
+
+               unlock_task_sighand(task, &flags);
        }
        return sprintf(buffer,
                        "rchar: %llu\n"
@@ -2449,9 +2423,13 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
                        "read_bytes: %llu\n"
                        "write_bytes: %llu\n"
                        "cancelled_write_bytes: %llu\n",
-                       rchar, wchar, syscr, syscw,
-                       ioac.read_bytes, ioac.write_bytes,
-                       ioac.cancelled_write_bytes);
+                       (unsigned long long)acct.rchar,
+                       (unsigned long long)acct.wchar,
+                       (unsigned long long)acct.syscr,
+                       (unsigned long long)acct.syscw,
+                       (unsigned long long)acct.read_bytes,
+                       (unsigned long long)acct.write_bytes,
+                       (unsigned long long)acct.cancelled_write_bytes);
 }
 
 static int proc_tid_io_accounting(struct task_struct *task, char *buffer)