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

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


Hi,

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):

#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
   posix_fadvise(rdcr->spool_fd, 0, 0, POSIX_FADV_WILLNEED);
#endif

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:
#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_SEQUENTIAL)
   posix_fadvise(rdcr->spool_fd, 0, 0, POSIX_FADV_SEQUENTIAL);
#endif
#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_NOREUSE)
   posix_fadvise(rdcr->spool_fd, 0, 0, POSIX_FADV_NOREUSE);
#endif

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
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilot Consulting.