Small UA cleanup.

This commit is contained in:
Alexander Motin 2015-09-03 12:56:57 +00:00
parent 8be6a2df51
commit 420abfcecd
3 changed files with 16 additions and 32 deletions

View File

@ -437,7 +437,7 @@ static int ctl_scsiio_lun_check(struct ctl_lun *lun,
#ifdef notyet
static void ctl_failover(void);
#endif
static void ctl_clear_ua(struct ctl_softc *ctl_softc, uint32_t initidx,
static void ctl_clr_ua_allluns(struct ctl_softc *ctl_softc, uint32_t initidx,
ctl_ua_type ua_type);
static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc,
struct ctl_scsiio *ctsio);
@ -1012,6 +1012,20 @@ ctl_clr_ua_all(struct ctl_lun *lun, uint32_t except, ctl_ua_type ua)
}
}
static void
ctl_clr_ua_allluns(struct ctl_softc *ctl_softc, uint32_t initidx,
ctl_ua_type ua_type)
{
struct ctl_lun *lun;
mtx_assert(&ctl_softc->ctl_lock, MA_OWNED);
STAILQ_FOREACH(lun, &ctl_softc->lun_list, links) {
mtx_lock(&lun->lun_lock);
ctl_clr_ua(lun, initidx, ua_type);
mtx_unlock(&lun->lun_lock);
}
}
static int
ctl_ha_state_sysctl(SYSCTL_HANDLER_ARGS)
{
@ -9100,7 +9114,7 @@ ctl_request_sense(struct ctl_scsiio *ctsio)
if (ua_type == CTL_UA_LUN_CHANGE) {
mtx_unlock(&lun->lun_lock);
mtx_lock(&ctl_softc->ctl_lock);
ctl_clear_ua(ctl_softc, initidx, ua_type);
ctl_clr_ua_allluns(ctl_softc, initidx, ua_type);
mtx_unlock(&ctl_softc->ctl_lock);
mtx_lock(&lun->lun_lock);
}
@ -11088,24 +11102,6 @@ ctl_failover(void)
}
#endif
static void
ctl_clear_ua(struct ctl_softc *ctl_softc, uint32_t initidx,
ctl_ua_type ua_type)
{
struct ctl_lun *lun;
ctl_ua_type *pu;
mtx_assert(&ctl_softc->ctl_lock, MA_OWNED);
STAILQ_FOREACH(lun, &ctl_softc->lun_list, links) {
mtx_lock(&lun->lun_lock);
pu = lun->pending_ua[initidx / CTL_MAX_INIT_PER_PORT];
if (pu != NULL)
pu[initidx % CTL_MAX_INIT_PER_PORT] &= ~ua_type;
mtx_unlock(&lun->lun_lock);
}
}
static int
ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio)
{

View File

@ -120,8 +120,6 @@ typedef enum {
CTL_UA_LUN_CHANGE = 0x0020,
CTL_UA_MODE_CHANGE = 0x0040,
CTL_UA_LOG_CHANGE = 0x0080,
CTL_UA_LVD = 0x0100,
CTL_UA_SE = 0x0200,
CTL_UA_RES_PREEMPT = 0x0400,
CTL_UA_RES_RELEASE = 0x0800,
CTL_UA_REG_PREEMPT = 0x1000,

View File

@ -446,16 +446,6 @@ ctl_build_ua(struct ctl_lun *lun, uint32_t initidx,
asc = 0x2A;
ascq = 0x02;
break;
case CTL_UA_LVD:
/* 29h/06h TRANSCEIVER MODE CHANGED TO LVD */
asc = 0x29;
ascq = 0x06;
break;
case CTL_UA_SE:
/* 29h/05h TRANSCEIVER MODE CHANGED TO SINGLE-ENDED */
asc = 0x29;
ascq = 0x05;
break;
case CTL_UA_RES_PREEMPT:
/* 2Ah/03h RESERVATIONS PREEMPTED */
asc = 0x2A;