[Libguestfs] [PATCH libnbd 0/8] nbdcopy: Adaptive queue size

2022-02-20 Thread Nir Soffer
This series add adaptive queue size feature, which gives great performance improvmemnt on my laptop, but less exciting results on a real server. When qemu-nbd will support MULTI-CON for writes, this should become more interesting. To implement this I added a worker struct for keeping worker state,

[Libguestfs] [PATCH libnbd 5/8] copy: Introduce worker struct

2022-02-20 Thread Nir Soffer
I want to keep more info per worker, and using a worker struct is the natural way to do this. This also allows cleaning up the ops-* interface which accepted uintptr_t index while the index is never a pointer. I think the pointer is a result of passing the index to the thread using the void* pointe

[Libguestfs] [PATCH libnbd 1/8] copy: Remove wrong references to holes

2022-02-20 Thread Nir Soffer
In the past nbdcopy was looking for hole extents instead of zero extents. When we fixed this, we forgot to update some comments and variable names referencing hole instead of zero. Signed-off-by: Nir Soffer --- copy/multi-thread-copying.c | 34 +- 1 file changed,

[Libguestfs] [PATCH libnbd 3/8] copy: Extract create_command and create_buffer helpers

2022-02-20 Thread Nir Soffer
Creating a new command requires lot of boilerplate that makes it harder to focus on the interesting code. Extract a helpers to create a command, and the command slice buffer. create_buffer is called only once, but the compiler is smart enough to inline it, and adding it makes the code much simpler

[Libguestfs] [PATCH libnbd 2/8] copy: Rename copy_subcommand to create_subcommand

2022-02-20 Thread Nir Soffer
copy_subcommand creates a new command without copying the original command. Rename the function to make this more clear. Signed-off-by: Nir Soffer --- copy/multi-thread-copying.c | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/copy/multi-thread

[Libguestfs] [PATCH libnbd 6/8] copy: Keep worker pointer in command

2022-02-20 Thread Nir Soffer
Replace the command index with a worker pointer. The nbd-ops access the index via the worker pointer. This allows commands to modify worker state during processing. Signed-off-by: Nir Soffer --- copy/multi-thread-copying.c | 12 ++-- copy/nbd-ops.c | 6 +++--- copy/nbdcopy.

[Libguestfs] [PATCH libnbd 4/8] copy: Separate finishing a command from freeing it

2022-02-20 Thread Nir Soffer
free_command() was abused as a completion callback. Introduce finish_command() completion callback, so code that want to free a command does not have to add dummy errors. This will make it easier to manage worker state when a command completes. Signed-off-by: Nir Soffer --- copy/multi-thread-co

[Libguestfs] [PATCH libnbd 7/8] copy: Track worker queue size

2022-02-20 Thread Nir Soffer
Tracking the number of queued bytes per worker will allow optimizing the number of in flight requests based on the actual requests size. The goal is to allow large number of small requests, required to get good performance, and in the same time limit the number of large requests, that can be faste

[Libguestfs] [PATCH libnbd 8/8] copy: Adaptive queue size

2022-02-20 Thread Nir Soffer
Limit the size of the copy queue also by the number of queued bytes. This allows using many concurrent small requests, required to get good performance, but limiting the number of large requests that are actually faster with lower concurrency. New --queue-size option added to control the maximum q

Re: [Libguestfs] [PATCH libnbd 4/8] copy: Separate finishing a command from freeing it

2022-02-20 Thread Richard W.M. Jones
On Sun, Feb 20, 2022 at 02:13:59PM +0200, Nir Soffer wrote: > free_command() was abused as a completion callback. Introduce > finish_command() completion callback, so code that want to free a In the code it's called "finished_command". ACK patches 1, 2, 3 & 4 (with this fix to the commit message)

Re: [Libguestfs] [PATCH libnbd 5/8] copy: Introduce worker struct

2022-02-20 Thread Richard W.M. Jones
ACK patch 5 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 W

Re: [Libguestfs] [PATCH libnbd 8/8] copy: Adaptive queue size

2022-02-20 Thread Richard W.M. Jones
On Sun, Feb 20, 2022 at 02:14:03PM +0200, Nir Soffer wrote: > Limit the size of the copy queue also by the number of queued bytes. > This allows using many concurrent small requests, required to get good > performance, but limiting the number of large requests that are actually > faster with lower

