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

[Bacula-devel] Correct usage of posix_fadvise in SD?


I was looking to the 2.4.2 SD spooling code lately (this was part of
understanding why despooling performances were not that good on my
hardware), when I noticed the following usage of posix_fadvise while
sequentially reading the spool file (despool_data):

   posix_fadvise(rdcr->spool_fd, 0, 0, POSIX_FADV_WILLNEED);

I don't understand why we're telling the kernel to page cache the spool
file we're reading since we won't reuse those data.
Moreover, there is no "DONTNEED" call after despool_data to let the
kernel know it can trash what we read.

I thought that something along the line of this in despool_data:
   posix_fadvise(rdcr->spool_fd, 0, 0, POSIX_FADV_SEQUENTIAL);
   posix_fadvise(rdcr->spool_fd, 0, 0, POSIX_FADV_NOREUSE);

And a few POSIX_FADV_DONTNEED after each block read with the correct
offset and length to tell the pagecache we don't need this part anymore.

Does it make sense?
Or did I miss something?
Brice Figureau <brice+bacula@xxxxxxxxxxxxxxxx>

This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
Bacula-devel mailing list

This mailing list archive is a service of Copilot Consulting.