On 01/19/2018 10:23 AM, Eric Blake wrote:
From: "Richard W.M. Jones" <rjones@redhat.com>
Whoops, that's supposed to be attributed to me as author if we keep this patch separate from your work (I was still attributing it to you when I had squashed it into your earlier patches, so this was a rebase artifact).
This patch may be worth squashing? --- docs/nbdkit-filter.pod | 65 +++++++++++++++++++++++++++++++++++++++++++------ include/nbdkit-filter.h | 29 ++++++++++++---------- src/filters.c | 55 ++++++++++++++++++++--------------------- 3 files changed, 101 insertions(+), 48 deletions(-)
@@ -333,11 +342,21 @@ message B<and> set C<errno>, then return C<-1>.
int (*pwrite) (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle, - const void *buf, uint32_t count, uint64_t offset); + const void *buf, uint32_t count, uint64_t offset, + uint32_t flags);
This intercepts the plugin C<.pwrite> method and can be used to modify data written by the plugin.
+At this time, flags may include C<NBDKIT_FLAG_FUA> on input based on +the result of C<.can_flush>. In turn, the filter may only pass +C<NBDKIT_FLAG_FUA> on to C<next_ops->pwrite> if C<next_ops->can_flush> +returned true. + +This function will not be called if C<.can_write> returned false; in +turn, the filter should not call C<next_ops->pwrite> if C<next_ops->can_write> +did not return true.
I'm wondering if we're missing documentation here (and/or in the plugins document) that if .can_write returns true, the plugin must supply a .pwrite; likewise for .can_trim implying a .trim, and .can_flush implying a .flush. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org