From owner-svn-src-all@FreeBSD.ORG Fri Dec 26 09:11:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D12CF237; Fri, 26 Dec 2014 09:11:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 BC2F466714; Fri, 26 Dec 2014 09:11:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBQ9BRY4085303; Fri, 26 Dec 2014 09:11:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBQ9BRxt085300; Fri, 26 Dec 2014 09:11:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201412260911.sBQ9BRxt085300@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 26 Dec 2014 09:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r276233 - stable/10/sys/dev/isp X-SVN-Group: stable-10 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.18-1 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, 26 Dec 2014 09:11:28 -0000 Author: mav Date: Fri Dec 26 09:11:26 2014 New Revision: 276233 URL: https://svnweb.freebsd.org/changeset/base/276233 Log: MFC r275118: Some microoptimizations. Modified: stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_freebsd.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Fri Dec 26 09:09:50 2014 (r276232) +++ stable/10/sys/dev/isp/isp_freebsd.c Fri Dec 26 09:11:26 2014 (r276233) @@ -877,7 +877,7 @@ is_lun_enabled(ispsoftc_t *isp, int bus, ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp); SLIST_FOREACH(tptr, lhp, next) { - if (xpt_path_lun_id(tptr->owner) == lun) { + if (tptr->ts_lun == lun) { return (1); } } @@ -909,16 +909,13 @@ get_lun_statep(ispsoftc_t *isp, int bus, { tstate_t *tptr = NULL; struct tslist *lhp; - int i; if (bus < isp->isp_nchan) { - for (i = 0; i < LUN_HASH_SIZE; i++) { - ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp); - SLIST_FOREACH(tptr, lhp, next) { - if (xpt_path_lun_id(tptr->owner) == lun) { - tptr->hold++; - return (tptr); - } + ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp); + SLIST_FOREACH(tptr, lhp, next) { + if (tptr->ts_lun == lun) { + tptr->hold++; + return (tptr); } } } @@ -1132,6 +1129,7 @@ create_lun_state(ispsoftc_t *isp, int bu if (tptr == NULL) { return (CAM_RESRC_UNAVAIL); } + tptr->ts_lun = lun; status = xpt_create_path(&tptr->owner, NULL, xpt_path_path_id(path), xpt_path_target_id(path), lun); if (status != CAM_REQ_CMP) { free(tptr, M_DEVBUF); @@ -1149,7 +1147,7 @@ create_lun_state(ispsoftc_t *isp, int bu tptr->ntpool[i].next = &tptr->ntpool[i+1]; tptr->ntfree = tptr->ntpool; tptr->hold = 1; - ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp); + ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp); SLIST_INSERT_HEAD(lhp, tptr, next); *rslt = tptr; ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, path, "created tstate\n"); @@ -1180,7 +1178,7 @@ destroy_lun_state(ispsoftc_t *isp, tstat xpt_done(ccb); } } while (ccb); - ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp); + ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(tptr->ts_lun)], lhp); SLIST_REMOVE(lhp, tptr, tstate, next); ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "destroyed tstate\n"); xpt_free_path(tptr->owner); @@ -1356,7 +1354,7 @@ isp_enable_deferred_luns(ispsoftc_t *isp SLIST_FOREACH(tptr, lhp, next) { tptr->hold++; if (tptr->enabled == 0) { - if (isp_enable_deferred(isp, bus, xpt_path_lun_id(tptr->owner)) == CAM_REQ_CMP) { + if (isp_enable_deferred(isp, bus, tptr->ts_lun) == CAM_REQ_CMP) { tptr->enabled = 1; n++; } @@ -6011,7 +6009,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm */ tptr = get_lun_statep_from_tag(isp, chan, abts->abts_rxid_task); if (tptr) { - nt->nt_lun = xpt_path_lun_id(tptr->owner); + nt->nt_lun = tptr->ts_lun; rls_lun_statep(isp, tptr); } else { nt->nt_lun = LUN_ANY; Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Fri Dec 26 09:09:50 2014 (r276232) +++ stable/10/sys/dev/isp/isp_freebsd.h Fri Dec 26 09:11:26 2014 (r276233) @@ -95,7 +95,7 @@ void isp_put_ecmd(struct ispsoftc *, is #define ISP_TARGET_FUNCTIONS 1 #define ATPDPSIZE 4096 -#define ATPDPHASHSIZE 16 +#define ATPDPHASHSIZE 32 #define ATPDPHASH(x) ((((x) >> 24) ^ ((x) >> 16) ^ ((x) >> 8) ^ (x)) & \ ((ATPDPHASHSIZE) - 1)) @@ -163,6 +163,7 @@ typedef struct isp_timed_notify_ack { TAILQ_HEAD(isp_ccbq, ccb_hdr); typedef struct tstate { SLIST_ENTRY(tstate) next; + lun_id_t ts_lun; struct cam_path *owner; struct isp_ccbq waitq; /* waiting CCBs */ struct ccb_hdr_slist atios;