Current FC HBA queue_depth ramp up code depends on :-

        1. last queue full time.
        2. last queue ramp up time.
        3. ramp up period (time interval)

The sdev already  has last_queue_full_time field to track last
queue full time but its value is truncated by last four bits.

So this patch updates last_queue_full_time without truncating
last 4 bits to store full value and then updates its only
current usages in scsi_track_queue_full to ignore last four bits.
This is to allow same last_queue_full_time used by
scsi_track_queue_full and queue_depth ramp up code in next patch.

Adds additional new sdev fields for above 2 and 3 items.

Also adds helper functions to set value for added sdev
queue_ramp_up_period field, this will be used by following
patches in this series.

This patch series depends on Mike Christie's ramp down patches
and is per his offlist suggestions for common queue_depth ramp
up code in scsi-ml for libfc and other FC HBAs. Mike Christie's
ramp down patches are at:-

http://www.spinics.net/lists/linux-scsi/msg35959.html
http://www.spinics.net/lists/linux-scsi/msg35962.html
http://www.spinics.net/lists/linux-scsi/msg35961.html
http://www.spinics.net/lists/linux-scsi/msg35963.html
http://www.spinics.net/lists/linux-scsi/msg35964.html


RFC is to get review feedback on fcoe list first since mainly
this patch series is for libfc code though it also modifies
scsi code.

Signed-off-by: Vasu Dev <[email protected]>
---

 drivers/scsi/scsi.c        |   10 ++++++++--
 include/scsi/scsi_device.h |   12 +++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 2de5f3a..edc1a39 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -937,10 +937,16 @@ EXPORT_SYMBOL(scsi_adjust_queue_depth);
  */
 int scsi_track_queue_full(struct scsi_device *sdev, int depth)
 {
-       if ((jiffies >> 4) == sdev->last_queue_full_time)
+
+       /*
+        * Don't let QUEUE_FULLs on the same
+        * jiffies count, they could all be from
+        * same event.
+        */
+       if ((jiffies >> 4) == (sdev->last_queue_full_time >> 4))
                return 0;
 
-       sdev->last_queue_full_time = (jiffies >> 4);
+       sdev->last_queue_full_time = jiffies;
        if (sdev->last_queue_full_depth != depth) {
                sdev->last_queue_full_count = 1;
                sdev->last_queue_full_depth = depth;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 1f3a4c8..ab78991 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -83,9 +83,9 @@ struct scsi_device {
        unsigned short queue_depth;     /* How deep of a queue we want */
        unsigned short last_queue_full_depth; /* These two are used by */
        unsigned short last_queue_full_count; /* scsi_track_queue_full() */
-       unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same
-                                          jiffie count on our counter, they
-                                          could all be from the same event. */
+       unsigned long last_queue_full_time;     /* last queue full time */
+       unsigned long queue_ramp_up_period;     /* ramp up period in seconds */
+       unsigned long last_queue_ramp_up;       /* last queue ramp up time */
 
        unsigned int id, lun, channel;
 
@@ -379,6 +379,12 @@ static inline int __must_check scsi_device_reprobe(struct 
scsi_device *sdev)
        return device_reprobe(&sdev->sdev_gendev);
 }
 
+static inline void sdev_set_rampup_period(struct scsi_device *sdev,
+                                         unsigned long period)
+{
+       sdev->queue_ramp_up_period = period;
+}
+
 static inline unsigned int sdev_channel(struct scsi_device *sdev)
 {
        return sdev->channel;

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to