lkml.org 
[lkml]   [2004]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch 2.6] don't put IDE disks in standby mode on halt on Alpha
On Thu, May 27, 2004 at 07:40:49PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > Would #ifdef __alpha__ be better?
>
> actually CONFIG_ALPHA + comment why it is needed

Ok, but now I'm thinking of probably better solution:
consider sys_state == SYSTEM_HALT as another special case
where we put the disk into standby mode *only* if it does
have write cache but doesn't suppurt cache flush command
(or cache flush fails for some reason).

Hopefully, most drives won't be spun down on halt.
I think that it should be acceptable for x86 as well.

Ivan.

--- 2.6/drivers/ide/ide-disk.c Fri May 28 17:46:35 2004
+++ linux/drivers/ide/ide-disk.c Fri May 28 18:42:47 2004
@@ -1686,13 +1686,19 @@ static void idedisk_setup (ide_drive_t *
#endif
}

-static void ide_cacheflush_p(ide_drive_t *drive)
+static int ide_cacheflush_p(ide_drive_t *drive)
{
- if (!drive->wcache || !ide_id_has_flush_cache(drive->id))
- return;
+ if (!drive->wcache)
+ return 0;
+
+ if (!ide_id_has_flush_cache(drive->id))
+ return 1;

- if (do_idedisk_flushcache(drive))
- printk(KERN_INFO "%s: wcache flush failed!\n", drive->name);
+ if (!do_idedisk_flushcache(drive))
+ return 0;
+
+ printk(KERN_INFO "%s: wcache flush failed!\n", drive->name);
+ return 1;
}

static int idedisk_cleanup (ide_drive_t *drive)
@@ -1713,10 +1719,16 @@ static void ide_device_shutdown(struct d
{
ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);

+ /* Never spin the disk down on reboot. */
if (system_state == SYSTEM_RESTART) {
ide_cacheflush_p(drive);
return;
}
+
+ /* Spin the disk down on halt only if attempt to flush the
+ write cache fails. */
+ if (system_state == SYSTEM_HALT && !ide_cacheflush_p(drive))
+ return;

printk("Shutdown: %s\n", drive->name);
dev->bus->suspend(dev, PM_SUSPEND_STANDBY);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:03    [W:1.172 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site