Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cam/cam_xpt.c
Show First 20 Lines • Show All 5,368 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
return (&path->device->device_mtx); | return (&path->device->device_mtx); | ||||
} | } | ||||
static void | static void | ||||
xpt_done_process(struct ccb_hdr *ccb_h) | xpt_done_process(struct ccb_hdr *ccb_h) | ||||
{ | { | ||||
struct cam_sim *sim; | struct cam_sim *sim = NULL; | ||||
struct cam_devq *devq; | struct cam_devq *devq = NULL; | ||||
struct mtx *mtx = NULL; | struct mtx *mtx = NULL; | ||||
#if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) | #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) | ||||
struct ccb_scsiio *csio; | struct ccb_scsiio *csio; | ||||
if (ccb_h->func_code == XPT_SCSI_IO) { | if (ccb_h->func_code == XPT_SCSI_IO) { | ||||
csio = &((union ccb *)ccb_h)->csio; | csio = &((union ccb *)ccb_h)->csio; | ||||
if (csio->bio != NULL) | if (csio->bio != NULL) | ||||
Show All 26 Lines | if (device != NULL) { | ||||
mtx_lock(&device->sim->devq->send_mtx); | mtx_lock(&device->sim->devq->send_mtx); | ||||
xpt_release_devq_device(device, | xpt_release_devq_device(device, | ||||
/*count*/1, /*runqueue*/TRUE); | /*count*/1, /*runqueue*/TRUE); | ||||
mtx_unlock(&device->sim->devq->send_mtx); | mtx_unlock(&device->sim->devq->send_mtx); | ||||
} else | } else | ||||
mtx_unlock(&xsoftc.xpt_highpower_lock); | mtx_unlock(&xsoftc.xpt_highpower_lock); | ||||
} | } | ||||
/* | |||||
* Insulate against a race where the periph is destroyed | |||||
* but CCBs are still not all processed. | |||||
*/ | |||||
if (ccb_h->path->bus) | |||||
sim = ccb_h->path->bus->sim; | sim = ccb_h->path->bus->sim; | ||||
if (ccb_h->status & CAM_RELEASE_SIMQ) { | if (ccb_h->status & CAM_RELEASE_SIMQ) { | ||||
KASSERT(sim, ("sim missing for CAM_RELEASE_SIMQ request")); | |||||
xpt_release_simq(sim, /*run_queue*/FALSE); | xpt_release_simq(sim, /*run_queue*/FALSE); | ||||
ccb_h->status &= ~CAM_RELEASE_SIMQ; | ccb_h->status &= ~CAM_RELEASE_SIMQ; | ||||
} | } | ||||
if ((ccb_h->flags & CAM_DEV_QFRZDIS) | if ((ccb_h->flags & CAM_DEV_QFRZDIS) | ||||
&& (ccb_h->status & CAM_DEV_QFRZN)) { | && (ccb_h->status & CAM_DEV_QFRZN)) { | ||||
xpt_release_devq(ccb_h->path, /*count*/1, /*run_queue*/TRUE); | xpt_release_devq(ccb_h->path, /*count*/1, /*run_queue*/TRUE); | ||||
ccb_h->status &= ~CAM_DEV_QFRZN; | ccb_h->status &= ~CAM_DEV_QFRZN; | ||||
} | } | ||||
devq = sim->devq; | |||||
if ((ccb_h->func_code & XPT_FC_USER_CCB) == 0) { | if ((ccb_h->func_code & XPT_FC_USER_CCB) == 0) { | ||||
struct cam_ed *dev = ccb_h->path->device; | struct cam_ed *dev = ccb_h->path->device; | ||||
if (sim) | |||||
devq = sim->devq; | |||||
KASSERT(devq, ("sim missing for XPT_FC_USER_CCB request")); | |||||
mtx_lock(&devq->send_mtx); | mtx_lock(&devq->send_mtx); | ||||
devq->send_active--; | devq->send_active--; | ||||
devq->send_openings++; | devq->send_openings++; | ||||
cam_ccbq_ccb_done(&dev->ccbq, (union ccb *)ccb_h); | cam_ccbq_ccb_done(&dev->ccbq, (union ccb *)ccb_h); | ||||
if (((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 | if (((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 | ||||
&& (dev->ccbq.dev_active == 0))) { | && (dev->ccbq.dev_active == 0))) { | ||||
▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines |