[Libguestfs] [nbdkit PATCH v2 07/24] sh: Implement .cache script callback
Richard W.M. Jones
rjones at redhat.com
Fri May 17 17:12:41 UTC 2019
On Wed, May 15, 2019 at 10:57:57PM -0500, Eric Blake wrote:
> It's easy to expose new callbacks to sh plugins, by borrowing
> tri-state code from can_fua. It's possible that nbdkit emulate will
> actually work well (in our example.sh script, the kernel caching a
> pread from one dd invocation may indeed speed up the next access), but
> for the sake of the example, I demonstrated advertising a no-op
> handler.
>
> The shell plugin, coupled with Rich's work on libnbd as a client-side
> library for actually exercising calls to NBD_CMD_CACHE, will be a
> useful way to prove that cache commands even make it through the
> stack. (Remember, qemu 3.0 was released with a fatally flawed
> NBD_CMD_CACHE server implementation, because there were no open source
> clients at the time that could actually send the command to test the
> server with).
>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> plugins/sh/nbdkit-sh-plugin.pod | 27 ++++++++---
> plugins/sh/sh.c | 81 +++++++++++++++++++++++++++++++++
> plugins/sh/example.sh | 7 +++
> 3 files changed, 109 insertions(+), 6 deletions(-)
>
> diff --git a/plugins/sh/nbdkit-sh-plugin.pod b/plugins/sh/nbdkit-sh-plugin.pod
> index 8af88b4..39b99a2 100644
> --- a/plugins/sh/nbdkit-sh-plugin.pod
> +++ b/plugins/sh/nbdkit-sh-plugin.pod
> @@ -220,7 +220,7 @@ This method is required.
>
> Unlike in other languages, you B<must> provide the C<can_*> methods
> otherwise they are assumed to all return false and your C<pwrite>,
> -C<flush>, C<trim>, C<zero> and C<extents> methods will never be
> +C<flush>, C<trim>, C<zero>, and C<extents> methods will never be
I wonder if you meant to add C<cache> to this sentence?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
More information about the Libguestfs
mailing list