Re: [PATCH 05/48] hpsa: correct change_queue_depth

2015-01-15 Thread Christoph Hellwig
On Wed, Jan 14, 2015 at 04:00:00PM -0600, Don Brace wrote:
 scsi_adjust_queue_depth was changed to scsi_change_queue_depth

That's not a very good dscription..

 +static int hpsa_change_queue_depth(struct scsi_device *sdev, int qdepth)
 +{
 + struct ctlr_info *h = sdev_to_hba(sdev);
 +
 + if (qdepth  1)
 + qdepth = 1;
 + else
 + if (qdepth  h-nr_cmds)
 + qdepth = h-nr_cmds;
 + scsi_change_queue_depth(sdev, qdepth);
 + return sdev-queue_depth;
 +}

Why do you need this method?  scsi_change_queue_depth checks for
host-can_queue, which is initialized from h-nr_cmds, as well as
for depth = 0 and rejects the change.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/48] hpsa: correct change_queue_depth

2015-01-14 Thread Don Brace
scsi_adjust_queue_depth was changed to scsi_change_queue_depth

Reviewed-by: Scott Teel scott.t...@pmcs.com
Signed-off-by: Don Brace don.br...@pmcs.com
---
 drivers/scsi/hpsa.c |   16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 371d0a8..7dfe829 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -217,6 +217,7 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *h, 
struct scsi_cmnd *cmd);
 static void hpsa_scan_start(struct Scsi_Host *);
 static int hpsa_scan_finished(struct Scsi_Host *sh,
unsigned long elapsed_time);
+static int hpsa_change_queue_depth(struct scsi_device *sdev, int qdepth);
 
 static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd);
 static int hpsa_eh_abort_handler(struct scsi_cmnd *scsicmd);
@@ -672,7 +673,7 @@ static struct scsi_host_template hpsa_driver_template = {
.queuecommand   = hpsa_scsi_queue_command,
.scan_start = hpsa_scan_start,
.scan_finished  = hpsa_scan_finished,
-   .change_queue_depth = scsi_change_queue_depth,
+   .change_queue_depth = hpsa_change_queue_depth,
.this_id= -1,
.use_clustering = ENABLE_CLUSTERING,
.eh_abort_handler   = hpsa_eh_abort_handler,
@@ -4007,6 +4008,19 @@ static void hpsa_scan_start(struct Scsi_Host *sh)
spin_unlock_irqrestore(h-scan_lock, flags);
 }
 
+static int hpsa_change_queue_depth(struct scsi_device *sdev, int qdepth)
+{
+   struct ctlr_info *h = sdev_to_hba(sdev);
+
+   if (qdepth  1)
+   qdepth = 1;
+   else
+   if (qdepth  h-nr_cmds)
+   qdepth = h-nr_cmds;
+   scsi_change_queue_depth(sdev, qdepth);
+   return sdev-queue_depth;
+}
+
 static int hpsa_scan_finished(struct Scsi_Host *sh,
unsigned long elapsed_time)
 {

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html