]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/proc/base.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[linux-2.6-omap-h63xx.git] / fs / proc / base.c
index d82d800389f6018039abefa9668e7f7ad4f90c17..e74308bdabd3dc9d5b317dbf8eeadb4dc4f8ceab 100644 (file)
@@ -2405,35 +2405,18 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
        u64 rchar, wchar, syscr, syscw;
        struct task_io_accounting ioac;
 
-       if (!whole) {
-               rchar = task->rchar;
-               wchar = task->wchar;
-               syscr = task->syscr;
-               syscw = task->syscw;
-               memcpy(&ioac, &task->ioac, sizeof(ioac));
-       } else {
-               unsigned long flags;
-               struct task_struct *t = task;
-               rchar = wchar = syscr = syscw = 0;
-               memset(&ioac, 0, sizeof(ioac));
+       rchar = task->rchar;
+       wchar = task->wchar;
+       syscr = task->syscr;
+       syscw = task->syscw;
+       memcpy(&ioac, &task->ioac, sizeof(ioac));
 
-               rcu_read_lock();
-               do {
-                       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;
-                       t = next_thread(t);
-               } while (t != task);
-               rcu_read_unlock();
+       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;
@@ -2444,11 +2427,20 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
                        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);
                }
        }
-
        return sprintf(buffer,
                        "rchar: %llu\n"
                        "wchar: %llu\n"
@@ -2457,13 +2449,9 @@ 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",
-                       (unsigned long long)rchar,
-                       (unsigned long long)wchar,
-                       (unsigned long long)syscr,
-                       (unsigned long long)syscw,
-                       (unsigned long long)ioac.read_bytes,
-                       (unsigned long long)ioac.write_bytes,
-                       (unsigned long long)ioac.cancelled_write_bytes);
+                       rchar, wchar, syscr, syscw,
+                       ioac.read_bytes, ioac.write_bytes,
+                       ioac.cancelled_write_bytes);
 }
 
 static int proc_tid_io_accounting(struct task_struct *task, char *buffer)