lkml.org 
[lkml]   [2001]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [CFT][PATCH] large /proc/mounts and friends

On Mon, 15 Oct 2001, Linus Torvalds wrote:
>
> So you'd have the start be something like
>
> p = m->op->start(m);
> if (m->did_lseek) {
> m->did_lseek = 0;
> p = m->op->seek(m, pos);
> }
> p = m->op->next(m, p);

Actually, the "seek" is obviously unconditional. Duh.

And we really want to pass in the "file" to the next/seek functions,
because I still think that we don't want this to be just a plain linear
sequence interface - your "/proc/module" thing already shows how it could
be advantageous to have the high pos bits be the module itself.

Example:

/* module seek */
s_seek()
{
struct mod_sym *v = p;
int mod_nr = pos >> 32;
while (mod_nr && v->mod) {
mod_nr--;
v->mod = v->mod->next;
};
}

where the high 32 bits of the pos are the module count. Something that the
"increment by one" approach simply cannot handle efficiently because it
ends up having to walk every module name, and can't just skip over them.

Again, the other example of this are various hashed data-structures loke
sockets that simply do not _have_ cardinal numbers, and where it is not
really reasonable to walk the chain of (potentially tens of thousands of)
entries one-by-one, when you can do a seek directly to the right hash
bucket, and then just walk a few entries in the hash chain..

Linus

-
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:08    [W:0.092 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site