]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - fs/xfs/xfs_file.c
xfs: increase readdir buffer size
authorEric Sandeen <sandeen@sandeen.net>
Wed, 3 Feb 2010 17:50:13 +0000 (17:50 +0000)
committerAlex Elder <aelder@sgi.com>
Mon, 1 Mar 2010 22:33:41 +0000 (16:33 -0600)
commita9cc799eca0c798ab5dd8648564fc2025bdd9bd2
tree8776d8ba707dd7e87fd282335ef3ed66ba9973b4
parent398007f863a4af2b4a5a07219c5a617f1a098115
xfs: increase readdir buffer size

While doing some testing of readdir perf a while back,
I noticed that the buffer size we're using internally is
smaller than what glibc gives us by default.  Upping this
size helped a bit, and seems safe.

glibc's __alloc_dir() does:

  const size_t default_allocation = (4 * BUFSIZ < sizeof (struct dirent64)
                                     ? sizeof (struct dirent64) : 4 * BUFSIZ);
  const size_t small_allocation = (BUFSIZ < sizeof (struct dirent64)
                                   ? sizeof (struct dirent64) : BUFSIZ);
  size_t allocation = default_allocation;
#ifdef _STATBUF_ST_BLKSIZE
  if (statp != NULL && default_allocation < statp->st_blksize)
    allocation = statp->st_blksize;
#endif

and

#define _G_BUFSIZ 8192
#define _IO_BUFSIZ _G_BUFSIZ
# define BUFSIZ _IO_BUFSIZ

so the default buffer is 4 * 8192 = 32768
(except in the unlikely case of blocks > 32k....)

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
fs/xfs/linux-2.6/xfs_file.c