/** * sas_get_port_device - Discover devices which caused port creation * @port: pointer to struct sas_port of interest * * Devices directly attached to a HA port, have no parent. This is * how we know they are (domain) "root" devices. All other devices * do, and should have their "parent" pointer set appropriately as * soon as a child device is discovered.
*/ staticint sas_get_port_device(struct asd_sas_port *port)
{ struct asd_sas_phy *phy; struct sas_rphy *rphy; struct domain_device *dev; int rc = -ENODEV;
dev = sas_alloc_device(); if (!dev) return -ENOMEM;
/* devices must be domain members before link recovery and probe */
list_for_each_entry(dev, &port->disco_list, disco_list_node) {
spin_lock_irq(&port->dev_list_lock);
list_add_tail(&dev->dev_list_node, &port->dev_list);
spin_unlock_irq(&port->dev_list_lock);
}
sas_probe_sata(port);
list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node) { int err;
/* lldd is free to forget the domain_device across the * suspension, we force the issue here to keep the reference * counts aligned
*/
list_for_each_entry(dev, &port->dev_list, dev_list_node)
sas_notify_lldd_dev_gone(dev);
/* we are suspending, so we know events are disabled and * phy_list is not being mutated
*/
list_for_each_entry(phy, &port->phy_list, port_phy_el) { if (si->dft->lldd_port_deformed)
si->dft->lldd_port_deformed(phy);
phy->suspended = 1;
port->suspended = 1;
}
}
/* * For removed device with active IOs, the user space applications have * to spend very long time waiting for the timeout. This is not * necessary because a removed device will not return the IOs. * Abort the inflight IOs here so that EH can be quickly kicked in.
*/
blk_mq_tagset_busy_iter(&shost->tag_set, sas_abort_cmd, dev);
}
void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
{ if (!test_bit(SAS_DEV_DESTROY, &dev->state) &&
!list_empty(&dev->disco_list_node)) { /* this rphy never saw sas_rphy_add */
list_del_init(&dev->disco_list_node);
sas_rphy_free(dev->rphy);
sas_unregister_common_dev(port, dev); return;
}
if (!test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { if (test_bit(SAS_DEV_GONE, &dev->state))
sas_abort_device_scsi_cmds(dev);
sas_rphy_unlink(dev->rphy);
list_move_tail(&dev->disco_list_node, &port->destroy_list);
}
}
ha = dev->port->ha;
new_phy = sas_port_get_phy(port);
/* pin and record last seen phy */
spin_lock_irq(&ha->phy_port_lock); if (new_phy) {
sas_port_put_phy(dev->phy);
dev->phy = new_phy;
}
spin_unlock_irq(&ha->phy_port_lock);
}
/* ---------- Discovery and Revalidation ---------- */
/** * sas_discover_domain - discover the domain * @work: work structure embedded in port domain device. * * NOTE: this process _must_ quit (return) as soon as any connection * errors are encountered. Connection recovery is done elsewhere. * Discover process only interrogates devices in order to discover the * domain.
*/ staticvoid sas_discover_domain(struct work_struct *work)
{ struct domain_device *dev; int error = 0; struct sas_discovery_event *ev = to_sas_discovery_event(work); struct asd_sas_port *port = ev->port;
/* prevent revalidation from finding sata links in recovery */
mutex_lock(&ha->disco_mutex); if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) {
pr_debug("REVALIDATION DEFERRED on port %d, pid:%d\n",
port->id, task_pid_nr(current)); goto out;
}
staticvoid sas_chain_work(struct sas_ha_struct *ha, struct sas_work *sw)
{ /* chained work is not subject to SA_HA_DRAINING or * SAS_HA_REGISTERED, because it is either submitted in the * workqueue, or known to be submitted from a context that is * not racing against draining
*/
queue_work(ha->disco_q, &sw->work);
}
/** * sas_init_disc - initialize the discovery struct in the port * @disc: port discovery structure * @port: pointer to struct port * * Called when the ports are being initialized.
*/ void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port)
{ int i;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.