From: Akinobu M. <mi...@mi...> - 2005-03-23 01:18:33
|
This patch implements common dump_poll and dump_sanity_check methods for libata drivers to support diskdump. --- 2.6.9-diskdump-1.0/include/linux/libata.h.orig 2004-10-19 06:53:07.000000000 +0900 +++ 2.6.9-diskdump-1.0/include/linux/libata.h 2005-03-23 08:04:57.826382432 +0900 @@ -415,6 +415,8 @@ extern int ata_std_bios_param(struct scs struct block_device *bdev, sector_t capacity, int geom[]); extern int ata_scsi_slave_config(struct scsi_device *sdev); +extern int ata_sanity_check(struct scsi_device *device); +extern void ata_scsi_poll(struct scsi_device *device); static inline unsigned int ata_tag_valid(unsigned int tag) --- 2.6.9-diskdump-1.0/drivers/scsi/libata-core.c.orig 2004-10-19 06:53:06.000000000 +0900 +++ 2.6.9-diskdump-1.0/drivers/scsi/libata-core.c 2005-03-23 08:05:21.031854664 +0900 @@ -3655,3 +3655,5 @@ EXPORT_SYMBOL_GPL(ata_scsi_release); EXPORT_SYMBOL_GPL(ata_host_intr); EXPORT_SYMBOL_GPL(ata_dev_classify); EXPORT_SYMBOL_GPL(ata_dev_id_string); +EXPORT_SYMBOL_GPL(ata_scsi_poll); +EXPORT_SYMBOL_GPL(ata_sanity_check); --- 2.6.9-diskdump-1.0/drivers/scsi/libata-scsi.c.orig 2004-10-19 06:53:51.000000000 +0900 +++ 2.6.9-diskdump-1.0/drivers/scsi/libata-scsi.c 2005-03-23 08:04:57.802386080 +0900 @@ -1568,3 +1568,56 @@ static void ata_scsi_simulate(struct ata } } +/** + * ata_scsi_poll - Check for command completion + * @device: the SCSI device to which the command was queued + * + * This function is called after the diskdump subsystem has queued an I/O + * command to the indicated device. Since interrupts are disabled, this + * function is called periodically to detect command completion. + * + * LOCKING: + * + */ + +void ata_scsi_poll(struct scsi_device *device) +{ + struct ata_port *ap; + + ap = (struct ata_port *) &device->host->hostdata[0]; + ap->ops->irq_handler(0, ap->host_set, NULL); +} + +/** + * ata_sanity_check - Verify that SCSI device can receive dump + * @device: the SCSI device to which the command was queued + * + * Called by mid-layer diskdump sanity-check function to determine whether + * the indicated device is operational. Caller has already verified that + * scsi_device_online(device) is true. + * + * LOCKING: + * + * RETURNS: + * Zero for a good device, negative for a bad one + */ + +int ata_sanity_check(struct scsi_device *device) +{ + struct ata_port *ap; + struct ata_device *dev; + + ap = (struct ata_port *) &device->host->hostdata[0]; + if (!ap) + return -ENXIO; + + dev = ata_scsi_find_dev(ap, device); + if (!dev) + return -ENXIO; + + if (spin_is_locked(&ap->host_set->lock)) + return -EBUSY; + + return 0; +} + |