Eric Blake
2021-Feb-19 15:18 UTC
[Libguestfs] [nbdkit PATCH] cow: Always advertise multi-conn
Our cow data is locked for proper sharing across connections, so even
though NBD_CMD_FLUSH is an intentional no-op, a client is guaranteed
that after a flush by connection A, a read by connection B will not
see any stale data, which matches the requirements for always
advertising multi-conn.
---
filters/cow/cow.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/filters/cow/cow.c b/filters/cow/cow.c
index 93e10f24..1085ee36 100644
--- a/filters/cow/cow.c
+++ b/filters/cow/cow.c
@@ -181,6 +181,14 @@ cow_can_cache (struct nbdkit_next_ops *next_ops, void
*nxdata, void *handle)
return NBDKIT_CACHE_NATIVE;
}
+static int
+cow_can_multi_conn (struct nbdkit_next_ops *next_ops, void *nxdata,
+ void *handle)
+{
+ /* Our cache is consistent between connections. */
+ return 1;
+}
+
/* Override the plugin's .can_fast_zero, because our .zero is not fast */
static int
cow_can_fast_zero (struct nbdkit_next_ops *next_ops, void *nxdata,
@@ -712,6 +720,7 @@ static struct nbdkit_filter filter = {
.can_fua = cow_can_fua,
.can_cache = cow_can_cache,
.can_fast_zero = cow_can_fast_zero,
+ .can_multi_conn = cow_can_multi_conn,
.pread = cow_pread,
.pwrite = cow_pwrite,
.zero = cow_zero,
--
2.30.1
Richard W.M. Jones
2021-Feb-19 19:37 UTC
[Libguestfs] [nbdkit PATCH] cow: Always advertise multi-conn
On Fri, Feb 19, 2021 at 09:18:56AM -0600, Eric Blake wrote:> Our cow data is locked for proper sharing across connections, so even > though NBD_CMD_FLUSH is an intentional no-op, a client is guaranteed > that after a flush by connection A, a read by connection B will not > see any stale data, which matches the requirements for always > advertising multi-conn. > --- > filters/cow/cow.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/filters/cow/cow.c b/filters/cow/cow.c > index 93e10f24..1085ee36 100644 > --- a/filters/cow/cow.c > +++ b/filters/cow/cow.c > @@ -181,6 +181,14 @@ cow_can_cache (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle) > return NBDKIT_CACHE_NATIVE; > } > > +static int > +cow_can_multi_conn (struct nbdkit_next_ops *next_ops, void *nxdata, > + void *handle) > +{ > + /* Our cache is consistent between connections. */ > + return 1; > +} > + > /* Override the plugin's .can_fast_zero, because our .zero is not fast */ > static int > cow_can_fast_zero (struct nbdkit_next_ops *next_ops, void *nxdata, > @@ -712,6 +720,7 @@ static struct nbdkit_filter filter = { > .can_fua = cow_can_fua, > .can_cache = cow_can_cache, > .can_fast_zero = cow_can_fast_zero, > + .can_multi_conn = cow_can_multi_conn, > .pread = cow_pread, > .pwrite = cow_pwrite, > .zero = cow_zero, > --ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/