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/aa5a2183a6d16afd919174b5ba8222b...
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.