summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-12-26 09:11:26 +0000
committermav <mav@FreeBSD.org>2014-12-26 09:11:26 +0000
commit529f85a6e8e7eb496541d102c3dcff146cc9ab3c (patch)
tree97fc97c4a12c115a8a7f94ed6f24119feb39c8ae /sys/dev
parent28baac29e7d8b3754f2899fcdef2727decdddef9 (diff)
downloadFreeBSD-src-529f85a6e8e7eb496541d102c3dcff146cc9ab3c.zip
FreeBSD-src-529f85a6e8e7eb496541d102c3dcff146cc9ab3c.tar.gz
MFC r275118: Some microoptimizations.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isp/isp_freebsd.c24
-rw-r--r--sys/dev/isp/isp_freebsd.h3
2 files changed, 13 insertions, 14 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 32060ca..0e4b675 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -877,7 +877,7 @@ is_lun_enabled(ispsoftc_t *isp, int bus, lun_id_t lun)
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, lun_id_t lun)
{
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 bus, struct cam_path *path, tstate_t **rsl
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 bus, struct cam_path *path, tstate_t **rsl
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, tstate_t *tptr)
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, int bus)
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 cmd, ...)
*/
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;
diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h
index 2ab7752..76ae679 100644
--- a/sys/dev/isp/isp_freebsd.h
+++ b/sys/dev/isp/isp_freebsd.h
@@ -95,7 +95,7 @@ void isp_put_ecmd(struct ispsoftc *, isp_ecmd_t *);
#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;
OpenPOWER on IntegriCloud