Re: [PATCH 2/2] libext2fs/e2fsck: implement metadata prefetching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 27, 2014, at 7:28 PM, Theodore Ts'o <tytso@xxxxxxx> wrote:
> On Thu, Feb 27, 2014 at 12:03:56PM -0500, Phillip Susi wrote:
>> 
>> Why build your own cache instead of letting the kernel take care of
>> it?  I  believe the IO elevator already gives preferential treatment
>> to blocking reads so just using readahead() to prefetch and sticking
>> with plain old read() should work nicely.
> 
> The reason why it might be better for us to use our own cache is
> because we can more accurately know when we're done with the block,
> and we can drop it from the cache.

One argument in favour of using the kernel buffer cache is that the
common case of e2fsck followed by mounting the filesystem would be
much faster because e2fsck has already populated the kernel cache.
Otherwise, all of the IO done to populate the userspace cache would
be lost when e2fsck exits.  Similarly, repeated runs of e2fsck would
not see any benefit of the userspace cache.

> I suppose we could use posix_fadvise(POSIX_FADV_DONTNEED) --- and
> hopefully this works on block devices for the buffer cache, but it
> wouldn't all surprise me that if we can get finer-grained control if
> we use O_DIRECT and manage the buffers ourselves.  Whether it's worth
> the extra complexitry is a fair question --- but simply adding
> metadata prefetching is going to add a fair amount of complexity
> already, and we should test to make sure that readahead() and
> posix_fadvise() actually work correctly on block devices --- a couple
> of years ago, I had explored readahead() precisely as a cheap way of
> adding metadata precaching for e2fsck, and it was a no-op when I tried
> the test back then.

We tested several different mechanisms for readahead a few years ago
for the e2scan tool, and that resulted in the readahead patch that
Darrick updated recently.  It definitely shows performance improvement.

Whether POSIX_FADV_DONTNEED actually flushes pages from cache is a
separate question.  My preference would be that if this is currently
a no-op that we work to fix it in the kernel so that it is working
for everyone rather than investing time and effort into code that is
only useful for e2fsprogs.

Cheers, Andreas





Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux