Date: Mon, 15 May 2006 15:14:54 GMT From: Scott Long <scottl@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 97195 for review Message-ID: <200605151514.k4FFEsTr097766@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=97195 Change 97195 by scottl@scottl-x64 on 2006/05/15 15:14:27 Convert sim object to use a callout. The old callout_handle was only initalized and never actually used, but it might be useful in the future. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/cam_ccb.h#6 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_sim.c#6 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_sim.h#5 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#23 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/cam_ccb.h#6 (text+ko) ==== ==== //depot/projects/scottl-camlock/src/sys/cam/cam_sim.c#6 (text+ko) ==== @@ -33,6 +33,8 @@ #include <sys/systm.h> #include <sys/malloc.h> #include <sys/kernel.h> +#include <sys/lock.h> +#include <sys/mutex.h> #include <cam/cam.h> #include <cam/cam_ccb.h> @@ -63,6 +65,9 @@ { struct cam_sim *sim; + if (mtx == NULL) + return (NULL); + sim = (struct cam_sim *)malloc(sizeof(struct cam_sim), M_CAMSIM, malloc_flags); @@ -79,9 +84,15 @@ sim->max_tagged_dev_openings = max_tagged_dev_transactions; sim->max_dev_openings = max_dev_transactions; sim->flags = 0; + sim->devq = queue; sim->mtx = mtx; - callout_handle_init(&sim->c_handle); - sim->devq = queue; + if (mtx == &Giant) { + sim->flags |= 0; + callout_init(&sim->callout, 0); + } else { + sim->flags |= CAM_SIM_MPSAFE; + callout_init(&sim->callout, 1); + } return (sim); } ==== //depot/projects/scottl-camlock/src/sys/cam/cam_sim.h#5 (text+ko) ==== @@ -99,8 +99,9 @@ int max_tagged_dev_openings; int max_dev_openings; u_int32_t flags; -#define CAM_SIM_REL_TIMEOUT_PENDING 0x01 - struct callout_handle c_handle; +#define CAM_SIM_REL_TIMEOUT_PENDING 0x01 +#define CAM_SIM_MPSAFE 0x02 + struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ }; ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#23 (text+ko) ==== @@ -770,7 +770,7 @@ static void xpt_run_dev_allocq(struct cam_eb *bus); static void xpt_run_dev_sendq(struct cam_eb *bus); static timeout_t xpt_release_devq_timeout; -static timeout_t xpt_release_simq_timeout; +static void xpt_release_simq_timeout(void *arg) __unused; static void xpt_release_bus(struct cam_eb *bus); static void xpt_release_devq_device(struct cam_ed *dev, u_int count, int run_queue); @@ -4912,8 +4912,7 @@ * already at 0. */ if ((sim->flags & CAM_SIM_REL_TIMEOUT_PENDING) != 0){ - untimeout(xpt_release_simq_timeout, sim, - sim->c_handle); + callout_stop(&sim->callout); sim->flags &= ~CAM_SIM_REL_TIMEOUT_PENDING; } bus = xpt_find_bus(sim->path_id); @@ -4932,6 +4931,9 @@ splx(s); } +/* + * XXX Appears to be unused. + */ static void xpt_release_simq_timeout(void *arg) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605151514.k4FFEsTr097766>