[Libguestfs] New extents structure proposal

Richard W.M. Jones rjones at redhat.com
Wed Mar 20 15:31:19 UTC 2019


I think the extents map is just too complicated and is unnecessarily
so.  How about instead we define the plugin interface to be:

  int can_extents (void *handle);  // as before
  int extents (void *handle, uint32_t count, uint64_t offset, uint32_t flags,
               struct nbdkit_extents_list *list);

and have the extents_list be a simple list.  The first extent you add
must start at offset.  And you're only allowed to append monotonically
increasing adjacent extents to it.  Plugins must return at least one
extent, but are not required to return more than one extent
(regardless of flags).

This would be simple enough to implement for both VDDK and file.  (For
VDDK the plugin needs to synthesize the holes but that's only a slight
complication).

NBDKIT_FLAG_REQ_ONE is now simple to implement (if generating the
extents, stop after generating the first one; if it's the server
processing the extents, take the first extent in the list).

The ‘end’ that we discussed before is now implicit (it's the byte of
the last extent in the list).

Also an observation: qemu's nbd client only ever issues block status
requests with the req-one flag set, so perhaps we should optimize for
that case.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list