summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_xpt.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-10-14 12:13:01 +0000
committermav <mav@FreeBSD.org>2014-10-14 12:13:01 +0000
commit2cb46b9c51ef7ccc7276111aaf286ee0c5248c2d (patch)
tree0adf4ae47f631e82d0cd4796109d9769d10bf9f5 /sys/cam/cam_xpt.c
parent625b27b4d059ba86a666090071c8f12459bf781a (diff)
downloadFreeBSD-src-2cb46b9c51ef7ccc7276111aaf286ee0c5248c2d.zip
FreeBSD-src-2cb46b9c51ef7ccc7276111aaf286ee0c5248c2d.tar.gz
MFC r271588: Update CAM CCB accounting for the new status quo.
devq_openings counter lost its meaning after allocation queues has gone. held counter is still meaningful, but problematic to update due to separate locking of CCB allocation and queuing. To fix that replace devq_openings counter with allocated counter. held is now calculated on request as difference between number of allocated, queued and active CCBs.
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r--sys/cam/cam_xpt.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 79d3023..a5ff305 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -2652,20 +2652,25 @@ call_sim:
struct ccb_getdevstats *cgds;
struct cam_eb *bus;
struct cam_et *tar;
+ struct cam_devq *devq;
cgds = &start_ccb->cgds;
bus = path->bus;
tar = path->target;
+ devq = bus->sim->devq;
+ mtx_lock(&devq->send_mtx);
cgds->dev_openings = dev->ccbq.dev_openings;
cgds->dev_active = dev->ccbq.dev_active;
- cgds->devq_openings = dev->ccbq.devq_openings;
- cgds->devq_queued = cam_ccbq_pending_ccb_count(&dev->ccbq);
- cgds->held = dev->ccbq.held;
+ cgds->allocated = dev->ccbq.allocated;
+ cgds->queued = cam_ccbq_pending_ccb_count(&dev->ccbq);
+ cgds->held = cgds->allocated - cgds->dev_active -
+ cgds->queued;
cgds->last_reset = tar->last_reset;
cgds->maxtags = dev->maxtags;
cgds->mintags = dev->mintags;
if (timevalcmp(&tar->last_reset, &bus->last_reset, <))
cgds->last_reset = bus->last_reset;
+ mtx_unlock(&devq->send_mtx);
cgds->ccb_h.status = CAM_REQ_CMP;
}
break;
@@ -3008,7 +3013,6 @@ xpt_polled_action(union ccb *start_ccb)
* can get it before us while we simulate interrupts.
*/
mtx_lock(&devq->send_mtx);
- dev->ccbq.devq_openings--;
dev->ccbq.dev_openings--;
while((devq->send_openings <= 0 || dev->ccbq.dev_openings < 0) &&
(--timeout > 0)) {
@@ -3020,7 +3024,6 @@ xpt_polled_action(union ccb *start_ccb)
camisr_runqueue();
mtx_lock(&devq->send_mtx);
}
- dev->ccbq.devq_openings++;
dev->ccbq.dev_openings++;
mtx_unlock(&devq->send_mtx);
OpenPOWER on IntegriCloud