[PATCHv2 3/3] nvme-pci: fix queue_rqs list splitting
Christoph Hellwig
hch at lst.de
Wed Dec 29 09:46:02 PST 2021
> + rq_list_move(rqlist, &requeue_list, req, prev, next);
> +
> + req = prev;
> + if (!req)
> + continue;
Shouldn't this be a break?
> + *rqlist = next;
> + prev = NULL;
> + } else
> + prev = req;
> + }
I wonder if a restart label here would be a little cleaner, something
like:
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 992ee314e91ba..29b433fd12bdd 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -999,9 +999,11 @@ static bool nvme_prep_rq_batch(struct nvme_queue *nvmeq, struct request *req)
static void nvme_queue_rqs(struct request **rqlist)
{
- struct request *req, *next, *prev = NULL;
+ struct request *req, *next, *prev;
struct request *requeue_list = NULL;
+restart:
+ prev = NULL;
rq_list_for_each_safe(rqlist, req, next) {
struct nvme_queue *nvmeq = req->mq_hctx->driver_data;
@@ -1009,9 +1011,9 @@ static void nvme_queue_rqs(struct request **rqlist)
/* detach 'req' and add to remainder list */
rq_list_move(rqlist, &requeue_list, req, prev, next);
+ if (!prev)
+ break;
req = prev;
- if (!req)
- continue;
}
if (!next || req->mq_hctx != next->mq_hctx) {
@@ -1019,9 +1021,9 @@ static void nvme_queue_rqs(struct request **rqlist)
req->rq_next = NULL;
nvme_submit_cmds(nvmeq, rqlist);
*rqlist = next;
- prev = NULL;
- } else
- prev = req;
+ goto restart;
+ }
+ prev = req;
}
*rqlist = requeue_list;
More information about the Linux-nvme
mailing list