[Libguestfs] [nbdkit PATCH 04/10] plugins: Wire up in-memory plugin support for NBD_INFO_INIT_STATE

Richard W.M. Jones rjones at redhat.com
Tue Feb 11 10:48:01 UTC 2020


On Mon, Feb 10, 2020 at 03:43:57PM -0600, Eric Blake wrote:
> +/* Does current client start with a sparse image. */
> +static int
> +memory_init_sparse (void *handle)
> +{
> +  ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock);
> +  return sparse_array_is_sparse (sa);
> +}
> +
> +/* Does current client start with all zeroes. */
> +static int
> +memory_init_zero (void *handle)
> +{
> +  ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock);
> +  return sparse_array_is_zero (sa);
> +}

I was going to say these are always true, but then I remembered that
NBD_INIT_* records the state at the start of the *connection*, not the
start of the *server* instance, and if there's been a previous
connection then the RAM disk might indeed contain non-zero non-sparse
data.

Do we need to define what NBD_INIT_ZERO means when disk size = 0 ?

By the way, the data plugin can also be updated since it also uses the
sparse array feature.

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/




More information about the Libguestfs mailing list