From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Amit Sahrawat <amit.sahrawat83@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
Nam-Jae Jeon <namjae.jeon@samsung.com>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org,
Amit Sahrawat <a.sahrawat@samsung.com>
Subject: Re: [PATCH 2/2] scsi: retrieve cache mode using ATA_16 cmd if normal routine fails
Date: Thu, 16 Feb 2012 08:28:01 -0500 [thread overview]
Message-ID: <1329398881.2893.8.camel@dabdike> (raw)
In-Reply-To: <1329375141-6944-1-git-send-email-amit.sahrawat83@gmail.com>
On Thu, 2012-02-16 at 12:22 +0530, Amit Sahrawat wrote:
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index c691fb5..3ca507a 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -50,6 +50,11 @@
> #include <linux/string_helpers.h>
> #include <linux/async.h>
> #include <linux/slab.h>
> +
> +#ifdef CONFIG_ATA
> +#include <linux/libata.h>
> +#endif
> +
> #include <linux/pm_runtime.h>
> #include <asm/uaccess.h>
> #include <asm/unaligned.h>
> @@ -2129,7 +2134,11 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
> if (modepage == 0x3F) {
> sd_printk(KERN_ERR, sdkp, "No Caching mode page "
> "present\n");
> +#ifdef CONFIG_ATA
> + goto WCE_USING_ATA;
> +#else
> goto defaults;
> +#endif
> } else if ((buffer[offset] & 0x3f) != modepage) {
> sd_printk(KERN_ERR, sdkp, "Got wrong page\n");
> goto defaults;
> @@ -2149,6 +2158,15 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
> "Uses READ/WRITE(6), disabling FUA\n");
> sdkp->DPOFUA = 0;
> }
> +#ifdef CONFIG_ATA
> +WCE_USING_ATA:
> + if (!sdp->removable && !sdkp->WCE) {
> + sd_printk(KERN_NOTICE, sdkp, "Try to check write cache"
> + " enable/disable using ATA command\n");
> + sdkp->WCE = ata_get_cachestatus(sdp);
> + }
> +#endif
> +
I already said before, this is a non starter: we can't randomly send
SCSI encapsulated ATA commands to disks from sd. What we can do is give
you a WCE variable you can change on the fly in sysfs via whatever
mechanism is most appropriate (but this would have to be a mechanism
external to sd.c).
Alternatively, you can co-opt the USB quirks handling to set it for you.
James
next prev parent reply other threads:[~2012-02-16 13:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-16 6:52 [PATCH 2/2] scsi: retrieve cache mode using ATA_16 cmd if normal routine fails Amit Sahrawat
2012-02-16 13:28 ` James Bottomley [this message]
2012-02-16 14:07 ` Namjae Jeon
2012-03-06 17:38 ` Amit Sahrawat
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=1329398881.2893.8.camel@dabdike \
--to=james.bottomley@hansenpartnership.com \
--cc=a.sahrawat@samsung.com \
--cc=amit.sahrawat83@gmail.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=namjae.jeon@samsung.com \
/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