Commit 1cdf9f76 authored by David Milburn's avatar David Milburn Committed by Christoph Hellwig

nvmet: cleanups the loop in nvmet_async_events_process

Based-on-a-patch-by: default avatarChristoph Hellwig <hch@infradead.org>
Tested-by: default avatarYi Zhang <yi.zhang@redhat.com>
Signed-off-by: default avatarDavid Milburn <dmilburn@redhat.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 64f5e9cd
...@@ -134,15 +134,10 @@ static void nvmet_async_events_process(struct nvmet_ctrl *ctrl, u16 status) ...@@ -134,15 +134,10 @@ static void nvmet_async_events_process(struct nvmet_ctrl *ctrl, u16 status)
struct nvmet_async_event *aen; struct nvmet_async_event *aen;
struct nvmet_req *req; struct nvmet_req *req;
while (1) { mutex_lock(&ctrl->lock);
mutex_lock(&ctrl->lock); while (ctrl->nr_async_event_cmds && !list_empty(&ctrl->async_events)) {
aen = list_first_entry_or_null(&ctrl->async_events, aen = list_first_entry(&ctrl->async_events,
struct nvmet_async_event, entry); struct nvmet_async_event, entry);
if (!aen || !ctrl->nr_async_event_cmds) {
mutex_unlock(&ctrl->lock);
break;
}
req = ctrl->async_event_cmds[--ctrl->nr_async_event_cmds]; req = ctrl->async_event_cmds[--ctrl->nr_async_event_cmds];
if (status == 0) if (status == 0)
nvmet_set_result(req, nvmet_async_event_result(aen)); nvmet_set_result(req, nvmet_async_event_result(aen));
...@@ -153,7 +148,9 @@ static void nvmet_async_events_process(struct nvmet_ctrl *ctrl, u16 status) ...@@ -153,7 +148,9 @@ static void nvmet_async_events_process(struct nvmet_ctrl *ctrl, u16 status)
mutex_unlock(&ctrl->lock); mutex_unlock(&ctrl->lock);
trace_nvmet_async_event(ctrl, req->cqe->result.u32); trace_nvmet_async_event(ctrl, req->cqe->result.u32);
nvmet_req_complete(req, status); nvmet_req_complete(req, status);
mutex_lock(&ctrl->lock);
} }
mutex_unlock(&ctrl->lock);
} }
static void nvmet_async_events_free(struct nvmet_ctrl *ctrl) static void nvmet_async_events_free(struct nvmet_ctrl *ctrl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment