summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_queue.h
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_queue.h
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_queue.h')
-rw-r--r--sys/cam/cam_queue.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/cam/cam_queue.h b/sys/cam/cam_queue.h
index 0f74e82..33f6b1d 100644
--- a/sys/cam/cam_queue.h
+++ b/sys/cam/cam_queue.h
@@ -62,10 +62,9 @@ struct cam_ccbq {
struct ccb_hdr_tailq queue_extra_head;
int queue_extra_entries;
int total_openings;
- int devq_openings;
+ int allocated;
int dev_openings;
int dev_active;
- int held;
};
struct cam_ed;
@@ -188,8 +187,8 @@ cam_ccbq_pending_ccb_count(struct cam_ccbq *ccbq)
static __inline void
cam_ccbq_take_opening(struct cam_ccbq *ccbq)
{
- ccbq->devq_openings--;
- ccbq->held++;
+
+ ccbq->allocated++;
}
static __inline void
@@ -198,8 +197,6 @@ cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb)
struct ccb_hdr *old_ccb;
struct camq *queue = &ccbq->queue;
- ccbq->held--;
-
/*
* If queue is already full, try to resize.
* If resize fail, push CCB with lowest priority out to the TAILQ.
@@ -264,7 +261,7 @@ cam_ccbq_send_ccb(struct cam_ccbq *ccbq, union ccb *send_ccb)
send_ccb->ccb_h.pinfo.index = CAM_ACTIVE_INDEX;
ccbq->dev_active++;
- ccbq->dev_openings--;
+ ccbq->dev_openings--;
}
static __inline void
@@ -272,15 +269,14 @@ cam_ccbq_ccb_done(struct cam_ccbq *ccbq, union ccb *done_ccb)
{
ccbq->dev_active--;
- ccbq->dev_openings++;
- ccbq->held++;
+ ccbq->dev_openings++;
}
static __inline void
cam_ccbq_release_opening(struct cam_ccbq *ccbq)
{
- ccbq->held--;
- ccbq->devq_openings++;
+
+ ccbq->allocated--;
}
#endif /* _KERNEL */
OpenPOWER on IntegriCloud