Some microoptimizations.
MFC after: 1 month
This commit is contained in:
parent
8592f07464
commit
315a4d6fb4
@ -894,7 +894,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);
|
||||
}
|
||||
}
|
||||
@ -926,16 +926,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1149,6 +1146,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);
|
||||
@ -1166,7 +1164,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");
|
||||
@ -1197,7 +1195,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);
|
||||
@ -1373,7 +1371,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++;
|
||||
}
|
||||
@ -6042,7 +6040,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;
|
||||
|
@ -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))
|
||||
|
||||
@ -164,6 +164,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;
|
||||
|
Loading…
Reference in New Issue
Block a user