I'm still working on the interleaving (and Rich reminded me on IRC that we still don't have THREAD_MODEL_PARALLEL working anywhere yet, anyways). Since nbdkit doesn't really have a parallel plugin yet, my testing on that front will have to use qemu-nbd as the original server, as well as qemu-io as the driver (qemu-io's aio_read and aio_write commands can be used to trigger interleaved requests, and well-placed gdb breakpoints can make the triggering even easier to test). Do people like the name 'nbd-forward' instead of 'nbd'? The name of the plugin describes what it connects to ('nbdkit file ...' connects to a file; 'nbdkit streaming ...' connects to a streaming fd, so 'nbdkit nbd ...' connects to another nbd server); but the reuse of the term 'nbd' might be a bit confusing, where a longer name would make it more obvious on intended usage. Here's how I tested: term1$ rm -f sock; ./nbdkit -o -U sock [-r] file file=TODO term2$ ./nbdkit [-r] -n nbd socket=sock term3$ qemu-io -f raw nbd://localhost:10809/ [-r] which let me use qemu-io commands to peek (and poke) the TODO file through two layers of nbdkit processes, while upgrading from an old-style handshake to a newstyle (I also used -fv on nbdkit and --trace='nbd_*' on qemu-io to turn up the debugging messages, to actually watch the interactions). Patch 2 shows my thought process to switching things to fully parallel: patch 3/2 (still unwritten at the moment) would basically change a single transaction into a linked list, where nbd_request_full() adds another transaction to the list, nbd_read_raw() uses the cookie received from the server to look up a transaction to remove from the list, and where breaking the while(1) loop of nbd_reader() cleans up any remaining transactions still on the list. Eric Blake (2): nbd: Add new nbd forwarding plugin nbd: Split reading into separate thread configure.ac | 1 + plugins/Makefile.am | 1 + plugins/nbd/Makefile.am | 63 ++++ plugins/nbd/nbd.c | 629 ++++++++++++++++++++++++++++++++++++++ plugins/nbd/nbdkit-nbd-plugin.pod | 96 ++++++ 5 files changed, 790 insertions(+) create mode 100644 plugins/nbd/Makefile.am create mode 100644 plugins/nbd/nbd.c create mode 100644 plugins/nbd/nbdkit-nbd-plugin.pod -- 2.13.6