svn commit: r248974 - in projects/camlock/sys/cam: . ata ctl scsi
Alexander Motin
mav at FreeBSD.org
Mon Apr 1 13:27:51 UTC 2013
Author: mav
Date: Mon Apr 1 13:27:49 2013
New Revision: 248974
URL: http://svnweb.freebsd.org/changeset/base/248974
Log:
Remove per-SIM queue of free CCBs.
Modified:
projects/camlock/sys/cam/ata/ata_xpt.c
projects/camlock/sys/cam/cam_sim.c
projects/camlock/sys/cam/cam_sim.h
projects/camlock/sys/cam/cam_xpt.c
projects/camlock/sys/cam/ctl/scsi_ctl.c
projects/camlock/sys/cam/scsi/scsi_xpt.c
Modified: projects/camlock/sys/cam/ata/ata_xpt.c
==============================================================================
--- projects/camlock/sys/cam/ata/ata_xpt.c Mon Apr 1 13:18:34 2013 (r248973)
+++ projects/camlock/sys/cam/ata/ata_xpt.c Mon Apr 1 13:27:49 2013 (r248974)
@@ -1549,11 +1549,6 @@ ata_alloc_device(struct cam_eb *bus, str
device->serial_num = NULL;
device->serial_num_len = 0;
- /*
- * XXX should be limited by number of CCBs this bus can
- * do.
- */
- bus->sim->max_ccbs += device->ccbq.devq_openings;
/* Insertion sort into our target's device list */
cur_device = TAILQ_FIRST(&target->ed_entries);
while (cur_device != NULL && cur_device->lun_id < lun_id)
Modified: projects/camlock/sys/cam/cam_sim.c
==============================================================================
--- projects/camlock/sys/cam/cam_sim.c Mon Apr 1 13:18:34 2013 (r248973)
+++ projects/camlock/sys/cam/cam_sim.c Mon Apr 1 13:27:49 2013 (r248974)
@@ -87,7 +87,6 @@ cam_sim_alloc(sim_action_func sim_action
sim->flags = 0;
sim->refcount = 1;
sim->devq = queue;
- sim->max_ccbs = 8; /* Reserve for management purposes. */
sim->mtx = mtx;
if (mtx == &Giant) {
sim->flags |= 0;
@@ -97,7 +96,6 @@ cam_sim_alloc(sim_action_func sim_action
callout_init(&sim->callout, 1);
}
- SLIST_INIT(&sim->ccb_freeq);
TAILQ_INIT(&sim->sim_doneq);
return (sim);
@@ -106,7 +104,6 @@ cam_sim_alloc(sim_action_func sim_action
void
cam_sim_free(struct cam_sim *sim, int free_devq)
{
- union ccb *ccb;
int error;
sim->refcount--;
@@ -117,10 +114,6 @@ cam_sim_free(struct cam_sim *sim, int fr
KASSERT(sim->refcount == 0, ("sim->refcount == 0"));
- while ((ccb = (union ccb *)SLIST_FIRST(&sim->ccb_freeq)) != NULL) {
- SLIST_REMOVE_HEAD(&sim->ccb_freeq, xpt_links.sle);
- xpt_free_ccb(ccb);
- }
if (free_devq)
cam_simq_free(sim->devq);
free(sim, M_CAMSIM);
Modified: projects/camlock/sys/cam/cam_sim.h
==============================================================================
--- projects/camlock/sys/cam/cam_sim.h Mon Apr 1 13:18:34 2013 (r248973)
+++ projects/camlock/sys/cam/cam_sim.h Mon Apr 1 13:27:49 2013 (r248974)
@@ -110,17 +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. */
-
- /* "Pool" of inactive ccbs managed by xpt_get_ccb and xpt_release_ccb */
- SLIST_HEAD(,ccb_hdr) ccb_freeq;
- /*
- * Maximum size of ccb pool. Modified as devices are added/removed
- * or have their * opening counts changed.
- */
- u_int max_ccbs;
- /* Current count of allocated ccbs */
- u_int ccb_count;
-
};
#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 Apr 1 13:18:34 2013 (r248973)
+++ projects/camlock/sys/cam/cam_xpt.c Mon Apr 1 13:27:49 2013 (r248974)
@@ -3756,13 +3756,7 @@ xpt_release_ccb(union ccb *free_ccb)
cam_ccbq_resize(&device->ccbq,
device->ccbq.dev_openings + device->ccbq.dev_active);
}
- if (sim->ccb_count > sim->max_ccbs) {
- xpt_free_ccb(free_ccb);
- sim->ccb_count--;
- } else {
- SLIST_INSERT_HEAD(&sim->ccb_freeq, &free_ccb->ccb_h,
- xpt_links.sle);
- }
+ xpt_free_ccb(free_ccb);
xpt_run_dev_allocq(device);
}
@@ -4326,22 +4320,11 @@ static union ccb *
xpt_get_ccb(struct cam_ed *device)
{
union ccb *new_ccb;
- struct cam_sim *sim;
- sim = device->sim;
- if ((new_ccb = (union ccb *)SLIST_FIRST(&sim->ccb_freeq)) == NULL) {
- new_ccb = xpt_alloc_ccb_nowait();
- if (new_ccb == NULL) {
- return (NULL);
- }
- if ((sim->flags & CAM_SIM_MPSAFE) == 0)
- callout_handle_init(&new_ccb->ccb_h.timeout_ch);
- SLIST_INSERT_HEAD(&sim->ccb_freeq, &new_ccb->ccb_h,
- xpt_links.sle);
- sim->ccb_count++;
- }
+ new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_NOWAIT);
+ if (new_ccb == NULL)
+ return (NULL);
cam_ccbq_take_opening(&device->ccbq);
- SLIST_REMOVE_HEAD(&sim->ccb_freeq, xpt_links.sle);
return (new_ccb);
}
@@ -4431,7 +4414,6 @@ xpt_alloc_device_default(struct cam_eb *
device->mintags = 1;
device->maxtags = 1;
- bus->sim->max_ccbs += device->ccbq.devq_openings;
cur_device = TAILQ_FIRST(&target->ed_entries);
while (cur_device != NULL && cur_device->lun_id < lun_id)
cur_device = TAILQ_NEXT(cur_device, links);
@@ -4525,7 +4507,6 @@ xpt_release_device(struct cam_ed *device
TAILQ_REMOVE(&device->target->ed_entries, device,links);
device->target->generation++;
- device->target->bus->sim->max_ccbs -= device->ccbq.devq_openings;
/* Release our slot in the devq */
devq = device->target->bus->sim->devq;
cam_devq_resize(devq, devq->send_queue.array_size - 1);
@@ -4565,8 +4546,6 @@ xpt_dev_ccbq_resize(struct cam_path *pat
if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0
|| (dev->inq_flags & SID_CmdQue) != 0)
dev->tag_saved_openings = newopenings;
- /* Adjust the global limit */
- dev->sim->max_ccbs += diff;
return (result);
}
Modified: projects/camlock/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- projects/camlock/sys/cam/ctl/scsi_ctl.c Mon Apr 1 13:18:34 2013 (r248973)
+++ projects/camlock/sys/cam/ctl/scsi_ctl.c Mon Apr 1 13:27:49 2013 (r248974)
@@ -2063,12 +2063,6 @@ ctlfe_dump_sim(struct cam_sim *sim)
printf("%s%d: max tagged openings: %d, max dev openings: %d\n",
sim->sim_name, sim->unit_number,
sim->max_tagged_dev_openings, sim->max_dev_openings);
- printf("%s%d: max_ccbs: %u, ccb_count: %u\n",
- sim->sim_name, sim->unit_number,
- sim->max_ccbs, sim->ccb_count);
- printf("%s%d: ccb_freeq is %sempty\n",
- sim->sim_name, sim->unit_number,
- (SLIST_FIRST(&sim->ccb_freeq) == NULL) ? "" : "NOT ");
printf("\n");
}
Modified: projects/camlock/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- projects/camlock/sys/cam/scsi/scsi_xpt.c Mon Apr 1 13:18:34 2013 (r248973)
+++ projects/camlock/sys/cam/scsi/scsi_xpt.c Mon Apr 1 13:27:49 2013 (r248974)
@@ -2331,11 +2331,6 @@ scsi_alloc_device(struct cam_eb *bus, st
device->supported_vpds = NULL;
device->supported_vpds_len = 0;
- /*
- * XXX should be limited by number of CCBs this bus can
- * do.
- */
- bus->sim->max_ccbs += device->ccbq.devq_openings;
/* Insertion sort into our target's device list */
cur_device = TAILQ_FIRST(&target->ed_entries);
while (cur_device != NULL && cur_device->lun_id < lun_id)
More information about the svn-src-projects
mailing list