From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phillip Susi Subject: Re: readahead on directories Date: Wed, 21 Apr 2010 10:57:00 -0400 Message-ID: <4BCF123C.6010400@cfl.rr.com> References: <4BCC7C05.8000803@cfl.rr.com> <20100421004434.GA27420@shareable.org> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, Linux-kernel To: Jamie Lokier Return-path: In-Reply-To: <20100421004434.GA27420@shareable.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 4/20/2010 8:44 PM, Jamie Lokier wrote: > readahead() doesn't make much sense on a directory - the offset and > size aren't meaningful. > > But does plain opendir/readdir/closedir solve the problem? No, since those are synchronous. I want to have readahead() queue up reading the entire directory in the background to avoid blocking, and get the queue filled with a bunch of requests that can be merged into larger segments before being dispatched to the hardware. I don't actually care to have the contents of the directories returned, so readdir() does more than I need in that respect, and also it performs a blocking read of one disk block at a time, which is horribly slow with a cold cache.