From ee358e63766b39d924ca1a040caf9c32cbc0c27c Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sun, 6 Sep 2009 19:06:50 +0000 Subject: [PATCH] MFp4: Remove duplicate qfrozen_cnt variable from struct cam_ed. ccbq.queue.qfrozen_cnt should be used instead. --- sys/cam/cam_xpt.c | 26 +++++++++++++------------- sys/cam/cam_xpt_internal.h | 1 - 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 15353e6482fb..b506481bb263 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -2472,7 +2472,7 @@ xpt_action_default(union ccb *start_ccb) path = start_ccb->ccb_h.path; cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); - if (path->device->qfrozen_cnt == 0) + if (path->device->ccbq.queue.qfrozen_cnt == 0) runq = xpt_schedule_dev_sendq(path->bus, path->device); else runq = 0; @@ -2931,7 +2931,7 @@ xpt_action_default(union ccb *start_ccb) xpt_release_devq(crs->ccb_h.path, /*count*/1, /*run_queue*/TRUE); } - start_ccb->crs.qfrozen_cnt = dev->qfrozen_cnt; + start_ccb->crs.qfrozen_cnt = dev->ccbq.queue.qfrozen_cnt; start_ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -3227,7 +3227,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * If the device has been "frozen", don't attempt * to run it. */ - if (device->qfrozen_cnt > 0) { + if (device->ccbq.queue.qfrozen_cnt > 0) { continue; } @@ -3250,7 +3250,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * the device queue until we have a slot * available. */ - device->qfrozen_cnt++; + device->ccbq.queue.qfrozen_cnt++; STAILQ_INSERT_TAIL(&xsoftc.highpowerq, &work_ccb->ccb_h, xpt_links.stqe); @@ -3282,7 +3282,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * The client wants to freeze the queue * after this CCB is sent. */ - device->qfrozen_cnt++; + device->ccbq.queue.qfrozen_cnt++; } /* In Target mode, the peripheral driver knows best... */ @@ -4031,7 +4031,7 @@ xpt_freeze_devq(struct cam_path *path, u_int count) mtx_assert(path->bus->sim->mtx, MA_OWNED); - path->device->qfrozen_cnt += count; + path->device->ccbq.queue.qfrozen_cnt += count; /* * Mark the last CCB in the queue as needing @@ -4049,7 +4049,7 @@ xpt_freeze_devq(struct cam_path *path, u_int count) ccbh = TAILQ_LAST(&path->device->ccbq.active_ccbs, ccb_hdr_tailq); if (ccbh && ccbh->status == CAM_REQ_INPROG) ccbh->status = CAM_REQUEUE_REQ; - return (path->device->qfrozen_cnt); + return (path->device->ccbq.queue.qfrozen_cnt); } u_int32_t @@ -4093,11 +4093,12 @@ xpt_release_devq_device(struct cam_ed *dev, u_int count, int run_queue) int rundevq; rundevq = 0; - if (dev->qfrozen_cnt > 0) { + if (dev->ccbq.queue.qfrozen_cnt > 0) { - count = (count > dev->qfrozen_cnt) ? dev->qfrozen_cnt : count; - dev->qfrozen_cnt -= count; - if (dev->qfrozen_cnt == 0) { + count = (count > dev->ccbq.queue.qfrozen_cnt) ? + dev->ccbq.queue.qfrozen_cnt : count; + dev->ccbq.queue.qfrozen_cnt -= count; + if (dev->ccbq.queue.qfrozen_cnt == 0) { /* * No longer need to wait for a successful @@ -4402,7 +4403,6 @@ xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id) SLIST_INIT(&device->periphs); device->generation = 0; device->owner = NULL; - device->qfrozen_cnt = 0; device->flags = CAM_DEV_UNCONFIGURED; device->tag_delay_count = 0; device->tag_saved_openings = 0; @@ -4971,7 +4971,7 @@ camisr_runqueue(void *V_queue) xpt_start_tags(ccb_h->path); if ((dev->ccbq.queue.entries > 0) - && (dev->qfrozen_cnt == 0) + && (dev->ccbq.queue.qfrozen_cnt == 0) && (device_is_send_queued(dev) == 0)) { runq = xpt_schedule_dev_sendq(ccb_h->path->bus, dev); diff --git a/sys/cam/cam_xpt_internal.h b/sys/cam/cam_xpt_internal.h index 12c5c2f556f6..e40cde84b57f 100644 --- a/sys/cam/cam_xpt_internal.h +++ b/sys/cam/cam_xpt_internal.h @@ -106,7 +106,6 @@ struct cam_ed { u_int8_t queue_flags; /* Queue flags from the control page */ u_int8_t serial_num_len; u_int8_t *serial_num; - u_int32_t qfrozen_cnt; u_int32_t flags; #define CAM_DEV_UNCONFIGURED 0x01 #define CAM_DEV_REL_TIMEOUT_PENDING 0x02