From owner-svn-src-head@FreeBSD.ORG Thu Sep 2 14:13:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BC9910656F0; Thu, 2 Sep 2010 14:13:44 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AC738FC22; Thu, 2 Sep 2010 14:13:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82EDhL5007042; Thu, 2 Sep 2010 14:13:43 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82EDhBg007039; Thu, 2 Sep 2010 14:13:43 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201009021413.o82EDhBg007039@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 2 Sep 2010 14:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212149 - head/sys/dev/iscsi/initiator X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 14:13:44 -0000 Author: des Date: Thu Sep 2 14:13:43 2010 New Revision: 212149 URL: http://svn.freebsd.org/changeset/base/212149 Log: Remove the freelist, which simply duplicates some of the zone allocator's functionality. Submitted by: Daniel Braniss MFC after: 3 weeks Modified: head/sys/dev/iscsi/initiator/iscsi.c head/sys/dev/iscsi/initiator/iscsivar.h Modified: head/sys/dev/iscsi/initiator/iscsi.c ============================================================================== --- head/sys/dev/iscsi/initiator/iscsi.c Thu Sep 2 14:05:32 2010 (r212148) +++ head/sys/dev/iscsi/initiator/iscsi.c Thu Sep 2 14:13:43 2010 (r212149) @@ -295,12 +295,6 @@ iscsi_read(struct cdev *dev, struct uio sprintf(buf, "%d/%d /---- free -----/\n", sc->npdu_alloc, sc->npdu_max); i = 0; uiomove(buf, strlen(buf), uio); - TAILQ_FOREACH(pq, &sc->freepdu, pq_link) { - if(uio->uio_resid == 0) - return 0; - sprintf(buf, "%03d] %06x\n", i++, ntohl(pq->pdu.ipdu.bhs.itt)); - uiomove(buf, strlen(buf), uio); - } } else { int i = 0; @@ -704,15 +698,10 @@ iscsi_shutdown(void *v) static void free_pdus(struct isc_softc *sc) { - pduq_t *pq; debug_called(8); if(sc->pdu_zone != NULL) { - TAILQ_FOREACH(pq, &sc->freepdu, pq_link) { - TAILQ_REMOVE(&sc->freepdu, pq, pq_link); - uma_zfree(sc->pdu_zone, pq); - } uma_zdestroy(sc->pdu_zone); sc->pdu_zone = NULL; } @@ -730,7 +719,6 @@ iscsi_start(void) isc->dev = make_dev(&iscsi_cdevsw, max_sessions, UID_ROOT, GID_WHEEL, 0600, "iscsi"); isc->dev->si_drv1 = isc; mtx_init(&isc->isc_mtx, "iscsi", NULL, MTX_DEF); - mtx_init(&isc->pdu_mtx, "iscsi pdu pool", NULL, MTX_DEF); TAILQ_INIT(&isc->isc_sess); /* @@ -744,7 +732,6 @@ iscsi_start(void) // XXX: should fail... } uma_zone_set_max(isc->pdu_zone, max_pdus); - TAILQ_INIT(&isc->freepdu); isc->unit = new_unrhdr(0, max_sessions-1, NULL); sx_init(&isc->unit_sx, "iscsi sx"); @@ -818,7 +805,6 @@ iscsi_stop(void) ic_destroy(sp); } mtx_destroy(&isc->isc_mtx); - mtx_destroy(&isc->pdu_mtx); sx_destroy(&isc->unit_sx); free_pdus(isc); Modified: head/sys/dev/iscsi/initiator/iscsivar.h ============================================================================== --- head/sys/dev/iscsi/initiator/iscsivar.h Thu Sep 2 14:05:32 2010 (r212148) +++ head/sys/dev/iscsi/initiator/iscsivar.h Thu Sep 2 14:13:43 2010 (r212149) @@ -203,10 +203,7 @@ struct isc_softc { struct unrhdr *unit; struct sx unit_sx; - struct mtx pdu_mtx; uma_zone_t pdu_zone; // pool of free pdu's - TAILQ_HEAD(,pduq) freepdu; - #ifdef ISCSI_INITIATOR_DEBUG int npdu_alloc, npdu_max; // for instrumentation #endif @@ -303,25 +300,15 @@ pdu_alloc(struct isc_softc *isc, int wai { pduq_t *pq; - mtx_lock(&isc->pdu_mtx); - if((pq = TAILQ_FIRST(&isc->freepdu)) == NULL) { - mtx_unlock(&isc->pdu_mtx); - pq = (pduq_t *)uma_zalloc(isc->pdu_zone, wait /* M_WAITOK or M_NOWAIT*/); - } - else { - TAILQ_REMOVE(&isc->freepdu, pq, pq_link); - mtx_unlock(&isc->pdu_mtx); - } + pq = (pduq_t *)uma_zalloc(isc->pdu_zone, wait /* M_WAITOK or M_NOWAIT*/); if(pq == NULL) { debug(7, "out of mem"); return NULL; } #ifdef ISCSI_INITIATOR_DEBUG - mtx_lock(&isc->pdu_mtx); isc->npdu_alloc++; if(isc->npdu_alloc > isc->npdu_max) isc->npdu_max = isc->npdu_alloc; - mtx_unlock(&isc->pdu_mtx); #endif memset(pq, 0, sizeof(pduq_t)); @@ -337,12 +324,10 @@ pdu_free(struct isc_softc *isc, pduq_t * if(pq->buf != NULL) free(pq->buf, M_ISCSIBUF); #endif - mtx_lock(&isc->pdu_mtx); - TAILQ_INSERT_TAIL(&isc->freepdu, pq, pq_link); #ifdef ISCSI_INITIATOR_DEBUG isc->npdu_alloc--; #endif - mtx_unlock(&isc->pdu_mtx); + uma_zfree(isc->pdu_zone, pq); } static __inline void