diff options
author | jhb <jhb@FreeBSD.org> | 2009-01-26 15:01:47 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-01-26 15:01:47 +0000 |
commit | d8fdc0e7be3a628277e6edb9805f7ab408bfe0a9 (patch) | |
tree | 7609f5293a98b88bdf6ba0f00a43a9970c2dabad /sys/cam | |
parent | 13afe7a515aca0c4f80418e5107b820e288edba1 (diff) | |
download | FreeBSD-src-d8fdc0e7be3a628277e6edb9805f7ab408bfe0a9.zip FreeBSD-src-d8fdc0e7be3a628277e6edb9805f7ab408bfe0a9.tar.gz |
Now that mtx_sleep/msleep can accept Giant as the interlock, simplify the
CAM locking code slightly to no longer special case sleeping when a sim
uses Giant for its lock.
Tested by: trasz
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/cam_periph.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 9fdc112..6292382 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -326,7 +326,6 @@ cam_periph_release(struct cam_periph *periph) int cam_periph_hold(struct cam_periph *periph, int priority) { - struct mtx *mtx; int error; /* @@ -339,14 +338,11 @@ cam_periph_hold(struct cam_periph *periph, int priority) if (cam_periph_acquire(periph) != CAM_REQ_CMP) return (ENXIO); - mtx = periph->sim->mtx; - mtx_assert(mtx, MA_OWNED); - if (mtx == &Giant) - mtx = NULL; - + mtx_assert(periph->sim->mtx, MA_OWNED); while ((periph->flags & CAM_PERIPH_LOCKED) != 0) { periph->flags |= CAM_PERIPH_LOCK_WANTED; - if ((error = msleep(periph, mtx, priority, "caplck", 0)) != 0) { + if ((error = mtx_sleep(periph, periph->sim->mtx, priority, + "caplck", 0)) != 0) { cam_periph_release_locked(periph); return (error); } @@ -767,7 +763,6 @@ union ccb * cam_periph_getccb(struct cam_periph *periph, u_int32_t priority) { struct ccb_hdr *ccb_h; - struct mtx *mtx; mtx_assert(periph->sim->mtx, MA_OWNED); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdgetccb\n")); @@ -780,11 +775,8 @@ cam_periph_getccb(struct cam_periph *periph, u_int32_t priority) && (SLIST_FIRST(&periph->ccb_list)->pinfo.priority == priority)) break; mtx_assert(periph->sim->mtx, MA_OWNED); - if (periph->sim->mtx == &Giant) - mtx = NULL; - else - mtx = periph->sim->mtx; - msleep(&periph->ccb_list, mtx, PRIBIO, "cgticb", 0); + mtx_sleep(&periph->ccb_list, periph->sim->mtx, PRIBIO, "cgticb", + 0); } ccb_h = SLIST_FIRST(&periph->ccb_list); @@ -795,17 +787,12 @@ cam_periph_getccb(struct cam_periph *periph, u_int32_t priority) void cam_periph_ccbwait(union ccb *ccb) { - struct mtx *mtx; struct cam_sim *sim; sim = xpt_path_sim(ccb->ccb_h.path); - if (sim->mtx == &Giant) - mtx = NULL; - else - mtx = sim->mtx; if ((ccb->ccb_h.pinfo.index != CAM_UNQUEUED_INDEX) || ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG)) - msleep(&ccb->ccb_h.cbfcnp, mtx, PRIBIO, "cbwait", 0); + mtx_sleep(&ccb->ccb_h.cbfcnp, sim->mtx, PRIBIO, "cbwait", 0); } int |