From: Aaron Lu <aaron.lu@intel.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Jeff Garzik <jgarzik@pobox.com>, Oliver Neukum <oneukum@suse.de>,
Aaron Lu <aaron.lwe@gmail.com>, Jack Wang <jack_wang@usish.com>,
Shane Huang <shane.huang@amd.com>,
linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 1/4] scsi: introduce sync_before_stop flag
Date: Tue, 18 Sep 2012 16:09:16 +0800 [thread overview]
Message-ID: <20120918080915.GA1740@mint-spring.sh.intel.com> (raw)
In-Reply-To: <1347955015.2388.0.camel@dabdike.int.hansenpartnership.com>
On Tue, Sep 18, 2012 at 08:56:55AM +0100, James Bottomley wrote:
> On Tue, 2012-09-18 at 15:00 +0800, Aaron Lu wrote:
> > When scsi device received stop command, it will take care of its
> > internal cache before enters stopped power condition. This command is
> > translated to standby immediate in libata-scsi, but standby doesn't
> > imply flush cache for ATA device, so to issue stop command to ATA
> > device, an additional flush cache has to be issued.
> >
> > Introduce this flag so that when we are to stop the ATA disk in scsi
> > disk driver, also flush its internal cache.
> >
> > Signed-off-by: Aaron Lu <aaron.lu@intel.com>
> > ---
> > include/scsi/scsi_device.h | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
> > index 4712aa1..26c3621 100644
> > --- a/include/scsi/scsi_device.h
> > +++ b/include/scsi/scsi_device.h
> > @@ -160,6 +160,7 @@ struct scsi_device {
> > unsigned ready_to_power_off:1; /* Device is ready to be powered off */
> > unsigned powered_off:1; /* Device is powered off */
> > unsigned may_power_off:1; /* Power off is allowed by user */
> > + unsigned sync_before_stop:1; /* Sync cache before stop */
>
> Why do you need this?
>
> Surely it's all conditioned on the WCE flag. If WCE isn't set, the
> cache is write through (or uncached) and there's no need for a sync
> before power down.
The set of this flag doesn't mean we will sync cache for sure.
It's only meaningful when WCE is set, and in that case, it means when we
are to send a stop command to the device, do we need to send an
additional flush cache command first?
In sd_suspend, the cache will be synchronized when:
1 For devices do not support start_stop, always;
2 For devices support start_stop, if it is standard scsi device, never;
and if it is an ata device(reflected by this newly introduced flag),
always.
The reason for this is, the scsi's stop command = flush_cache + standby
for ata, so I have to introduce this flag to explicitely do a cache
flush.
Makes sense?
-Aaron
next prev parent reply other threads:[~2012-09-18 8:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-18 7:00 [PATCH v2 0/4] Support runtime power off of HDD Aaron Lu
2012-09-18 7:00 ` [PATCH v2 1/4] scsi: introduce sync_before_stop flag Aaron Lu
2012-09-18 7:30 ` Oliver Neukum
2012-09-18 7:47 ` Aaron Lu
2012-09-18 7:56 ` James Bottomley
2012-09-18 8:09 ` Aaron Lu [this message]
2012-09-18 8:20 ` James Bottomley
2012-09-18 8:31 ` Aaron Lu
2012-09-24 22:13 ` Jeff Garzik
2012-09-18 7:00 ` [PATCH v2 2/4] scsi: sd: enter stop power condition on runtime suspend Aaron Lu
2012-09-18 7:00 ` [PATCH v2 3/4] scsi: sd: set ready_to_power_off for scsi disk Aaron Lu
2012-09-18 7:00 ` [PATCH v2 4/4] libata: acpi: set can_power_off for both ODD and HDD 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=20120918080915.GA1740@mint-spring.sh.intel.com \
--to=aaron.lu@intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=aaron.lwe@gmail.com \
--cc=jack_wang@usish.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=oneukum@suse.de \
--cc=shane.huang@amd.com \
--cc=stern@rowland.harvard.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.