[Libguestfs] [PATCH libnbd v2 0/3] fuse: Enable multithread support

Richard W.M. Jones rjones at redhat.com
Fri May 14 09:06:10 UTC 2021


v1 was here:
https://listman.redhat.com/archives/libguestfs/2021-May/msg00081.html

Compared to v1, patches 1/3 and 3/3 are identical.

The new version of patch 2/3 cleans up parallel support.  In v1
(https://listman.redhat.com/archives/libguestfs/2021-May/msg00083.html)
the thread model was ... interesting.  Each FUSE thread would race
poll(2) calls on the same file descriptor against each other, and then
when one succeeded it would grab a global lock, rerun poll on the file
descriptor (to get the true picture of the fd's state), and run the
NBD state machine within that global lock but on the FUSE thread.

In this version there is a single background thread which dispatches
NBD requests on the handle.  FUSE threads only start the asynch
command, then block waiting for the background thread to finish off
their command.

Perhaps not too surprisingly v1 is quite a bit faster than v2.  v2
suffers from the overhead of coordination between the FUSE threads and
the single thread performing the NBD operations (as well as there
being only a single thread doing the work).  But I think v2 is more
maintainable.  Multi-conn would help here and also be easier to add
with v2.

The FIO results presented in the commit messages are stable.

Rich.





More information about the Libguestfs mailing list