Re: [PATCH] ata: implement MODE SELECT command

From: Sergei Shtylyov
Date: Wed Jul 04 2012 - 13:10:27 EST


Hello.

On 07/04/2012 03:13 PM, Paolo Bonzini wrote:

> The cache_type file in sysfs lets users configure the disk cache in
> write-through or write-back modes. However, ata disks do not support
> writing to the file because they do not implement the MODE SELECT
> command.

> This patch adds a translation from MODE SELECT (for the caching page
> only) to the ATA SET FEATURES command.

> Cc: Jeff Garzik <jgarzik@xxxxxxxxx>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
> drivers/ata/libata-scsi.c | 147 +++++++++++++++++++++++++++++++++++++++++++--
> 1 files changed, 142 insertions(+), 5 deletions(-)

> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 41cde45..e7702d3 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
[...]
> + switch (pg) {
> + case CACHE_MPAGE:
> + if (ata_mselect_caching(tf, p, pg_len))
> + goto invalid_fld;

Error is in the data, not CDB, so returning "invalied field in CDB" doesn't
make sense...

> + break;
> +
> + default: /* invalid page code */
> + goto invalid_fld;
> + }
> + return 0;
> +
> + invalid_fld:
> + ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x0);
> + /* "Invalid field in cbd" */

s/cbd/CDB/

MBR, Sergei
--
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/