MFprojects/camlock r248982:

Stop abusing xpt_periph in random plases that really have no periph related
to CCB, for example, bus scanning.  NULL value is fine in such cases and it
is correctly logged in debug messages as "noperiph".  If at some point we
need some real XPT periphs (alike to pmpX now), quite likely they will be
per-bus, and not a single global instance as xpt_periph now.
This commit is contained in:
Alexander Motin 2013-04-14 09:55:48 +00:00
parent cccf422080
commit e5dfa058da
24 changed files with 39 additions and 37 deletions

View File

@ -1439,7 +1439,7 @@ ata_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
scan_info->counter = (scan_info->counter + 1 ) %
(scan_info->cpi->max_target + 1);
scan_next:
status = xpt_create_path(&path, xpt_periph,
status = xpt_create_path(&path, NULL,
scan_info->request_ccb->ccb_h.path_id,
scan_info->counter, 0);
if (status != CAM_REQ_CMP) {
@ -1497,7 +1497,7 @@ ata_scan_lun(struct cam_periph *periph, struct cam_path *path,
"can't continue\n");
return;
}
status = xpt_create_path(&new_path, xpt_periph,
status = xpt_create_path(&new_path, NULL,
path->bus->path_id,
path->target->target_id,
path->device->lun_id);

View File

@ -451,7 +451,7 @@ xptioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td
* Create a path using the bus, target, and lun the
* user passed in.
*/
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb->ccb_h.path, NULL,
inccb->ccb_h.path_id,
inccb->ccb_h.target_id,
inccb->ccb_h.target_lun) !=
@ -487,7 +487,7 @@ xptioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td
* Create a path using the bus, target, and lun the
* user passed in.
*/
if (xpt_create_path(&ccb.ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb.ccb_h.path, NULL,
inccb->ccb_h.path_id,
inccb->ccb_h.target_id,
inccb->ccb_h.target_lun) !=
@ -2918,7 +2918,7 @@ xpt_action_default(union ccb *start_ccb)
CAM_SIM_LOCK(xpt_path_sim(start_ccb->ccb_h.path));
}
if (start_ccb->cdbg.flags != CAM_DEBUG_NONE) {
if (xpt_create_path(&cam_dpath, xpt_periph,
if (xpt_create_path(&cam_dpath, NULL,
start_ccb->ccb_h.path_id,
start_ccb->ccb_h.target_id,
start_ccb->ccb_h.target_lun) !=
@ -4640,7 +4640,7 @@ xpt_config(void *arg)
/* Setup debugging path */
if (cam_dflags != CAM_DEBUG_NONE) {
if (xpt_create_path_unlocked(&cam_dpath, xpt_periph,
if (xpt_create_path_unlocked(&cam_dpath, NULL,
CAM_DEBUG_BUS, CAM_DEBUG_TARGET,
CAM_DEBUG_LUN) != CAM_REQ_CMP) {
printf("xpt_config: xpt_create_path() failed for debug"

View File

@ -311,7 +311,7 @@ cfcs_onoffline(void *arg, int online)
goto bailout;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(softc->sim), CAM_TARGET_WILDCARD,
CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
printf("%s: can't allocate path for rescan\n", __func__);

View File

@ -1953,7 +1953,7 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
if (i == initiator_id)
continue;
status = xpt_create_path(&path, xpt_periph,
status = xpt_create_path(&path, NULL,
request_ccb->ccb_h.path_id,
i, 0);
if (status != CAM_REQ_CMP) {
@ -2154,7 +2154,7 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
xpt_free_ccb(request_ccb);
break;
}
status = xpt_create_path(&path, xpt_periph,
status = xpt_create_path(&path, NULL,
scan_info->request_ccb->ccb_h.path_id,
scan_info->counter, 0);
if (status != CAM_REQ_CMP) {
@ -2177,7 +2177,7 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
request_ccb->crcn.flags =
scan_info->request_ccb->crcn.flags;
} else {
status = xpt_create_path(&path, xpt_periph,
status = xpt_create_path(&path, NULL,
path_id, target_id, lun_id);
/*
* Free the old request path- we're done with it. We
@ -2250,7 +2250,7 @@ scsi_scan_lun(struct cam_periph *periph, struct cam_path *path,
"can't continue\n");
return;
}
status = xpt_create_path(&new_path, xpt_periph,
status = xpt_create_path(&new_path, NULL,
path->bus->path_id,
path->target->target_id,
path->device->lun_id);

View File

@ -129,7 +129,7 @@ aac_cam_rescan(struct aac_softc *sc, uint32_t channel, uint32_t target_id)
return;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(camsc->sim),
target_id, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xpt_free_ccb(ccb);

View File

@ -1599,7 +1599,8 @@ static void arcmsr_rescan_lun(struct AdapterControlBlock *acb, int target, int l
if ((ccb = (union ccb *)xpt_alloc_ccb_nowait()) == NULL)
return;
if (xpt_create_path(&path, xpt_periph, cam_sim_path(acb->psim), target, lun) != CAM_REQ_CMP)
if (xpt_create_path(&path, NULL, cam_sim_path(acb->psim), target, lun)
!= CAM_REQ_CMP)
{
xpt_free_ccb(ccb);
return;

View File

@ -2913,7 +2913,7 @@ ciss_cam_rescan_target(struct ciss_softc *sc, int bus, int target)
return;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(sc->ciss_cam_sim[bus]),
target, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
ciss_printf(sc, "rescan failed (can't create path)\n");

View File

@ -1086,7 +1086,7 @@ END_DEBUG
sbp_xfer_free(xfer);
if (sdev->path == NULL)
xpt_create_path(&sdev->path, xpt_periph,
xpt_create_path(&sdev->path, NULL,
cam_sim_path(target->sbp->sim),
target->target_id, sdev->lun_id);
@ -2039,7 +2039,7 @@ END_DEBUG
if (xpt_bus_register(sbp->sim, dev, /*bus*/0) != CAM_SUCCESS)
goto fail;
if (xpt_create_path(&sbp->path, xpt_periph, cam_sim_path(sbp->sim),
if (xpt_create_path(&sbp->path, NULL, cam_sim_path(sbp->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xpt_bus_deregister(cam_sim_path(sbp->sim));
goto fail;

View File

@ -1347,7 +1347,7 @@ static int hpt_rescan_bus(void)
#endif
ldm_for_each_vbus(vbus, vbus_ext) {
if (xpt_create_path(&path, xpt_periph, cam_sim_path(vbus_ext->sim),
if (xpt_create_path(&path, NULL, cam_sim_path(vbus_ext->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP)
return(EIO);
if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK)) == NULL)

View File

@ -1437,7 +1437,7 @@ static int hptiop_rescan_bus(struct hpt_iop_hba * hba)
if ((ccb = xpt_alloc_ccb()) == NULL)
return(ENOMEM);
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(hba->sim),
if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(hba->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xpt_free_ccb(ccb);
return(EIO);

View File

@ -1355,7 +1355,7 @@ static int hpt_rescan_bus(void)
ldm_for_each_vbus(vbus, vbus_ext) {
if ((ccb = xpt_alloc_ccb()) == NULL)
return(ENOMEM);
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(vbus_ext->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xpt_free_ccb(ccb);

View File

@ -580,7 +580,7 @@ void isci_controller_domain_discovery_complete(
*/
union ccb *ccb = xpt_alloc_ccb_nowait();
xpt_create_path(&ccb->ccb_h.path, xpt_periph,
xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(isci_controller->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);

View File

@ -300,7 +300,7 @@ scif_cb_domain_device_removed(SCI_CONTROLLER_HANDLE_T controller,
isci_controller->remote_device[isci_remote_device->index] = NULL;
xpt_create_path(&ccb->ccb_h.path, xpt_periph, path,
xpt_create_path(&ccb->ccb_h.path, NULL, path,
isci_remote_device->index, CAM_LUN_WILDCARD);
xpt_rescan(ccb);

View File

@ -83,7 +83,7 @@ scif_cb_remote_device_ready(SCI_CONTROLLER_HANDLE_T controller,
*/
union ccb *ccb = xpt_alloc_ccb_nowait();
xpt_create_path(&ccb->ccb_h.path, xpt_periph,
xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(isci_controller->sim),
isci_remote_device->index, CAM_LUN_WILDCARD);
@ -262,7 +262,7 @@ isci_remote_device_freeze_lun_queue(struct ISCI_REMOTE_DEVICE *remote_device,
if (!(remote_device->frozen_lun_mask & (1 << lun))) {
struct cam_path *path;
xpt_create_path(&path, xpt_periph,
xpt_create_path(&path, NULL,
cam_sim_path(remote_device->domain->controller->sim),
remote_device->index, lun);
xpt_freeze_devq(path, 1);
@ -279,7 +279,7 @@ isci_remote_device_release_lun_queue(struct ISCI_REMOTE_DEVICE *remote_device,
struct cam_path *path;
remote_device->frozen_lun_mask &= ~(1 << lun);
xpt_create_path(&path, xpt_periph,
xpt_create_path(&path, NULL,
cam_sim_path(remote_device->domain->controller->sim),
remote_device->index, lun);
xpt_release_devq(path, 1, TRUE);

View File

@ -150,7 +150,7 @@ ic_scan(isc_session_t *sp)
sp->flags |= ISC_SCANWAIT;
CAM_LOCK(sp);
if(xpt_create_path(&sp->cam_path, xpt_periph, cam_sim_path(sp->cam_sim),
if(xpt_create_path(&sp->cam_path, NULL, cam_sim_path(sp->cam_sim),
0, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xdebug("can't create cam path");
CAM_UNLOCK(sp);

View File

@ -4554,7 +4554,8 @@ isp_make_here(ispsoftc_t *isp, int chan, int tgt)
isp_prt(isp, ISP_LOGWARN, "Chan %d unable to alloc CCB for rescan", chan);
return;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(fc->sim), tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(fc->sim),
tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
isp_prt(isp, ISP_LOGWARN, "unable to create path for rescan");
xpt_free_ccb(ccb);
return;

View File

@ -318,7 +318,7 @@ mfip_cam_rescan(struct mfi_softc *sc, uint32_t tid)
}
sim = camsc->sim;
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sim),
if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sim),
tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xpt_free_ccb(ccb);
device_printf(sc->mfi_dev,

View File

@ -2025,7 +2025,7 @@ mly_cam_rescan_btl(struct mly_softc *sc, int bus, int target)
mly_printf(sc, "rescan failed (can't allocate CCB)\n");
return;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(sc->mly_cam_sim[bus]), target, 0) != CAM_REQ_CMP) {
mly_printf(sc, "rescan failed (can't create path)\n");
xpt_free_ccb(ccb);

View File

@ -271,7 +271,7 @@ mpssas_rescan_target(struct mps_softc *sc, struct mpssas_target *targ)
return;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, pathid,
if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid,
targetid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
mps_dprint(sc, MPS_FAULT, "unable to create path for rescan\n");
xpt_free_ccb(ccb);
@ -3318,7 +3318,7 @@ mpssas_check_eedp(struct mpssas_softc *sassc)
return;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb->ccb_h.path, NULL,
pathid, targetid, lunid) != CAM_REQ_CMP) {
mps_dprint(sc, MPS_FAULT, "Unable to create "
"path for EEDP support\n");

View File

@ -2364,7 +2364,7 @@ mpt_cam_event(struct mpt_softc *mpt, request_t *req,
break;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, pathid,
if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid,
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
mpt_prt(mpt, "unable to create path for rescan\n");
xpt_free_ccb(ccb);
@ -2512,7 +2512,7 @@ mpt_cam_event(struct mpt_softc *mpt, request_t *req,
"unable to alloc CCB for rescan\n");
break;
}
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
if (xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(sim), psdsc->TargetID,
CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
mpt_prt(mpt,

View File

@ -705,7 +705,7 @@ mpt_raid_thread(void *arg)
ccb = xpt_alloc_ccb();
MPT_LOCK(mpt);
error = xpt_create_path(&ccb->ccb_h.path, xpt_periph,
error = xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(mpt->phydisk_sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
if (error != CAM_REQ_CMP) {
@ -1662,7 +1662,7 @@ mpt_raid_set_vol_queue_depth(struct mpt_softc *mpt, u_int vol_queue_depth)
mpt->raid_rescan = 0;
error = xpt_create_path(&path, xpt_periph,
error = xpt_create_path(&path, NULL,
cam_sim_path(mpt->sim),
mpt_vol->config_page->VolumeID,
/*lun*/0);

View File

@ -488,7 +488,7 @@ tw_osli_request_bus_scan(struct twa_softc *sc)
if ((ccb = xpt_alloc_ccb()) == NULL)
return(ENOMEM);
mtx_lock(sc->sim_lock);
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim),
if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xpt_free_ccb(ccb);
mtx_unlock(sc->sim_lock);

View File

@ -219,7 +219,7 @@ tws_bus_scan(struct tws_softc *sc)
return(ENXIO);
ccb = xpt_alloc_ccb();
mtx_lock(&sc->sim_lock);
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim),
if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
mtx_unlock(&sc->sim_lock);
xpt_free_ccb(ccb);

View File

@ -1702,7 +1702,7 @@ vtscsi_execute_rescan(struct vtscsi_softc *sc, target_id_t target_id,
return;
}
status = xpt_create_path(&ccb->ccb_h.path, xpt_periph,
status = xpt_create_path(&ccb->ccb_h.path, NULL,
cam_sim_path(sc->vtscsi_sim), target_id, lun_id);
if (status != CAM_REQ_CMP) {
xpt_free_ccb(ccb);