vzmigrate: introduce/use vzfsync for ploop deltas

When performing live migration, container frozen time (i.e. the time
between checkpoint on source and restore on destination node) is
critical.

One reason for restore delay that I found is when a container ploop
is mounted just before the restore, adding ploop deltas can be slow.
This is caused by the fact that deltas are not fully synced to disk,
and therefore kernel forces the sync on every delta.

Obviously, this sync is better to be done earlier, before we freeze
the container. Unfortunately, there is no standard command-line tool
to do fsync or fdatasync on a file in RHEL/CentOS 6, so we have to
write our own -- vzfsync.

While at it, it might be beneficial to also call fadvise(DONTNEED)
to tell the kernel to drop this file page cache, as it is useless
to have it in memory (ploop accesses deltas directly, not via page
cache).

Now, in vzmigrate, we check if vzfsync is available, and call it
for all deltas under the top one. If it's not available, we issue
a warning and ask for vzctl update on destination node.

Some limited testing shows a decrease of "Undump + Resume" stage
timings (as shown by vzmigrate -t).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
6 files changed