svn commit: r256840 - projects/camlock/sys/cam

Alexander Motin mav at FreeBSD.org
Mon Oct 21 09:51:07 UTC 2013


Author: mav
Date: Mon Oct 21 09:51:06 2013
New Revision: 256840
URL: http://svnweb.freebsd.org/changeset/base/256840

Log:
  Collect some garbage left after several code refactorings.

Modified:
  projects/camlock/sys/cam/cam_sim.c
  projects/camlock/sys/cam/cam_sim.h
  projects/camlock/sys/cam/cam_xpt.c

Modified: projects/camlock/sys/cam/cam_sim.c
==============================================================================
--- projects/camlock/sys/cam/cam_sim.c	Mon Oct 21 09:34:04 2013	(r256839)
+++ projects/camlock/sys/cam/cam_sim.c	Mon Oct 21 09:51:06 2013	(r256840)
@@ -95,9 +95,6 @@ cam_sim_alloc(sim_action_func sim_action
 		sim->flags |= CAM_SIM_MPSAFE;
 		callout_init(&sim->callout, 1);
 	}
-	mtx_init(&sim->sim_doneq_mtx, "CAM doneq", NULL, MTX_DEF);
-	TAILQ_INIT(&sim->sim_doneq);
-
 	return (sim);
 }
 
@@ -117,7 +114,6 @@ cam_sim_free(struct cam_sim *sim, int fr
 
 	if (free_devq)
 		cam_simq_free(sim->devq);
-	mtx_destroy(&sim->sim_doneq_mtx);
 	free(sim, M_CAMSIM);
 }
 

Modified: projects/camlock/sys/cam/cam_sim.h
==============================================================================
--- projects/camlock/sys/cam/cam_sim.h	Mon Oct 21 09:34:04 2013	(r256839)
+++ projects/camlock/sys/cam/cam_sim.h	Mon Oct 21 09:51:06 2013	(r256840)
@@ -110,11 +110,6 @@ struct cam_sim {
 	struct callout		callout;
 	struct cam_devq 	*devq;	/* Device Queue to use for this SIM */
 	int			refcount; /* References to the SIM. */
-	int			sim_doneq_flags;
-#define	CAM_SIM_DQ_ONQ		0x04
-#define	CAM_SIM_DQ_POLLED	0x08
-#define	CAM_SIM_DQ_BATCH	0x10
-	struct mtx		sim_doneq_mtx;
 };
 
 #define CAM_SIM_LOCK(sim)	mtx_lock((sim)->mtx)

Modified: projects/camlock/sys/cam/cam_xpt.c
==============================================================================
--- projects/camlock/sys/cam/cam_xpt.c	Mon Oct 21 09:34:04 2013	(r256839)
+++ projects/camlock/sys/cam/cam_xpt.c	Mon Oct 21 09:51:06 2013	(r256840)
@@ -258,7 +258,7 @@ static int	 xpt_schedule_dev(struct camq
 static xpt_devicefunc_t xptpassannouncefunc;
 static void	 xptaction(struct cam_sim *sim, union ccb *work_ccb);
 static void	 xptpoll(struct cam_sim *sim);
-static void	 camisr_runqueue(struct cam_sim *);
+static void	 camisr_runqueue(void);
 static void	 xpt_done_process(struct ccb_hdr *ccb_h);
 static void	 xpt_done_td(void *);
 static dev_match_ret	xptbusmatch(struct dev_match_pattern *patterns,
@@ -3012,11 +3012,6 @@ xpt_polled_action(union ccb *start_ccb)
 
 	mtx_unlock(&dev->device_mtx);
 
-	/* Don't use ISR for this SIM while polling. */
-	mtx_lock(&sim->sim_doneq_mtx);
-	sim->sim_doneq_flags |= CAM_SIM_DQ_POLLED;
-	mtx_unlock(&sim->sim_doneq_mtx);
-
 	/*
 	 * Steal an opening so that no other queued requests
 	 * can get it before us while we simulate interrupts.
@@ -3031,7 +3026,7 @@ xpt_polled_action(union ccb *start_ccb)
 		CAM_SIM_LOCK(sim);
 		(*(sim->sim_poll))(sim);
 		CAM_SIM_UNLOCK(sim);
-		camisr_runqueue(sim);
+		camisr_runqueue();
 		mtx_lock(&devq->send_mtx);
 	}
 	dev->ccbq.devq_openings++;
@@ -3044,7 +3039,7 @@ xpt_polled_action(union ccb *start_ccb)
 			CAM_SIM_LOCK(sim);
 			(*(sim->sim_poll))(sim);
 			CAM_SIM_UNLOCK(sim);
-			camisr_runqueue(sim);
+			camisr_runqueue();
 			if ((start_ccb->ccb_h.status  & CAM_STATUS_MASK)
 			    != CAM_REQ_INPROG)
 				break;
@@ -3063,11 +3058,6 @@ xpt_polled_action(union ccb *start_ccb)
 		start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
 	}
 
-	/* We will use CAM ISR for this SIM again. */
-	mtx_lock(&sim->sim_doneq_mtx);
-	sim->sim_doneq_flags &= ~CAM_SIM_DQ_POLLED;
-	mtx_unlock(&sim->sim_doneq_mtx);
-	camisr_runqueue(sim);
 	mtx_lock(&dev->device_mtx);
 }
 
@@ -5289,24 +5279,12 @@ xpt_done_td(void *arg)
 }
 
 static void
-camisr_runqueue(struct cam_sim *sim)
+camisr_runqueue(void)
 {
 	struct	ccb_hdr *ccb_h;
 	struct cam_doneq *queue;
 	int i;
 
-	/* Process per-SIM queue. */
-	mtx_lock(&sim->sim_doneq_mtx);
-	while ((ccb_h = TAILQ_FIRST(&sim->sim_doneq)) != NULL) {
-		TAILQ_REMOVE(&sim->sim_doneq, ccb_h, sim_links.tqe);
-		mtx_unlock(&sim->sim_doneq_mtx);
-		ccb_h->pinfo.index = CAM_UNQUEUED_INDEX;
-		xpt_done_process(ccb_h);
-		mtx_lock(&sim->sim_doneq_mtx);
-	}
-	sim->sim_doneq_flags &= ~CAM_SIM_DQ_ONQ;
-	mtx_unlock(&sim->sim_doneq_mtx);
-
 	/* Process global queues. */
 	for (i = 0; i < cam_num_doneqs; i++) {
 		queue = &cam_doneqs[i];


More information about the svn-src-projects mailing list