lkml.org 
[lkml]   [2003]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] seq_file - please review
Hello,
Could anyone review the following patch? It was generated for 2.4.21, but applies to 2.6 as well.
Below find problem description and patch itself. It is filled into 2.6's bugzilla, see
http://bugme.osdl.org/show_bug.cgi?id=952
So far the only input is that it is worth to push "Again:" label after kmalloc to save redundant if().
P.S. I do not subscribed to the list, thus please in your reply CC me
(vladimir.kondratiev@intel.com)

seq_file's (fs/seq_file.c) implementation for read() do not allow more than one
page to be returned for one system call. This differs from old read_proc_t one:
old implementation used to loop until there is more data to provide.
This mean, programs that used to work fine with old implementation, will not
work with seq_file. I mean programs that do read(large_buffer) once. Strictly
say, correct action would be for program to loop while read()>0, but:
- 1. unfortunately, programs like 'xlogmaster' and 'mc' falls into this category;
- 2. by filling large buffer, we reduce number of syscalls
- 3. data returned by one syscall produced (or may be produced) atomically w.r.t
process context stuff, i.e. it is not the same to do one read() and multiple.


--- linux-2.4.21/fs/seq_file.c 2003-06-13 17:51:37.000000000 +0300
+++ linux/fs/seq_file.c 2003-07-10 10:47:53.000000000 +0300
@@ -55,6 +55,7 @@
return -EPIPE;

down(&m->sem);
+Again:
/* grab buffer if we didn't have one */
if (!m->buf) {
m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
@@ -123,11 +124,14 @@
goto Efault;
copied += n;
m->count -= n;
+ size -= n;
+ buf += n;
if (m->count)
m->from = n;
else
pos++;
m->index = pos;
+ goto Again;
Done:
if (!copied)
copied = err;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.025 / U:1.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site