aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2007-06-19 04:25:30 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-19 22:51:02 -0400
commit462b7859a07c9c2b060fa2b5b1d49f8b33706d4e (patch)
tree7e787456714480aebd9b0bf4ae24ed70e0c4e311
parentc7f6b3a39967b0f28d0e507866840f82e4354a23 (diff)
[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>
-rw-r--r--drivers/s390/scsi/zfcp_aux.c20
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--include/scsi/scsi_device.h1
3 files changed, 6 insertions, 18 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 821cde65e369..a1db95925138 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -815,9 +815,7 @@ zfcp_get_adapter_by_busid(char *bus_id)
815struct zfcp_unit * 815struct zfcp_unit *
816zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun) 816zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun)
817{ 817{
818 struct zfcp_unit *unit, *tmp_unit; 818 struct zfcp_unit *unit;
819 unsigned int scsi_lun;
820 int found;
821 819
822 /* 820 /*
823 * check that there is no unit with this FCP_LUN already in list 821 * 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)
863 } 861 }
864 862
865 zfcp_unit_get(unit); 863 zfcp_unit_get(unit);
864 unit->scsi_lun = scsilun_to_int((struct scsi_lun *)&unit->fcp_lun);
866 865
867 scsi_lun = 0;
868 found = 0;
869 write_lock_irq(&zfcp_data.config_lock); 866 write_lock_irq(&zfcp_data.config_lock);
870 list_for_each_entry(tmp_unit, &port->unit_list_head, list) { 867 list_add_tail(&unit->list, &port->unit_list_head);
871 if (tmp_unit->scsi_lun != scsi_lun) {
872 found = 1;
873 break;
874 }
875 scsi_lun++;
876 }
877 unit->scsi_lun = scsi_lun;
878 if (found)
879 list_add_tail(&unit->list, &tmp_unit->list);
880 else
881 list_add_tail(&unit->list, &port->unit_list_head);
882 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); 868 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status);
883 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, &unit->status); 869 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, &unit->status);
884 write_unlock_irq(&zfcp_data.config_lock); 870 write_unlock_irq(&zfcp_data.config_lock);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index a67f315244d7..5df28e2fd3bb 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1204,7 +1204,7 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
1204 * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns 1204 * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns
1205 * the integer: 0x0b030a04 1205 * the integer: 0x0b030a04
1206 **/ 1206 **/
1207static int scsilun_to_int(struct scsi_lun *scsilun) 1207int scsilun_to_int(struct scsi_lun *scsilun)
1208{ 1208{
1209 int i; 1209 int i;
1210 unsigned int lun; 1210 unsigned int lun;
@@ -1215,6 +1215,7 @@ static int scsilun_to_int(struct scsi_lun *scsilun)
1215 scsilun->scsi_lun[i + 1]) << (i * 8)); 1215 scsilun->scsi_lun[i + 1]) << (i * 8));
1216 return lun; 1216 return lun;
1217} 1217}
1218EXPORT_SYMBOL(scsilun_to_int);
1218 1219
1219/** 1220/**
1220 * int_to_scsilun: reverts an int into a scsi_lun 1221 * int_to_scsilun: reverts an int into a scsi_lun
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 2f3c5b8b1d6a..6fe1cf672d77 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -287,6 +287,7 @@ extern void scsi_target_block(struct device *);
287extern void scsi_target_unblock(struct device *); 287extern void scsi_target_unblock(struct device *);
288extern void scsi_remove_target(struct device *); 288extern void scsi_remove_target(struct device *);
289extern void int_to_scsilun(unsigned int, struct scsi_lun *); 289extern void int_to_scsilun(unsigned int, struct scsi_lun *);
290extern int scsilun_to_int(struct scsi_lun *);
290extern const char *scsi_device_state_name(enum scsi_device_state); 291extern const char *scsi_device_state_name(enum scsi_device_state);
291extern int scsi_is_sdev_device(const struct device *); 292extern int scsi_is_sdev_device(const struct device *);
292extern int scsi_is_target_device(const struct device *); 293extern int scsi_is_target_device(const struct device *);