* [PATCH] cpuset crapectomy
@ 2005-09-30 2:26 Al Viro
2005-09-30 14:30 ` Paul Jackson
0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2005-09-30 2:26 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, pj
Switched cpuset_common_file_read() to simple_read_from_buffer(),
killed a bunch of useless (and not quite correct - e.g. min(size_t,ssize_t))
code.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
----
diff -urN RC14-rc2-git6-base/kernel/cpuset.c current/kernel/cpuset.c
--- RC14-rc2-git6-base/kernel/cpuset.c 2005-09-28 21:33:37.000000000 -0400
+++ current/kernel/cpuset.c 2005-09-29 16:09:00.000000000 -0400
@@ -968,8 +968,6 @@
char *page;
ssize_t retval = 0;
char *s;
- char *start;
- ssize_t n;
if (!(page = (char *)__get_free_page(GFP_KERNEL)))
return -ENOMEM;
@@ -999,15 +997,7 @@
*s++ = '\n';
*s = '\0';
- start = page + *ppos;
- n = s - start;
-
- /* Do nothing if *ppos is at the eof or beyond the eof. */
- if (n <= 0)
- goto out;
-
- retval = n - copy_to_user(buf, start, min(n, nbytes));
- *ppos += retval;
+ retval = simple_read_from_buffer(buf, nbytes, ppos, page, s - page);
out:
free_page((unsigned long)page);
return retval;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] cpuset crapectomy
2005-09-30 2:26 [PATCH] cpuset crapectomy Al Viro
@ 2005-09-30 14:30 ` Paul Jackson
0 siblings, 0 replies; 2+ messages in thread
From: Paul Jackson @ 2005-09-30 14:30 UTC (permalink / raw)
To: Al Viro; +Cc: torvalds, linux-kernel
Thanks, Al, for picking up after us.
Actually, we can remove one more line of code. The line right above
the code you ripped out is:
*s = '\0';
I think this line is utterly useless.
Perhaps I can find time to prepare a trivial "cpuset crapectomy stage
two" patch to remove this line too.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-30 14:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-30 2:26 [PATCH] cpuset crapectomy Al Viro
2005-09-30 14:30 ` Paul Jackson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox