From d48159806734a2fb69a24b59e150192854fcbed8 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 5 Apr 2019 15:33:14 +0100 Subject: [PATCH] v2v: nbdkit: Add the readahead filter unconditionally if it is available. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The readahead filter is a self-configuring filter that makes sequential reads faster when the plugin is slow (and all of the plugins we use here are always slow). I observed the behaviour of the readahead filter with our qcow2 overlay when converting a guest from a vCenter source. Even when doing random reads, qemu issues 64K reads which happen to also be the minimum request size of the readahead filter, so there is no extra overhead. When doing the sequential copy the readahead filter performed better than qemu curl’s readahead because it scaled the prefetched data appropriately on long contiguous stretches and then shrunk it back to 64K around fragmented parts of the base image. --- v2v/nbdkit.ml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/v2v/nbdkit.ml b/v2v/nbdkit.ml index e945df62a..8e62f56b3 100644 --- a/v2v/nbdkit.ml +++ b/v2v/nbdkit.ml @@ -144,6 +144,13 @@ let common_create plugin_name plugin_args plugin_env = Sys.command cmd <> 0 in + (* Adding the readahead filter is always a win for our access + * patterns. However if it doesn't exist don't worry. + *) + if probe_filter "readahead" then ( + add_arg "--filter"; add_arg "readahead" + ); + let args = get_args () @ [ plugin_name ] @ plugin_args in { plugin_name; args; env; dump_config; dump_plugin }