Re: [PATCH 2/2] scsi: retrieve cache mode using ATA_16 cmd if normalroutine fails

From: Namjae Jeon
Date: Thu Feb 16 2012 - 09:07:30 EST


2012/2/16 James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>:
> 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).
Oops.. it is mistake. we will make patch v2 included setting via sysfs.
Thanks for your reply.
>
> 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-ide" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/