summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_xpt.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-09-01 17:37:19 +0000
committermav <mav@FreeBSD.org>2013-09-01 17:37:19 +0000
commit7351998cf8dfb6696100874613c8237166a17c86 (patch)
tree70e1770181c928438fd3c1e01a6bd11d5027405a /sys/cam/cam_xpt.c
parentf9897c6dd3d2e00bc25d5857c3c6b2be50c7efea (diff)
downloadFreeBSD-src-7351998cf8dfb6696100874613c8237166a17c86.zip
FreeBSD-src-7351998cf8dfb6696100874613c8237166a17c86.tar.gz
Add debug trace points for freeze/release device queue.
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r--sys/cam/cam_xpt.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index da0b4da..e50b0ad 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -3561,6 +3561,40 @@ xpt_path_comp(struct cam_path *path1, struct cam_path *path2)
return (retval);
}
+int
+xpt_path_comp_dev(struct cam_path *path, struct cam_ed *dev)
+{
+ int retval = 0;
+
+ if (path->bus != dev->target->bus) {
+ if (path->bus->path_id == CAM_BUS_WILDCARD)
+ retval = 1;
+ else if (dev->target->bus->path_id == CAM_BUS_WILDCARD)
+ retval = 2;
+ else
+ return (-1);
+ }
+ if (path->target != dev->target) {
+ if (path->target->target_id == CAM_TARGET_WILDCARD) {
+ if (retval == 0)
+ retval = 1;
+ } else if (dev->target->target_id == CAM_TARGET_WILDCARD)
+ retval = 2;
+ else
+ return (-1);
+ }
+ if (path->device != dev) {
+ if (path->device->lun_id == CAM_LUN_WILDCARD) {
+ if (retval == 0)
+ retval = 1;
+ } else if (dev->lun_id == CAM_LUN_WILDCARD)
+ retval = 2;
+ else
+ return (-1);
+ }
+ return (retval);
+}
+
void
xpt_print_path(struct cam_path *path)
{
@@ -3594,6 +3628,21 @@ xpt_print_path(struct cam_path *path)
}
void
+xpt_print_device(struct cam_ed *device)
+{
+
+ if (device == NULL)
+ printf("(nopath): ");
+ else {
+ printf("(noperiph:%s%d:%d:%d:%d): ", device->sim->sim_name,
+ device->sim->unit_number,
+ device->sim->bus_id,
+ device->target->target_id,
+ device->lun_id);
+ }
+}
+
+void
xpt_print(struct cam_path *path, const char *fmt, ...)
{
va_list ap;
@@ -4114,6 +4163,8 @@ xpt_freeze_devq(struct cam_path *path, u_int count)
struct cam_ed *dev = path->device;
mtx_assert(path->bus->sim->mtx, MA_OWNED);
+ CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_freeze_devq() %u->%u\n",
+ dev->ccbq.queue.qfrozen_cnt, dev->ccbq.queue.qfrozen_cnt + count));
dev->ccbq.queue.qfrozen_cnt += count;
/* Remove frozen device from sendq. */
if (device_is_queued(dev)) {
@@ -4138,6 +4189,7 @@ xpt_release_devq_timeout(void *arg)
struct cam_ed *device;
device = (struct cam_ed *)arg;
+ CAM_DEBUG_DEV(device, CAM_DEBUG_TRACE, ("xpt_release_devq_timeout\n"));
xpt_release_devq_device(device, /*count*/1, /*run_queue*/TRUE);
}
@@ -4146,6 +4198,8 @@ xpt_release_devq(struct cam_path *path, u_int count, int run_queue)
{
mtx_assert(path->bus->sim->mtx, MA_OWNED);
+ CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_release_devq(%d, %d)\n",
+ count, run_queue));
xpt_release_devq_device(path->device, count, run_queue);
}
@@ -4153,6 +4207,9 @@ void
xpt_release_devq_device(struct cam_ed *dev, u_int count, int run_queue)
{
+ CAM_DEBUG_DEV(dev, CAM_DEBUG_TRACE,
+ ("xpt_release_devq_device(%d, %d) %u->%u\n", count, run_queue,
+ dev->ccbq.queue.qfrozen_cnt, dev->ccbq.queue.qfrozen_cnt - count));
if (count > dev->ccbq.queue.qfrozen_cnt) {
#ifdef INVARIANTS
printf("xpt_release_devq(): requested %u > present %u\n",
OpenPOWER on IntegriCloud