Re: 2.6.18-rc2, problem to wake up spinned down drive?
From: Tejun Heo
Date: Mon Aug 07 2006 - 15:24:56 EST
Harald Dunkel wrote:
Tejun Heo wrote:
Pavel Machek wrote:
echo 1 > /sys/bus/scsi/devices/1:0:0:0/power/state
Really? I thought power/state takes 0/3 (for D0 and D3)
Yes, of course. My mistake. Sorry about the confusion. The correct
command is 'echo -n 3 > /sys/bus/scsi/devices/x:y:z:w/power/state'.
(Sure? :-)
The sleeping part is correct. That will make libata put the disk to sleep.
Now this did not work at all. The '-n 3' was probably
correct, but when I tried to access the disk, then it
did not spin up again (I waited for 5 minutes). There
was no message on the console, either.
But I could not reproduce this problem.
How do I monitor that the disk spins down and up?
But the waking up part isn't. You need to issue wake up explicitly by
doing 'echo -n 0 > /sys/...' I've been a complete idiot in this thread.
Please excuse me. :-(
I think the solution to your problem is adjusting command timeout to
more reasonable values which should make the problem more bearable.
It'll take some time to figure out how to make timeouts more intelligent
without breaking support for slow devices. I'll work on that.
I'm attaching a temporary patch for the time being.
--
tejun
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 98bd3aa..5676388 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -99,7 +99,7 @@ #define SD_MAX_DISKS (((26 * 26) + 26 +
/*
* Time out in seconds for disks and Magneto-opticals (which are slower).
*/
-#define SD_TIMEOUT (30 * HZ)
+#define SD_TIMEOUT (7 * HZ)
#define SD_MOD_TIMEOUT (75 * HZ)
/*
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b941670..45686f9 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -200,9 +200,9 @@ enum {
ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */
/* various lengths of time */
- ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
- ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
- ATA_TMOUT_INTERNAL = 30 * HZ,
+ ATA_TMOUT_BOOT = 10 * HZ, /* heuristic */
+ ATA_TMOUT_BOOT_QUICK = 5 * HZ, /* heuristic */
+ ATA_TMOUT_INTERNAL = 10 * HZ,
ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
/* ATA bus states */