Re: [PATCH 1/8] scsi: don't use scsi_next_command in scsi_reset_provider

2014-10-01 Thread Bart Van Assche

On 09/07/14 18:31, Christoph Hellwig wrote:

scsi_reset_provider already manually runs all queues for the given host,
so it doesn't need the scsi_run_queues call from it, and it doesn't need
a reference on the device because it's synchronous.

So let's just call scsi_put_command directly and avoid the device reference
dance to simplify the code.

Signed-off-by: Christoph Hellwig 
---
  drivers/scsi/scsi_error.c | 9 +
  1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 6b20ef3..14cece9 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2317,15 +2317,9 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
if (scsi_autopm_get_host(shost) < 0)
return FAILED;

-   if (!get_device(&dev->sdev_gendev)) {
-   rtn = FAILED;
-   goto out_put_autopm_host;
-   }
-
scmd = scsi_get_command(dev, GFP_KERNEL);
if (!scmd) {
rtn = FAILED;
-   put_device(&dev->sdev_gendev);
goto out_put_autopm_host;
}

@@ -2381,10 +2375,9 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
 "waking up host to restart after TMF\n"));

wake_up(&shost->host_wait);
-
scsi_run_host_queues(shost);

-   scsi_next_command(scmd);
+   scsi_put_command(scmd);
  out_put_autopm_host:
scsi_autopm_put_host(shost);
return rtn;


This patch looks fine to me.

A minor nit: if this patch has to be resent, please insert a blank line 
above the out_put_autopm_host label.


Reviewed-by: Bart Van Assche 
--
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 1/8] scsi: don't use scsi_next_command in scsi_reset_provider

2014-09-07 Thread Christoph Hellwig
scsi_reset_provider already manually runs all queues for the given host,
so it doesn't need the scsi_run_queues call from it, and it doesn't need
a reference on the device because it's synchronous.

So let's just call scsi_put_command directly and avoid the device reference
dance to simplify the code.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/scsi_error.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 6b20ef3..14cece9 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2317,15 +2317,9 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
if (scsi_autopm_get_host(shost) < 0)
return FAILED;
 
-   if (!get_device(&dev->sdev_gendev)) {
-   rtn = FAILED;
-   goto out_put_autopm_host;
-   }
-
scmd = scsi_get_command(dev, GFP_KERNEL);
if (!scmd) {
rtn = FAILED;
-   put_device(&dev->sdev_gendev);
goto out_put_autopm_host;
}
 
@@ -2381,10 +2375,9 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
 "waking up host to restart after TMF\n"));
 
wake_up(&shost->host_wait);
-
scsi_run_host_queues(shost);
 
-   scsi_next_command(scmd);
+   scsi_put_command(scmd);
 out_put_autopm_host:
scsi_autopm_put_host(shost);
return rtn;
-- 
1.9.1

--
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