Re: [Libguestfs] [PATCH libnbd 7/8] copy: Track worker queue size

2022-02-20 Thread Richard W.M. Jones
On Sun, Feb 20, 2022 at 02:14:02PM +0200, Nir Soffer wrote: > +static inline void > +increase_queue_size(struct worker *worker, size_t len) ^ space and the same in the next function: > +{ > + worker->queue_size += len; > +} > + > +static inline void > +decrease_queue_size(

Re: [Libguestfs] virt-customize

2022-02-20 Thread Lukáš Doktor
That was quick, thank you Rich. Temporarily I used the "cp" approach, but escaping possibility would be IMO useful, especially for automated setups where "--upload" args are generated automatically (my case). Regards, Lukáš Dne 18. 02. 22 v 20:00 Richard W.M. Jones napsal(a): > On Fri, Feb 18,

Re: [Libguestfs] [PATCH nbdkit v2 7/7] New filter: nbdkit-block-size-constraint-filter

2022-02-20 Thread Richard W.M. Jones
On Fri, Feb 18, 2022 at 12:25:56PM +, Richard W.M. Jones wrote: > On Thu, Feb 17, 2022 at 04:44:56PM -0600, Eric Blake wrote: > > On Thu, Feb 17, 2022 at 10:00:52PM +, Richard W.M. Jones wrote: > > > On Thu, Feb 17, 2022 at 03:58:07PM -0600, Eric Blake wrote: > > > > The NBD protocol spec r

Re: [Libguestfs] [libnbd PATCH] RFC: api: Add set_request_block_size

2022-02-20 Thread Richard W.M. Jones
On Thu, Feb 17, 2022 at 05:04:13PM -0600, Eric Blake wrote: > WIP: I need to finish writing the actual interop-qemu-block-size.sh to > demonstrate scenarios where qemu-nbd advertises a block size > 1 to > clients that request it, but sticks to 1 otherwise (see > https://gitlab.com/qemu-project/qemu

[Libguestfs] Getting ready for libnbd 1.12 & nbdkit 1.30 releases

2022-02-20 Thread Richard W.M. Jones
I don't think I announced it, but back in January I thought I would be doing a new stable release of libnbd (1.12) and nbdkit (1.30). That didn't happen obviously because once I'd written up the release notes they seemed a bit thin: https://libguestfs.org/libnbd-release-notes-1.12.1.html https://

[Libguestfs] [PATCH nbdkit] cache, cow: Export block size constraints

2022-02-20 Thread Richard W.M. Jones
Because these filters perform a read-modify-write cycle for requests which are smaller than the block size of the filter, we can adjust or set the preferred block size to the block size of the filter or the preferred block size of the underlying plugin, whichever is larger. We're careful not to se

[Libguestfs] [PATCH nbdkit] blocksize: Export block size constraints

2022-02-20 Thread Richard W.M. Jones
This filter is a little unusual because it allows clients to send a wider range of request sizes than the underlying plugin allows. Therefore we advertise the widest possible minimum and maximum block size to clients. We still need to pick a suitable preferred block size assuming the plugin itself

Re: [Libguestfs] [PATCH libnbd 7/8] copy: Track worker queue size

2022-02-20 Thread Nir Soffer
On Sun, Feb 20, 2022 at 8:53 PM Richard W.M. Jones wrote: > > On Sun, Feb 20, 2022 at 02:14:02PM +0200, Nir Soffer wrote: > > +static inline void > > +increase_queue_size(struct worker *worker, size_t len) > > ^ space > > and the same in the next function: Sure will fix befo

Re: [Libguestfs] [PATCH nbdkit v2 2/7] tls-fallback: Fix filter for new .block_size callback

2022-02-20 Thread Laszlo Ersek
On 02/17/22 17:56, Eric Blake wrote: > On Thu, Feb 17, 2022 at 04:41:31PM +, Richard W.M. Jones wrote: >> On Thu, Feb 17, 2022 at 10:30:13AM -0600, Eric Blake wrote: >>> On Thu, Feb 17, 2022 at 02:36:43PM +, Richard W.M. Jones wrote: This filter doesn't call the next_open function in t