mirror of https://gitee.com/openkylin/linux.git
[SCSI] zfcp: Report FCP LUN to SCSI midlayer
When reporting SCSI devices to the SCSI midlayer, use the FCP LUN as LUN reported to the SCSI layer. With this approach, zfcp does not have to create unique LUNS, and this code can be removed. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
c7f6b3a399
commit
462b7859a0
|
@ -815,9 +815,7 @@ zfcp_get_adapter_by_busid(char *bus_id)
|
|||
struct zfcp_unit *
|
||||
zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun)
|
||||
{
|
||||
struct zfcp_unit *unit, *tmp_unit;
|
||||
unsigned int scsi_lun;
|
||||
int found;
|
||||
struct zfcp_unit *unit;
|
||||
|
||||
/*
|
||||
* check that there is no unit with this FCP_LUN already in list
|
||||
|
@ -863,22 +861,10 @@ zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun)
|
|||
}
|
||||
|
||||
zfcp_unit_get(unit);
|
||||
unit->scsi_lun = scsilun_to_int((struct scsi_lun *)&unit->fcp_lun);
|
||||
|
||||
scsi_lun = 0;
|
||||
found = 0;
|
||||
write_lock_irq(&zfcp_data.config_lock);
|
||||
list_for_each_entry(tmp_unit, &port->unit_list_head, list) {
|
||||
if (tmp_unit->scsi_lun != scsi_lun) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
scsi_lun++;
|
||||
}
|
||||
unit->scsi_lun = scsi_lun;
|
||||
if (found)
|
||||
list_add_tail(&unit->list, &tmp_unit->list);
|
||||
else
|
||||
list_add_tail(&unit->list, &port->unit_list_head);
|
||||
list_add_tail(&unit->list, &port->unit_list_head);
|
||||
atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status);
|
||||
atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, &unit->status);
|
||||
write_unlock_irq(&zfcp_data.config_lock);
|
||||
|
|
|
@ -1204,7 +1204,7 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
|
|||
* Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns
|
||||
* the integer: 0x0b030a04
|
||||
**/
|
||||
static int scsilun_to_int(struct scsi_lun *scsilun)
|
||||
int scsilun_to_int(struct scsi_lun *scsilun)
|
||||
{
|
||||
int i;
|
||||
unsigned int lun;
|
||||
|
@ -1215,6 +1215,7 @@ static int scsilun_to_int(struct scsi_lun *scsilun)
|
|||
scsilun->scsi_lun[i + 1]) << (i * 8));
|
||||
return lun;
|
||||
}
|
||||
EXPORT_SYMBOL(scsilun_to_int);
|
||||
|
||||
/**
|
||||
* int_to_scsilun: reverts an int into a scsi_lun
|
||||
|
|
|
@ -287,6 +287,7 @@ extern void scsi_target_block(struct device *);
|
|||
extern void scsi_target_unblock(struct device *);
|
||||
extern void scsi_remove_target(struct device *);
|
||||
extern void int_to_scsilun(unsigned int, struct scsi_lun *);
|
||||
extern int scsilun_to_int(struct scsi_lun *);
|
||||
extern const char *scsi_device_state_name(enum scsi_device_state);
|
||||
extern int scsi_is_sdev_device(const struct device *);
|
||||
extern int scsi_is_target_device(const struct device *);
|
||||
|
|
Loading…
Reference in New Issue