Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752209Ab2BPN2G (ORCPT ); Thu, 16 Feb 2012 08:28:06 -0500 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:43642 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770Ab2BPN2E (ORCPT ); Thu, 16 Feb 2012 08:28:04 -0500 Message-ID: <1329398881.2893.8.camel@dabdike> Subject: Re: [PATCH 2/2] scsi: retrieve cache mode using ATA_16 cmd if normal routine fails From: James Bottomley To: Amit Sahrawat Cc: Jeff Garzik , Nam-Jae Jeon , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Sahrawat Date: Thu, 16 Feb 2012 08:28:01 -0500 In-Reply-To: <1329375141-6944-1-git-send-email-amit.sahrawat83@gmail.com> References: <1329375141-6944-1-git-send-email-amit.sahrawat83@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.1 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1933 Lines: 60 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 > #include > #include > + > +#ifdef CONFIG_ATA > +#include > +#endif > + > #include > #include > #include > @@ -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 -- 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/