diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2007-02-10 04:46:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 14:18:07 -0500 |
commit | 4b98d11b40f03382918796f3c5c936d5495d20a4 (patch) | |
tree | 616b7260196c9bd0eaf208ef8fab91fcf9efcece /fs | |
parent | 18f705f49a5b19206233f7cef8f869ce7291f8c8 (diff) |
[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.c | 4 | ||||
-rw-r--r-- | fs/read_write.c | 24 |
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 | |||
1810 | static int proc_pid_io_accounting(struct task_struct *task, char *buffer) | 1810 | static int proc_pid_io_accounting(struct task_struct *task, char *buffer) |
1811 | { | 1811 | { |
1812 | return sprintf(buffer, | 1812 | return sprintf(buffer, |
1813 | #ifdef CONFIG_TASK_XACCT | ||
1813 | "rchar: %llu\n" | 1814 | "rchar: %llu\n" |
1814 | "wchar: %llu\n" | 1815 | "wchar: %llu\n" |
1815 | "syscr: %llu\n" | 1816 | "syscr: %llu\n" |
1816 | "syscw: %llu\n" | 1817 | "syscw: %llu\n" |
1818 | #endif | ||
1817 | "read_bytes: %llu\n" | 1819 | "read_bytes: %llu\n" |
1818 | "write_bytes: %llu\n" | 1820 | "write_bytes: %llu\n" |
1819 | "cancelled_write_bytes: %llu\n", | 1821 | "cancelled_write_bytes: %llu\n", |
1822 | #ifdef CONFIG_TASK_XACCT | ||
1820 | (unsigned long long)task->rchar, | 1823 | (unsigned long long)task->rchar, |
1821 | (unsigned long long)task->wchar, | 1824 | (unsigned long long)task->wchar, |
1822 | (unsigned long long)task->syscr, | 1825 | (unsigned long long)task->syscr, |
1823 | (unsigned long long)task->syscw, | 1826 | (unsigned long long)task->syscw, |
1827 | #endif | ||
1824 | (unsigned long long)task->ioac.read_bytes, | 1828 | (unsigned long long)task->ioac.read_bytes, |
1825 | (unsigned long long)task->ioac.write_bytes, | 1829 | (unsigned long long)task->ioac.write_bytes, |
1826 | (unsigned long long)task->ioac.cancelled_write_bytes); | 1830 | (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) | |||
274 | ret = do_sync_read(file, buf, count, pos); | 274 | ret = do_sync_read(file, buf, count, pos); |
275 | if (ret > 0) { | 275 | if (ret > 0) { |
276 | fsnotify_access(file->f_path.dentry); | 276 | fsnotify_access(file->f_path.dentry); |
277 | current->rchar += ret; | 277 | add_rchar(current, ret); |
278 | } | 278 | } |
279 | current->syscr++; | 279 | inc_syscr(current); |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
@@ -332,9 +332,9 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ | |||
332 | ret = do_sync_write(file, buf, count, pos); | 332 | ret = do_sync_write(file, buf, count, pos); |
333 | if (ret > 0) { | 333 | if (ret > 0) { |
334 | fsnotify_modify(file->f_path.dentry); | 334 | fsnotify_modify(file->f_path.dentry); |
335 | current->wchar += ret; | 335 | add_wchar(current, ret); |
336 | } | 336 | } |
337 | current->syscw++; | 337 | inc_syscw(current); |
338 | } | 338 | } |
339 | } | 339 | } |
340 | 340 | ||
@@ -675,8 +675,8 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) | |||
675 | } | 675 | } |
676 | 676 | ||
677 | if (ret > 0) | 677 | if (ret > 0) |
678 | current->rchar += ret; | 678 | add_rchar(current, ret); |
679 | current->syscr++; | 679 | inc_syscr(current); |
680 | return ret; | 680 | return ret; |
681 | } | 681 | } |
682 | 682 | ||
@@ -696,8 +696,8 @@ sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) | |||
696 | } | 696 | } |
697 | 697 | ||
698 | if (ret > 0) | 698 | if (ret > 0) |
699 | current->wchar += ret; | 699 | add_wchar(current, ret); |
700 | current->syscw++; | 700 | inc_syscw(current); |
701 | return ret; | 701 | return ret; |
702 | } | 702 | } |
703 | 703 | ||
@@ -779,12 +779,12 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
779 | retval = in_file->f_op->sendfile(in_file, ppos, count, file_send_actor, out_file); | 779 | retval = in_file->f_op->sendfile(in_file, ppos, count, file_send_actor, out_file); |
780 | 780 | ||
781 | if (retval > 0) { | 781 | if (retval > 0) { |
782 | current->rchar += retval; | 782 | add_rchar(current, retval); |
783 | current->wchar += retval; | 783 | add_wchar(current, retval); |
784 | } | 784 | } |
785 | current->syscr++; | ||
786 | current->syscw++; | ||
787 | 785 | ||
786 | inc_syscr(current); | ||
787 | inc_syscw(current); | ||
788 | if (*ppos > max) | 788 | if (*ppos > max) |
789 | retval = -EOVERFLOW; | 789 | retval = -EOVERFLOW; |
790 | 790 | ||