Re: If not readdir() then what?

From: Trond Myklebust
Date: Tue Apr 10 2007 - 10:38:18 EST


On Tue, 2007-04-10 at 09:56 -0400, Theodore Tso wrote:


> That might work. But if in the long term we want to separate out what
> we can send back via telldir/seekdir, and some future new Posix
> interface, I wonder if we might be better off defining a formal
> interface which can be used by NFSv2 and NFSv3/v4 that isn't
> necessarily tied to f_pos.

Note: POSIX does not mandate telldir/seekdir. The latter are only
mandated by the XSI extensions (that are part of the Single Unix spec).

Also note that SuSv3 states

One of the perceived problems of implementation is that
returning to a given point in a directory is quite difficult to
describe formally, in spite of its intuitive appeal, when
systems that use B-trees, hashing functions, or other similar
mechanisms to order their directories are considered. The
definition of seekdir() and telldir() does not specify whether,
when using these interfaces, a given directory entry will be
seen at all, or more than once.

So whereas collisions are not supported, it does appear that the SuSv3
does not mandate that you should be able to replay the exact same
stream.

NFS, OTOH, simply could not work without that requirement, since there
exists no file pointer to tell you where you are in a stream beyond
whatever the server manages to encode inside the opaque cookie+verifier.

> But the fact of the matter is that if NFS protocols demands that a
> per-directory entry cookie can be uniquely and permanently (including
> across server reboots) identified with a small integer number, it's
> dreaming. Filesystem authors will cheat one way or another, because
> there's nothing else for them to do.

Few people in the NFS community would disagree that the design of
READDIR sucks (personally, I consider it to be one of the biggest
scalability issues we have).
The problem is that it is extremely hard to come up with an alternative
that doesn't impose new conditions on what filesystems you can support.

Cheers
Trond

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