Re: [PATCH 3/6] sd: don't bother spinning up disks on resume

2013-11-11 Thread Sergei Shtylyov

Hello.

On 10-11-2013 1:03, Phillip Susi wrote:


Don't bother forcing disks to spin up on resume, as they
will do so automatically when accessed, and forcing them
to spin up slows down the resume.  Add a second bit to the
manage_start_stop flag to restore the previous behavior.
---
  drivers/scsi/sd.c  | 6 +++---
  include/scsi/scsi_device.h | 2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)



diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e62d17d..3143311 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c

[...]

diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d65fbec..1c46d2d 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -152,7 +152,7 @@ struct scsi_device {
unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
unsigned no_start_on_add:1; /* do not issue start on add */
unsigned allow_restart:1; /* issue START_UNIT in error handler */
-   unsigned manage_start_stop:1;   /* Let HLD (sd) manage start/stop */
+   unsigned manage_start_stop:2;   /* Let HLD (sd) manage start/stop */


   I think you should better document this 2-bit field, or better still, make 
it 2 1-bit fields.


WBR, Sergei

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


Re: [PATCH 3/6] sd: don't bother spinning up disks on resume

2013-11-11 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/11/2013 8:08 AM, Sergei Shtylyov wrote:
 -unsigned manage_start_stop:1;/* Let HLD (sd) manage 
 start/stop */ +unsigned manage_start_stop:2;/* Let HLD
 (sd) manage start/stop */
 
 I think you should better document this 2-bit field, or better
 still, make it 2 1-bit fields.

Not a bad idea, though I'm really not sure that it shouldn't just be
removed entirely.  It is a bad idea to not stop the disk on
suspend/shutdown since it leaves the disk to take an emergency head
retract, which isn't good for it.  At the very least it should park
the heads, though currently libata does not handle the scsi cmd for that.

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSgOmiAAoJEJrBOlT6nu755CcH/2ckSBdvCtMHFe1ech1XFOdJ
PUZc5VEHk/rzPqXqxS26H9eR5FIbgu437yVizJ/w5Fy4MAX0rVKyz61FK/HavGL7
aqNYgKWIjucg7panlWZsPIraDl/bVPYVS2PnthVItabC+GskYRR0g92xcDqDPSeX
kmFIG0JOx2bU6JYWtFWxECpdjsBJBQxAnoLtzI+SONmlhp2GxH9Bc9Msa5hqwBoW
vmUJmggBaPoL3ZTQUFGZyYWU8/7n2d5lhXpJdcsvcrd+PJyrsfv9GGKqgQW/kLmL
sYAFwO83/5YJUK03l68S9xHt48NW2rdFm2ph035/CpbsNib2fKTaOsyfIgf/Idg=
=y73A
-END PGP SIGNATURE-
--
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 3/6] sd: don't bother spinning up disks on resume

2013-11-09 Thread Phillip Susi
Don't bother forcing disks to spin up on resume, as they
will do so automatically when accessed, and forcing them
to spin up slows down the resume.  Add a second bit to the
manage_start_stop flag to restore the previous behavior.
---
 drivers/scsi/sd.c  | 6 +++---
 include/scsi/scsi_device.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e62d17d..3143311 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3083,7 +3083,7 @@ static void sd_shutdown(struct device *dev)
sd_sync_cache(sdkp);
}
 
-   if (system_state != SYSTEM_RESTART  sdkp-device-manage_start_stop) {
+   if (system_state != SYSTEM_RESTART  (sdkp-device-manage_start_stop 
 1)) {
sd_printk(KERN_NOTICE, sdkp, Stopping disk\n);
sd_start_stop_device(sdkp, 0);
}
@@ -3107,7 +3107,7 @@ static int sd_suspend(struct device *dev)
goto done;
}
 
-   if (sdkp-device-manage_start_stop) {
+   if (sdkp-device-manage_start_stop  1) {
sd_printk(KERN_NOTICE, sdkp, Stopping disk\n);
ret = sd_start_stop_device(sdkp, 0);
}
@@ -3122,7 +3122,7 @@ static int sd_resume(struct device *dev)
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
int ret = 0;
 
-   if (!sdkp-device-manage_start_stop)
+   if (!(sdkp-device-manage_start_stop  2))
goto done;
 
sd_printk(KERN_NOTICE, sdkp, Starting disk\n);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d65fbec..1c46d2d 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -152,7 +152,7 @@ struct scsi_device {
unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
unsigned no_start_on_add:1; /* do not issue start on add */
unsigned allow_restart:1; /* issue START_UNIT in error handler */
-   unsigned manage_start_stop:1;   /* Let HLD (sd) manage start/stop */
+   unsigned manage_start_stop:2;   /* Let HLD (sd) manage start/stop */
unsigned start_stop_pwr_cond:1; /* Set power cond. in START_STOP_UNIT */
unsigned no_uld_attach:1; /* disable connecting to upper level drivers 
*/
unsigned select_no_atn:1;
-- 
1.8.3.2

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