Re: readahead on directories

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jamie Lokier
Date: Wednesday, April 21, 2010 - 9:12 am

Phillip Susi wrote:

Asynchronous is available: Use clone or pthreads.

More broadly: One of the ways to better I/O sorting is to make sure
you've got enough things in parallel that the I/O queue is never
empty, so what you issue has time to get sorted before it reaches the
head of the queue for dispatch.  On the other hand, not so many things
in parallel that the queues fill up and throttle.  Unfortunately it
only works if things aren't serialised by kernel locks - but there's been
a lot of work on lockless this and that in the kernel, which may help.

Back to your problem: You need a bunch of scattered block requests to
be queued and sorted sanely, and readdir doesn't do that, and even
waits for each block before issuing the next request.

Or does it?

A quick skim of fs/{ext3,ext4}/dir.c finds a call to
page_cache_sync_readahead.  Doesn't that do any reading ahead? :-)


I/O is the probably the biggest cost, so it's more important to get
the I/O pattern you want than worrying about return values you'll discard.

If readdir() calls are slowed by lots of calls and libc, consider
using the getdirentries system call directly.

If not, fs/ext4/namei.c:ext4_dir_inode_operations points to
ext4_fiemap.  So you may have luck calling FIEMAP or FIBMAP on the
directory, and then reading blocks using the block device.  I'm not
sure if the cache loaded via the block device (when mounted) will then
be used for directory lookups.

-- Jamie
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
readahead on directories, Phillip Susi, (Mon Apr 19, 8:51 am)
Re: readahead on directories, Jamie Lokier, (Tue Apr 20, 5:44 pm)
Re: readahead on directories, Phillip Susi, (Wed Apr 21, 7:57 am)
Re: readahead on directories, Jamie Lokier, (Wed Apr 21, 9:12 am)
Re: readahead on directories, Phillip Susi, (Wed Apr 21, 11:10 am)
Re: readahead on directories, Evgeniy Polyakov, (Wed Apr 21, 11:38 am)
Re: readahead on directories, Jamie Lokier, (Wed Apr 21, 11:51 am)
Re: readahead on directories, Evgeniy Polyakov, (Wed Apr 21, 11:56 am)
Re: readahead on directories, Phillip Susi, (Wed Apr 21, 12:23 pm)
Re: readahead on directories, Jamie Lokier, (Wed Apr 21, 1:01 pm)
Re: readahead on directories, Jamie Lokier, (Wed Apr 21, 1:02 pm)
Re: readahead on directories, Phillip Susi, (Wed Apr 21, 1:13 pm)
Re: readahead on directories, Evgeniy Polyakov, (Wed Apr 21, 1:21 pm)
Re: readahead on directories, Jamie Lokier, (Wed Apr 21, 1:22 pm)
Re: readahead on directories, Jamie Lokier, (Wed Apr 21, 1:37 pm)
Re: readahead on directories, Jamie Lokier, (Wed Apr 21, 1:39 pm)
Re: readahead on directories, Phillip Susi, (Wed Apr 21, 1:59 pm)
Re: readahead on directories, Jamie Lokier, (Wed Apr 21, 3:06 pm)
Re: readahead on directories, Brad Boyer, (Thu Apr 22, 12:01 am)
Re: readahead on directories, Phillip Susi, (Thu Apr 22, 7:26 am)
Re: readahead on directories, Jamie Lokier, (Thu Apr 22, 10:53 am)
Re: readahead on directories, Phillip Susi, (Thu Apr 22, 12:23 pm)
Re: readahead on directories, Jamie Lokier, (Thu Apr 22, 1:35 pm)
Re: readahead on directories, Phillip Susi, (Thu Apr 22, 2:22 pm)
Re: readahead on directories, Jamie Lokier, (Thu Apr 22, 3:43 pm)
Re: readahead on directories, Phillip Susi, (Thu Apr 22, 9:13 pm)
Re: unified page and buffer cache?, Matthew Wilcox, (Fri May 7, 11:30 am)
Re: unified page and buffer cache?, tytso, (Fri May 7, 5:46 pm)
Re: unified page and buffer cache?, Phillip Susi, (Fri May 7, 5:50 pm)
Re: unified page and buffer cache?, Phillip Susi, (Fri May 7, 5:54 pm)
Re: unified page and buffer cache?, tytso, (Sat May 8, 5:52 am)