linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: peter.staubach@emc.com, Trond.Myklebust@netapp.com,
	bjschuma@netapp.com, linux-nfs@vger.kernel.org
Subject: Re: Use of READDIRPLUS on large directories
Date: Fri, 18 Mar 2011 15:27:09 +1100	[thread overview]
Message-ID: <20110318152709.77e2d51b@notabene.brown> (raw)
In-Reply-To: <20110317174453.GC30180@fieldses.org>

On Thu, 17 Mar 2011 13:44:53 -0400 "J. Bruce Fields" <bfields@fieldses.org>
wrote:

> On Thu, Mar 17, 2011 at 11:55:22AM +1100, NeilBrown wrote:
> > Strangely, when I try NFSv4 I don't get what I would expect.
> > 
> > "ls" on an unpatched 2.6.38 takes over 5 seconds rather than around 4.
> > With the patch it does back down to about 2. (still NFSv3 at 1.5).
> > Why would NFSv4 be slower?
> >  On v3 we make 44 READDIRPLUS calls and 284 READDIR calls - total of  328
> >        READDIRPLUS have about 30 names, READDIR have about 100
> >  On v4 we make 633 READDIR calls - nearly double.
> >        Early packed contain about 19 name, later ones about 70
> > 
> > Is nfsd (2.6.32) just not packing enough answers in the reply?
> > Client asks for a dircount of 16384 and a maxcount of 32768, and gets
> > packets which are about 4K long - I guess that is PAGE_SIZE ??
> 
> >From nfsd4_encode_readdir():
> 
> 	maxcount = PAGE_SIZE;
> 	if (maxcount > readdir->rd_maxcount)
> 		maxcount = readdir->rd_maxcount;
> 
> Unfortunately, I don't think the xdr encoding is equipped to deal with
> page boundaries.  It should be.

Bah humbug.
NFSv3 gets it right - it just encodes into the next page and then copies back.

Sounds like a simple afternoon's project .... now if only we could find
someone with a simple afternoon :-)
Getting a realistic upper limit on the size of the reply (which is more
variable for v4 than for v3) would be the only tricky bit..
Though nfsd4_encode_fattr looks fairly idempotent, so you could just
try to encode and if it doesn't fit:
  allocate next page
  encode into there
  copy some into previous page
  copy rest down.

NeilBrown

  reply	other threads:[~2011-03-18  4:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16  4:55 Use of READDIRPLUS on large directories NeilBrown
2011-03-16 12:30 ` peter.staubach
2011-03-16 13:50   ` Trond Myklebust
2011-03-16 21:40   ` NeilBrown
2011-03-17  0:55     ` NeilBrown
2011-03-17 17:44       ` J. Bruce Fields
2011-03-18  4:27         ` NeilBrown [this message]
2011-03-16 13:43 ` Chuck Lever
2011-03-16 14:14   ` Bryan Schumaker
2011-03-16 14:20     ` Trond Myklebust
2011-03-16 21:30       ` NeilBrown
2011-03-16 21:42         ` Trond Myklebust
2011-03-16 22:40           ` NeilBrown
2011-03-17 17:18             ` J. Bruce Fields
2011-04-04 20:14               ` Bryan Schumaker
2011-04-05 12:20                 ` NeilBrown
2011-04-07 14:28                   ` Bryan Schumaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110318152709.77e2d51b@notabene.brown \
    --to=neilb@suse.de \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=bjschuma@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=peter.staubach@emc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).