* [PATCH] increase readdir buffer size
@ 2010-02-03 17:50 Eric Sandeen
2010-02-03 20:31 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2010-02-03 17:50 UTC (permalink / raw)
To: xfs mailing list
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>
---
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index e4caeb2..44bcc67 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -203,9 +203,9 @@ xfs_file_readdir(
*
* Try to give it an estimate that's good enough, maybe at some
* point we can change the ->readdir prototype to include the
- * buffer size.
+ * buffer size. For now we use the current glibc buffer size.
*/
- bufsize = (size_t)min_t(loff_t, PAGE_SIZE, ip->i_d.di_size);
+ bufsize = (size_t)min_t(loff_t, 32768, ip->i_d.di_size);
error = xfs_readdir(ip, dirent, bufsize,
(xfs_off_t *)&filp->f_pos, filldir);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] increase readdir buffer size
2010-02-03 17:50 [PATCH] increase readdir buffer size Eric Sandeen
@ 2010-02-03 20:31 ` Christoph Hellwig
2010-02-15 22:44 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2010-02-03 20:31 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs mailing list
On Wed, Feb 03, 2010 at 11:50:13AM -0600, Eric Sandeen wrote:
> so the default buffer is 4 * 8192 = 32768
> (except in the unlikely case of blocks > 32k....)
>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] increase readdir buffer size
2010-02-03 20:31 ` Christoph Hellwig
@ 2010-02-15 22:44 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2010-02-15 22:44 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs mailing list
On Wed, Feb 03, 2010 at 03:31:10PM -0500, Christoph Hellwig wrote:
> On Wed, Feb 03, 2010 at 11:50:13AM -0600, Eric Sandeen wrote:
> > so the default buffer is 4 * 8192 = 32768
> > (except in the unlikely case of blocks > 32k....)
> >
> > Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
>
> Looks good,
>
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Alex, do you plan to pick this one up?
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-15 22:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-03 17:50 [PATCH] increase readdir buffer size Eric Sandeen
2010-02-03 20:31 ` Christoph Hellwig
2010-02-15 22:44 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox