diff options
author | jhb <jhb@FreeBSD.org> | 2008-07-21 18:43:02 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-07-21 18:43:02 +0000 |
commit | 6b7ad7a6fa73fc82b8292f2faf9eeeb0c108d2df (patch) | |
tree | f91322aeb8af3a621e3e14c80cd0b633921b4c54 /sys/dev/mpt/mpt_raid.c | |
parent | d9075774c1c2d85def715b4e7578f03ace8b233f (diff) | |
download | FreeBSD-src-6b7ad7a6fa73fc82b8292f2faf9eeeb0c108d2df.zip FreeBSD-src-6b7ad7a6fa73fc82b8292f2faf9eeeb0c108d2df.tar.gz |
Allocate a single CCB at the start of the main loop of the RAID monitoring
kthread of the mpt(4) driver that hangs around for the entire lifetime of
the thread. Previously the driver would allocate a new CCB using M_WAITOK
with a lock held each time it updated its state. While here, use the
CAM API for allocating a CCB rather than raw malloc(9).
Reviewed by: scottl
MFC after: 1 week
Diffstat (limited to 'sys/dev/mpt/mpt_raid.c')
-rw-r--r-- | sys/dev/mpt/mpt_raid.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/mpt/mpt_raid.c b/sys/dev/mpt/mpt_raid.c index 2b7c129..cde0fec 100644 --- a/sys/dev/mpt/mpt_raid.c +++ b/sys/dev/mpt/mpt_raid.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include <cam/cam.h> #include <cam/cam_ccb.h> #include <cam/cam_sim.h> +#include <cam/cam_xpt_periph.h> #include <cam/cam_xpt_sim.h> #if __FreeBSD_version < 500000 @@ -657,17 +658,18 @@ static void mpt_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb) { xpt_free_path(ccb->ccb_h.path); - free(ccb, M_DEVBUF); } static void mpt_raid_thread(void *arg) { struct mpt_softc *mpt; + union ccb *ccb; int firstrun; mpt = (struct mpt_softc *)arg; firstrun = 1; + ccb = xpt_alloc_ccb(); MPT_LOCK(mpt); while (mpt->shutdwn_raid == 0) { @@ -695,18 +697,15 @@ mpt_raid_thread(void *arg) } if (mpt->raid_rescan != 0) { - union ccb *ccb; struct cam_path *path; int error; mpt->raid_rescan = 0; - ccb = malloc(sizeof(*ccb), M_DEVBUF, M_WAITOK); error = xpt_create_path(&path, xpt_periph, cam_sim_path(mpt->phydisk_sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); if (error != CAM_REQ_CMP) { - free(ccb, M_DEVBUF); mpt_prt(mpt, "Unable to rescan RAID Bus!\n"); } else { xpt_setup_ccb(&ccb->ccb_h, path, 5); @@ -719,6 +718,7 @@ mpt_raid_thread(void *arg) } } } + xpt_free_ccb(ccb); mpt->raid_thread = NULL; wakeup(&mpt->raid_thread); MPT_UNLOCK(mpt); |