Subject: READDIR cleanup

From: Spencer Shepler <[email-masked]>
Date: Tue, 02 Nov 1999 17:33:57 -0600

I would like to clear up some READDIR issues that have
come up in WG email and during the bakeoff.

The READDIR arguments currently contain:
	cookie
	dircount
	maxcount
	attr_request

The response is:
	A linked list of:
		cookie
		name
		attrs
	eof

From NFSv3 we have lost the cookieverifier as part of the request
and response.  So the server doesn't have a method to confirm
the cookie.  Is that okay?  I would think not.

The dircount/maxcount is confusing or problematic.  Dircount is 
supposed to be the size to read as represented in 'local' format.
The maxcount is supposed to be the encoded XDR stream.
Is this useful?  I would think the client would like to find
the size of the directory with GETATTR and then do a read
to either read the entire directory's contents or just a portion
of the directory (if it is reather large).  Is dircount sufficient
to represent the amount of the directory to read?  I think so
if dircount is defined as the size of the directory at the
server's terms.

The intent behind maxcount is that it is a way for the client
to place an upper limit on the XDR data stream that is returned.
The maxcount semantics places encoding complexities on the server
that may cause bugs in the server implementations.  If the server
makes a mistake and encodes too much, what will the client do
with the return value?  I would suggest removing maxcount and
keeping the semantic that the server can return less data on
the READDIR than was requested.

Another approach to readdir would be to have the dircount
field be the number of entries to return and not the size.
The problem with this is that the client doesn't have a way
to determine how many entries are in the directory to enable
reading the entire directory in one request.  I don't think
this is a viable option.  There are other problems with APIs
at the server that would easily enable this type of semantic.

The last issue relates to the encoding of the result.
It was suggested that a counted array may be a reasonable
encoding instead of the linked list?  I like the idea of
the counted array but will this cause extra overhead at the
server?  It certainly would with the current maxcount
semantic
	
Spencer

---

From: Brent <[email-masked]>
Date: Tue, 02 Nov 1999 23:50:36 -0800

> come up in WG email and during the bakeoff.

My position on the READDIR cleanup proposal:

o I agree with Peter.  Let's leave the cookieverifier out, but
  allow the server to return NFS4ERR_BAD_COOKIE if it detects
  that the cookie is bad.  The server can embed the verifier
  in the cookie itself.

o The dircount was fine for v2 and v3 - but we should try
  and manage without it for v4.  I think the maxcount can 
  provide a size hint that's close enough to the truth.
  If experience shows that we should have dircount - then add it
  back in later.

o A counted array for the directory entries would be slightly
  more efficient in XDR space - but more awkward XDR encoding.
  I'm happy to stick with the linked list.  It seems to work
  well enough in v2 and v3.

	Brent