diff options
author | zhao, forrest <forrest.zhao@intel.com> | 2006-06-12 12:01:34 +0800 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-06-12 00:18:35 -0400 |
commit | 3057ac3c1a992ee135cbb7b7d1a12e58d81f0739 (patch) | |
tree | 38d83a88ee949b9db8f6655f90f98d88f8a5f2fd /drivers/scsi/libata-scsi.c | |
parent | 39b07ce6d9f7cd4da8567baed844801e0aaa7b1a (diff) |
[PATCH] Snoop SET FEATURES - WRITE CACHE ENABLE/DISABLE command(v5)
This patch makes libata snoop 'SET FEATURES - WRITE CACHE
ENABLE/DISABLE' command, executing requisite revalidation processes
to update cached data.
Signed-off-by: Forrest Zhao <forrest.zhao@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 5f90d8e3354..45a49be6504 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -1306,6 +1306,17 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) u8 *cdb = cmd->cmnd; int need_sense = (qc->err_mask != 0); + /* We snoop the SET_FEATURES - Write Cache ON/OFF command, and + * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE + * cache + */ + if (!need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) && + ((qc->tf.feature == SETFEATURES_WC_ON) || + (qc->tf.feature == SETFEATURES_WC_OFF))) { + qc->ap->eh_info.action |= ATA_EH_REVALIDATE; + ata_port_schedule_eh(qc->ap); + } + /* For ATA pass thru (SAT) commands, generate a sense block if * user mandated it or if there's an error. Note that if we * generate because the user forced us to, a check condition @@ -2992,3 +3003,28 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, return rc; } + +/** + * ata_scsi_dev_rescan - initiate scsi_rescan_device() + * @data: Pointer to ATA port to perform scsi_rescan_device() + * + * After ATA pass thru (SAT) commands are executed successfully, + * libata need to propagate the changes to SCSI layer. + * + * LOCKING: + * Kernel thread context (may sleep). + */ +void ata_scsi_dev_rescan(void *data) +{ + struct ata_port *ap = data; + struct ata_device *dev; + unsigned int i; + + for (i = 0; i < ATA_MAX_DEVICES; i++) { + dev = &ap->device[i]; + + if (ata_dev_enabled(dev)) + scsi_rescan_device(&(dev->sdev->sdev_gendev)); + } +} + |