On 5/17/19 12:12 PM, Richard W.M. Jones wrote:
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).
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?
Yes. Good catch :) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org