Re: [Qemu-block] [PATCH] nbd: Use CoQueue for free_sema instead of CoMutex

2016-10-12 Thread Paolo Bonzini
On 12/10/2016 12:18, Changlong Xie wrote: > +if (s->in_flight == MAX_NBD_REQUESTS) { > +qemu_co_queue_wait(&s->free_sema); > assert(s->in_flight < MAX_NBD_REQUESTS); > } I was wondering if this should be a while loop instead, but the assertion protects against that. So

[Qemu-block] [PATCH] nbd: Use CoQueue for free_sema instead of CoMutex

2016-10-12 Thread Changlong Xie
NBD is using the CoMutex in a way that wasn't anticipated. For example, if there are N(N=26, MAX_NBD_REQUESTS=16) nbd write requests, so we will invoke nbd_client_co_pwritev N times. time request Actions 1