[SCSI] zfcp: Use SCSI device data zfcp_scsi_dev instead of zfcp_unit
This is the large change to switch from using the data in zfcp_unit to zfcp_scsi_dev. Keeping everything working requires doing the switch in one piece. To ensure that no code keeps using the data in zfcp_unit, this patch also removes the data from zfcp_unit that is now being replaced with zfcp_scsi_dev. For zfcp, the scsi_device together with zfcp_scsi_dev exist from the call of slave_alloc to the call of slave_destroy. The data in zfcp_scsi_dev is initialized in zfcp_scsi_slave_alloc and the LUN is opened; the final shutdown for the LUN is run from slave_destroy. Where the scsi_device or zfcp_scsi_dev is needed, the pointer to the scsi_device is passed as function argument and inside the function converted to the pointer to zfcp_scsi_dev; this avoids back and forth conversion betweeen scsi_device and zfcp_scsi_dev. While changing the function arguments from zfcp_unit to scsi_device, the functions names are renamed form "unit" to "lun". This is to have a seperation between zfcp_scsi_dev/LUN and the zfcp_unit; only code referring to the remaining configuration information in zfcp_unit struct uses "unit". Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:

committed by
James Bottomley

parent
fdbd1c5e27
commit
b62a8d9b45
@@ -482,7 +482,7 @@ static int zfcp_dbf_rec_view_format(debug_info_t *id, struct debug_view *view,
|
||||
zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.trigger.fcp_lun);
|
||||
zfcp_dbf_out(&p, "adapter_status", "0x%08x", r->u.trigger.as);
|
||||
zfcp_dbf_out(&p, "port_status", "0x%08x", r->u.trigger.ps);
|
||||
zfcp_dbf_out(&p, "unit_status", "0x%08x", r->u.trigger.us);
|
||||
zfcp_dbf_out(&p, "lun_status", "0x%08x", r->u.trigger.ls);
|
||||
break;
|
||||
case ZFCP_REC_DBF_ID_ACTION:
|
||||
zfcp_dbf_out(&p, "erp_action", "0x%016Lx", r->u.action.action);
|
||||
@@ -600,19 +600,20 @@ void zfcp_dbf_rec_port(char *id, void *ref, struct zfcp_port *port)
|
||||
}
|
||||
|
||||
/**
|
||||
* zfcp_dbf_rec_unit - trace event for unit state change
|
||||
* zfcp_dbf_rec_lun - trace event for LUN state change
|
||||
* @id: identifier for trigger of state change
|
||||
* @ref: additional reference (e.g. request)
|
||||
* @unit: unit
|
||||
* @sdev: SCSI device
|
||||
*/
|
||||
void zfcp_dbf_rec_unit(char *id, void *ref, struct zfcp_unit *unit)
|
||||
void zfcp_dbf_rec_lun(char *id, void *ref, struct scsi_device *sdev)
|
||||
{
|
||||
struct zfcp_port *port = unit->port;
|
||||
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
||||
struct zfcp_port *port = zfcp_sdev->port;
|
||||
struct zfcp_dbf *dbf = port->adapter->dbf;
|
||||
|
||||
zfcp_dbf_rec_target(id, ref, dbf, &unit->status,
|
||||
&unit->erp_counter, port->wwpn, port->d_id,
|
||||
unit->fcp_lun);
|
||||
zfcp_dbf_rec_target(id, ref, dbf, &zfcp_sdev->status,
|
||||
&zfcp_sdev->erp_counter, port->wwpn, port->d_id,
|
||||
zfcp_scsi_dev_lun(sdev));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -624,11 +625,11 @@ void zfcp_dbf_rec_unit(char *id, void *ref, struct zfcp_unit *unit)
|
||||
* @action: address of error recovery action struct
|
||||
* @adapter: adapter
|
||||
* @port: port
|
||||
* @unit: unit
|
||||
* @sdev: SCSI device
|
||||
*/
|
||||
void zfcp_dbf_rec_trigger(char *id2, void *ref, u8 want, u8 need, void *action,
|
||||
struct zfcp_adapter *adapter, struct zfcp_port *port,
|
||||
struct zfcp_unit *unit)
|
||||
struct scsi_device *sdev)
|
||||
{
|
||||
struct zfcp_dbf *dbf = adapter->dbf;
|
||||
struct zfcp_dbf_rec_record *r = &dbf->rec_buf;
|
||||
@@ -647,9 +648,10 @@ void zfcp_dbf_rec_trigger(char *id2, void *ref, u8 want, u8 need, void *action,
|
||||
r->u.trigger.ps = atomic_read(&port->status);
|
||||
r->u.trigger.wwpn = port->wwpn;
|
||||
}
|
||||
if (unit)
|
||||
r->u.trigger.us = atomic_read(&unit->status);
|
||||
r->u.trigger.fcp_lun = unit ? unit->fcp_lun : ZFCP_DBF_INVALID_LUN;
|
||||
if (sdev)
|
||||
r->u.trigger.ls = atomic_read(&sdev_to_zfcp(sdev)->status);
|
||||
r->u.trigger.fcp_lun = sdev ? zfcp_scsi_dev_lun(sdev) :
|
||||
ZFCP_DBF_INVALID_LUN;
|
||||
debug_event(dbf->rec, action ? 1 : 4, r, sizeof(*r));
|
||||
spin_unlock_irqrestore(&dbf->rec_lock, flags);
|
||||
}
|
||||
|
Reference in New Issue
Block a user