From owner-svn-src-stable@freebsd.org Fri Mar 24 06:59:42 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3267AD1B7E1; Fri, 24 Mar 2017 06:59:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 075F31840; Fri, 24 Mar 2017 06:59:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2O6xf8P053325; Fri, 24 Mar 2017 06:59:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2O6xfTt053324; Fri, 24 Mar 2017 06:59:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703240659.v2O6xfTt053324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 24 Mar 2017 06:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315886 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2017 06:59:42 -0000 Author: mav Date: Fri Mar 24 06:59:40 2017 New Revision: 315886 URL: https://svnweb.freebsd.org/changeset/base/315886 Log: MFC r315025: Switch work_queue from TAILQ to STAILQ. It is mostly FIFO and we don't need random removal there. Modified: stable/11/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/11/sys/cam/ctl/scsi_ctl.c Fri Mar 24 03:37:58 2017 (r315885) +++ stable/11/sys/cam/ctl/scsi_ctl.c Fri Mar 24 06:59:40 2017 (r315886) @@ -105,7 +105,7 @@ struct ctlfe_lun_softc { int atios_alloced; /* Number of ATIOs not freed */ int inots_alloced; /* Number of INOTs not freed */ struct task refdrain_task; - TAILQ_HEAD(, ccb_hdr) work_queue; + STAILQ_HEAD(, ccb_hdr) work_queue; STAILQ_ENTRY(ctlfe_lun_softc) links; }; @@ -449,7 +449,7 @@ ctlferegister(struct cam_periph *periph, softc = (struct ctlfe_lun_softc *)arg; bus_softc = softc->parent_softc; - TAILQ_INIT(&softc->work_queue); + STAILQ_INIT(&softc->work_queue); softc->periph = periph; periph->softc = softc; @@ -738,14 +738,13 @@ ctlfestart(struct cam_periph *periph, un softc = (struct ctlfe_lun_softc *)periph->softc; next: - ccb_h = TAILQ_FIRST(&softc->work_queue); + /* Take the ATIO off the work queue */ + ccb_h = STAILQ_FIRST(&softc->work_queue); if (ccb_h == NULL) { xpt_release_ccb(start_ccb); return; } - - /* Take the ATIO off the work queue */ - TAILQ_REMOVE(&softc->work_queue, ccb_h, periph_links.tqe); + STAILQ_REMOVE_HEAD(&softc->work_queue, periph_links.stqe); atio = (struct ccb_accept_tio *)ccb_h; io = (union ctl_io *)ccb_h->io_ptr; csio = &start_ccb->csio; @@ -870,7 +869,7 @@ next: /* * If we still have work to do, ask for another CCB. */ - if (!TAILQ_EMPTY(&softc->work_queue)) + if (!STAILQ_EMPTY(&softc->work_queue)) xpt_schedule(periph, CAM_PRIORITY_NORMAL); } @@ -1196,8 +1195,8 @@ ctlfedone(struct cam_periph *periph, uni io->scsiio.io_hdr.status = CTL_STATUS_NONE; io->io_hdr.flags |= CTL_FLAG_DMA_QUEUED; xpt_release_ccb(done_ccb); - TAILQ_INSERT_HEAD(&softc->work_queue, &atio->ccb_h, - periph_links.tqe); + STAILQ_INSERT_HEAD(&softc->work_queue, &atio->ccb_h, + periph_links.stqe); xpt_schedule(periph, CAM_PRIORITY_NORMAL); break; } @@ -1812,7 +1811,7 @@ ctlfe_dump_queue(struct ctlfe_lun_softc periph = softc->periph; num_items = 0; - TAILQ_FOREACH(hdr, &softc->work_queue, periph_links.tqe) { + STAILQ_FOREACH(hdr, &softc->work_queue, periph_links.stqe) { union ctl_io *io = hdr->io_ptr; num_items++; @@ -1867,8 +1866,8 @@ ctlfe_datamove(union ctl_io *io) io->io_hdr.flags |= CTL_FLAG_DMA_QUEUED; if ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE) io->io_hdr.flags |= CTL_FLAG_STATUS_QUEUED; - TAILQ_INSERT_TAIL(&softc->work_queue, &ccb->ccb_h, - periph_links.tqe); + STAILQ_INSERT_TAIL(&softc->work_queue, &ccb->ccb_h, + periph_links.stqe); xpt_schedule(periph, CAM_PRIORITY_NORMAL); cam_periph_unlock(periph); } @@ -1920,8 +1919,8 @@ ctlfe_done(union ctl_io *io) return; } else { io->io_hdr.flags |= CTL_FLAG_STATUS_QUEUED; - TAILQ_INSERT_TAIL(&softc->work_queue, &ccb->ccb_h, - periph_links.tqe); + STAILQ_INSERT_TAIL(&softc->work_queue, &ccb->ccb_h, + periph_links.stqe); xpt_schedule(periph, CAM_PRIORITY_NORMAL); }