diff options
author | jimharris <jimharris@FreeBSD.org> | 2013-04-12 17:36:48 +0000 |
---|---|---|
committer | jimharris <jimharris@FreeBSD.org> | 2013-04-12 17:36:48 +0000 |
commit | d3af7eb2bf127dbb0d1bcb109e0febe6e27dfbde (patch) | |
tree | 968ac4b0658618f9a0bbd8d4e8268d6e21de33f7 | |
parent | 92ebbf5a669cdb8c2946c4ac9163e228b3319282 (diff) | |
download | FreeBSD-src-d3af7eb2bf127dbb0d1bcb109e0febe6e27dfbde.zip FreeBSD-src-d3af7eb2bf127dbb0d1bcb109e0febe6e27dfbde.tar.gz |
Rename the controller's fail_req_lock, so that it can be used for other
locking operations on the controller.
Sponsored by: Intel
-rw-r--r-- | sys/dev/nvme/nvme_ctrlr.c | 12 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_private.h | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 9d10b2ee..9d66b9c 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -307,9 +307,9 @@ nvme_ctrlr_post_failed_request(struct nvme_controller *ctrlr, struct nvme_request *req) { - mtx_lock(&ctrlr->fail_req_lock); + mtx_lock(&ctrlr->lock); STAILQ_INSERT_TAIL(&ctrlr->fail_req, req, stailq); - mtx_unlock(&ctrlr->fail_req_lock); + mtx_unlock(&ctrlr->lock); taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->fail_req_task); } @@ -319,14 +319,14 @@ nvme_ctrlr_fail_req_task(void *arg, int pending) struct nvme_controller *ctrlr = arg; struct nvme_request *req; - mtx_lock(&ctrlr->fail_req_lock); + mtx_lock(&ctrlr->lock); while (!STAILQ_EMPTY(&ctrlr->fail_req)) { req = STAILQ_FIRST(&ctrlr->fail_req); STAILQ_REMOVE_HEAD(&ctrlr->fail_req, stailq); nvme_qpair_manual_complete_request(req->qpair, req, NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, TRUE); } - mtx_unlock(&ctrlr->fail_req_lock); + mtx_unlock(&ctrlr->lock); } static int @@ -935,6 +935,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) ctrlr->dev = dev; + mtx_init(&ctrlr->lock, "nvme ctrlr lock", NULL, MTX_DEF); + status = nvme_ctrlr_allocate_bar(ctrlr); if (status != 0) @@ -1033,8 +1035,6 @@ intx: TASK_INIT(&ctrlr->reset_task, 0, nvme_ctrlr_reset_task, ctrlr); TASK_INIT(&ctrlr->fail_req_task, 0, nvme_ctrlr_fail_req_task, ctrlr); - mtx_init(&ctrlr->fail_req_lock, "nvme ctrlr fail req lock", NULL, - MTX_DEF); STAILQ_INIT(&ctrlr->fail_req); ctrlr->is_failed = FALSE; diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index fe3a110..9fbef6d 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -247,6 +247,8 @@ struct nvme_controller { device_t dev; + struct mtx lock; + uint32_t ready_timeout_in_ms; bus_space_tag_t bus_tag; @@ -325,7 +327,6 @@ struct nvme_controller { uint32_t is_resetting; - struct mtx fail_req_lock; boolean_t is_failed; STAILQ_HEAD(, nvme_request) fail_req; |