Re: If not readdir() then what?

From: Theodore Tso
Date: Mon Apr 16 2007 - 06:41:14 EST


On Mon, Apr 16, 2007 at 03:47:21PM +1000, Neil Brown wrote:
> "my guess", "pretty much" really bother me.
>
> It sounds like "The largest anyone has asked for is 128bits, or let's
> double it and hope that is enough until the next protocol revision".
> Which was probably reasonable when NFSv2 was being developed and maybe
> even when v3 was developed, but I kind of hoped we were beyond that.
>
> If a filesystem wanted to order filenames lexically, it really needs
> 256 *bytes*. And it is fairly silly having a cookie that big.
>
> I still thinking that
> filename + 64bits
> is required and plenty (aka necessary and sufficient).

Sure, but if you're going to include the filename in the cookie, on
the client side you now have to store a variable-length state, which
probably means you'll need to allocate and free memory each time; and
if the filename is 256 characters, you'll have to send that back in
the next readdir() request.

If we could get filename + 64bits, sure, that would be great. I was
just assuming we couldn't get it --- and if we can't get it, 256 bits
is two SHA-1 hashes. So that's one hash for the filename, and 128
bits for a filesystem's internal hash collision. There might be other
ways that the space could be divided up, which might be somewhat
wasteful of space --- say you need a host identifier for a clustered
filesystem, although arguably adding a host might be infrequent enough
that you just use the cookie verifier hammer and force the client to
get a new set of readdir cookies. :-)

> I wouldn't argue against 128bits (64 for a search key and 64 to
> guarantee uniqueness) but I really think 256 excessive with no value.
> We we still need the last-filename in the READDIR key.

I wouldn't complain too much about 128 bits, but if we're going to go
fixed size, I can imagine filesystems where that might not be enough.
And the differecen between 16 and 32 bytes isn't that great. But I
could easily live with either filename + 64bits, or 128 bits.

- Ted
-
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/