summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2007-02-10 12:46:45 +0300
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 22:18:07 +0300
commit4b98d11b40f03382918796f3c5c936d5495d20a4 (patch)
tree616b7260196c9bd0eaf208ef8fab91fcf9efcece /fs
parent18f705f49a5b19206233f7cef8f869ce7291f8c8 (diff)
downloadlinux-4b98d11b40f03382918796f3c5c936d5495d20a4.tar.xz
[PATCH] ifdef ->rchar, ->wchar, ->syscr, ->syscw from task_struct
They are fat: 4x8 bytes in task_struct. They are uncoditionally updated in every fork, read, write and sendfile. They are used only if you have some "extended acct fields feature". And please, please, please, read(2) knows about bytes, not characters, why it is called "rchar"? Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Jay Lan <jlan@engr.sgi.com> Cc: Balbir Singh <balbir@in.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/base.c4
-rw-r--r--fs/read_write.c24
2 files changed, 16 insertions, 12 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 1a979ea3b379..7fb37d6f2864 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1810,17 +1810,21 @@ static int proc_base_fill_cache(struct file *filp, void *dirent, filldir_t filld
static int proc_pid_io_accounting(struct task_struct *task, char *buffer)
{
return sprintf(buffer,
+#ifdef CONFIG_TASK_XACCT
"rchar: %llu\n"
"wchar: %llu\n"
"syscr: %llu\n"
"syscw: %llu\n"
+#endif
"read_bytes: %llu\n"
"write_bytes: %llu\n"
"cancelled_write_bytes: %llu\n",
+#ifdef CONFIG_TASK_XACCT
(unsigned long long)task->rchar,
(unsigned long long)task->wchar,
(unsigned long long)task->syscr,
(unsigned long long)task->syscw,
+#endif
(unsigned long long)task->ioac.read_bytes,
(unsigned long long)task->ioac.write_bytes,
(unsigned long long)task->ioac.cancelled_write_bytes);
diff --git a/fs/read_write.c b/fs/read_write.c
index 707ac21700d3..bcb0ef2aae3d 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -274,9 +274,9 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
ret = do_sync_read(file, buf, count, pos);
if (ret > 0) {
fsnotify_access(file->f_path.dentry);
- current->rchar += ret;
+ add_rchar(current, ret);
}
- current->syscr++;
+ inc_syscr(current);
}
}
@@ -332,9 +332,9 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
ret = do_sync_write(file, buf, count, pos);
if (ret > 0) {
fsnotify_modify(file->f_path.dentry);
- current->wchar += ret;
+ add_wchar(current, ret);
}
- current->syscw++;
+ inc_syscw(current);
}
}
@@ -675,8 +675,8 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
}
if (ret > 0)
- current->rchar += ret;
- current->syscr++;
+ add_rchar(current, ret);
+ inc_syscr(current);
return ret;
}
@@ -696,8 +696,8 @@ sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
}
if (ret > 0)
- current->wchar += ret;
- current->syscw++;
+ add_wchar(current, ret);
+ inc_syscw(current);
return ret;
}
@@ -779,12 +779,12 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
retval = in_file->f_op->sendfile(in_file, ppos, count, file_send_actor, out_file);
if (retval > 0) {
- current->rchar += retval;
- current->wchar += retval;
+ add_rchar(current, retval);
+ add_wchar(current, retval);
}
- current->syscr++;
- current->syscw++;
+ inc_syscr(current);
+ inc_syscw(current);
if (*ppos > max)
retval = -EOVERFLOW;