From: Derek Basehore <dbasehore@chromium.org>
To: JBottomley@parallels.com
Cc: jgarzik@pobox.com, linux-ide@vger.kernel.org,
linux-kernel@vger.kernel.org,
Derek Basehore <dbasehore@chromium.org>
Subject: [PATCH 2/2] ata: don't wait on resume
Date: Thu, 20 Dec 2012 20:35:40 -0800 [thread overview]
Message-ID: <1356064540-17414-2-git-send-email-dbasehore@chromium.org> (raw)
In-Reply-To: <1356064540-17414-1-git-send-email-dbasehore@chromium.org>
When resuming an ata port, do not wait for the function ata_port_request_pm to
return. The reasoning behing this is that we can resume the device much faster
if we do not wait for ata ports connected to spinning disks to resume.
A small change is made in ata_port_request_pm to make it return 0 when we do not
wait. Previously, the function just returned an uninitialized variable if it did
not wait.
The pm runtime status of the ata port is set to active (even though is has not
fully resumed yet).
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Conflicts:
drivers/ata/libata-core.c
---
drivers/ata/libata-core.c | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9e8b99a..c700b79 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5279,7 +5279,7 @@ bool ata_link_offline(struct ata_link *link)
#ifdef CONFIG_PM
static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
unsigned int action, unsigned int ehi_flags,
- int *async)
+ int *async, int wait)
{
struct ata_link *link;
unsigned long flags;
@@ -5289,9 +5289,12 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
* progress. Wait for PM_PENDING to clear.
*/
if (ap->pflags & ATA_PFLAG_PM_PENDING) {
- if (async) {
- *async = -EAGAIN;
- return 0;
+ if (!wait) {
+ if (async) {
+ *async = -EAGAIN;
+ return 0;
+ }
+ return -EAGAIN;
}
ata_port_wait_eh(ap);
WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
@@ -5303,7 +5306,7 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
ap->pm_mesg = mesg;
if (async)
ap->pm_result = async;
- else
+ else if (wait)
ap->pm_result = &rc;
ap->pflags |= ATA_PFLAG_PM_PENDING;
@@ -5317,7 +5320,7 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
spin_unlock_irqrestore(ap->lock, flags);
/* wait and check result */
- if (!async) {
+ if (wait) {
ata_port_wait_eh(ap);
WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
}
@@ -5341,7 +5344,8 @@ static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int
if (mesg.event == PM_EVENT_SUSPEND)
ehi_flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_NO_RECOVERY;
- rc = ata_port_request_pm(ap, mesg, 0, ehi_flags, async);
+ rc = ata_port_request_pm(ap, mesg, 0, ehi_flags, async,
+ async == NULL ? 1 : 0);
return rc;
}
@@ -5381,7 +5385,8 @@ static int __ata_port_resume_common(struct ata_port *ap, int *async)
int rc;
rc = ata_port_request_pm(ap, PMSG_ON, ATA_EH_RESET,
- ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, async);
+ ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, async,
+ async == NULL ? 1 : 0);
return rc;
}
@@ -5394,9 +5399,11 @@ static int ata_port_resume_common(struct device *dev)
static int ata_port_resume(struct device *dev)
{
+ struct ata_port *ap = to_ata_port(dev);
int rc;
- rc = ata_port_resume_common(dev);
+ rc = ata_port_request_pm(ap, PMSG_ON, ATA_EH_RESET,
+ ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, NULL, 0);
if (!rc) {
pm_runtime_disable(dev);
pm_runtime_set_active(dev);
--
1.7.7.3
next prev parent reply other threads:[~2012-12-21 4:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-21 4:35 [PATCH 1/2] don't wait on disk to start on resume Derek Basehore
2012-12-21 4:35 ` Derek Basehore [this message]
2012-12-22 14:32 ` Sergei Shtylyov
2013-01-31 22:00 ` dbasehore .
2013-01-31 22:27 ` James Bottomley
2013-01-31 22:32 ` dbasehore .
2012-12-23 11:49 ` James Bottomley
2013-01-31 22:02 ` dbasehore .
2013-01-31 22:26 ` James Bottomley
2013-02-01 11:51 ` Aaron Lu
2013-02-01 15:28 ` Alan Stern
2013-02-02 10:45 ` Aaron Lu
2013-02-02 15:09 ` Alan Stern
2013-02-03 6:23 ` Aaron Lu
2013-02-04 0:07 ` dbasehore .
2013-02-04 14:27 ` Aaron Lu
2013-02-04 8:04 ` Aaron Lu
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=1356064540-17414-2-git-send-email-dbasehore@chromium.org \
--to=dbasehore@chromium.org \
--cc=JBottomley@parallels.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).