[Libguestfs] [PATCH libnbd] copy: Set POSIX_FADV_SEQUENTIAL and POSIX_FADV_DONTNEED

Richard W.M. Jones rjones at redhat.com
Fri Feb 19 17:56:57 UTC 2021


I'm trying to emulate what we do in nbdkit-file-plugin to avoid the
page cache getting trashed when copying to/from local files:
https://gitlab.com/nbdkit/nbdkit/-/commit/aa5a2183a6d16afd919174b5ba8222b2bccf4039

This patch works well when reading from a local file as you can see
from the results in the commit message.  However when writing to a
local file it has absolutely no effect, and I've no idea why.  (Even
checked with strace and it's making the correct fadvise64 system
calls).

For the reading case it has a slight performance impact which could be
problematic.  Should we only enable it with a flag?  I would prefer to
fix it so it's always beneficial, but it's not too easy to do that
without adding more threads and synchronization.

Rich.





More information about the Libguestfs mailing list