On Tue, May 19, 2020 at 06:11:35PM +0100, Stefan Hajnoczi wrote: > There are three issues with the current NVMeRequest->busy field: > 1. The busy field is accidentally accessed outside q->lock when request > submission fails. > 2. Waiters on free_req_queue are not woken when a request is returned > early due to submission failure. > 2. Finding a free request involves scanning all requests. This makes > request submission O(n^2). > > Switch to an O(1) freelist that is always accessed under the lock. > > Also differentiate between NVME_QUEUE_SIZE, the actual SQ/CQ size, and > NVME_NUM_REQS, the number of usable requests. This makes the code > simpler than using NVME_QUEUE_SIZE everywhere and having to keep in mind > that one slot is reserved. > > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> > --- > block/nvme.c | 81 ++++++++++++++++++++++++++++++++++------------------ > 1 file changed, 54 insertions(+), 27 deletions(-)
Reviewed-by: Sergio Lopez <s...@redhat.com>
signature.asc
Description: PGP signature