From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [patch 2.6] don't put IDE disks in standby mode on halt on Alpha
Date: Fri, 28 May 2004 19:10:28 +0400 [thread overview]
Message-ID: <20040528191028.A1117@jurassic.park.msu.ru> (raw)
In-Reply-To: <200405271940.49386.bzolnier@elka.pw.edu.pl>; from B.Zolnierkiewicz@elka.pw.edu.pl on Thu, May 27, 2004 at 07:40:49PM +0200
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);
next prev parent reply other threads:[~2004-05-28 15:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-27 15:49 Ivan Kokshaysky
2004-05-27 16:26 ` Arjan van de Ven
2004-05-27 17:11 ` Ivan Kokshaysky
2004-05-27 17:12 ` Arjan van de Ven
2004-05-27 17:41 ` Miquel van Smoorenburg
2004-05-27 16:54 ` Bartlomiej Zolnierkiewicz
2004-05-27 17:08 ` Ivan Kokshaysky
2004-05-27 17:40 ` Bartlomiej Zolnierkiewicz
2004-05-28 15:10 ` Ivan Kokshaysky [this message]
2004-05-28 15:40 ` Bartlomiej Zolnierkiewicz
2004-05-28 21:37 ` Ivan Kokshaysky
2004-05-29 18:07 ` Bartlomiej Zolnierkiewicz
2004-05-28 10:34 ` Mark McClelland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040528191028.A1117@jurassic.park.msu.ru \
--to=ink@jurassic.park.msu.ru \
--cc=B.Zolnierkiewicz@elka.pw.edu.pl \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®