From owner-svn-src-all@FreeBSD.ORG Fri Apr 12 17:36:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2E2D3BE4; Fri, 12 Apr 2013 17:36:49 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0681A13BF; Fri, 12 Apr 2013 17:36:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3CHamgm089918; Fri, 12 Apr 2013 17:36:48 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3CHamC7089916; Fri, 12 Apr 2013 17:36:48 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201304121736.r3CHamC7089916@svn.freebsd.org> From: Jim Harris Date: Fri, 12 Apr 2013 17:36:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249417 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2013 17:36:49 -0000 Author: jimharris Date: Fri Apr 12 17:36:48 2013 New Revision: 249417 URL: http://svnweb.freebsd.org/changeset/base/249417 Log: Rename the controller's fail_req_lock, so that it can be used for other locking operations on the controller. Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Fri Apr 12 17:34:49 2013 (r249416) +++ head/sys/dev/nvme/nvme_ctrlr.c Fri Apr 12 17:36:48 2013 (r249417) @@ -307,9 +307,9 @@ nvme_ctrlr_post_failed_request(struct nv 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 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_control 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; Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Fri Apr 12 17:34:49 2013 (r249416) +++ head/sys/dev/nvme/nvme_private.h Fri Apr 12 17:36:48 2013 (r249417) @@ -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;