Re: Very slow header cache in mutt if the maildir is on ext3

Tino Keitel
2008-12-17T16:17:37Z

On Wed, Dec 17, 2008 at 07:32:04 -0500, Theodore Tso wrote:

[...]

> I just checked mutt 1.5.17 in Ubunty Hardy, and it sorts the inodes
> even if maildir_header_cache_verify is unset. (It sorts it earlier if
> that option is set, but a little later in the function, if it wasn't
> sorted earlier, it sorts it then.) Check for calls to maildir_sort()
> that use md_cmp_inode(); in my version of mutt, there are two such
> calls in mh.c:maildir_delayed_parsing().

I checked maildir_sort(), and it wasn't called with
maildir_header_cache_verify unset. In the source, it looks like this:

#if USE_HCACHE
if (option(OPTHCACHEVERIFY))
{
DO_SORT();
ret = stat(fn, &lastchanged);
}

...

if (ctx->magic == M_MH)
data = mutt_hcache_fetch (hc, p->h->path, strlen);
else
data = mutt_hcache_fetch (hc, p->h->path + 3, &maildir_hcache_keylen);

...

#endif /* USE_HCACHE */

DO_SORT();

So DO_SORT() is called _after_ reading the header cache if
maildir_header_cache_verify is unset, which is too late, because the
hard disk seeks to death if the cache is read with the unsorted inode
list.

Regards,
Tino