diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2010-09-08 08:39:51 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-09-16 22:54:14 -0400 |
commit | 57c237731b92fadc7d44824276313ec330b1989b (patch) | |
tree | c04256f72db22d7e61f837ceff0c2067d23121ac | |
parent | d99e5f488ae28d9dfccc84435f4fd29bd1fe1b9b (diff) |
[SCSI] zfcp: Add zfcp private struct as SCSI device driver data
Add a new data structure zfcp_scsi_dev that holds zfcp private data
for each SCSI device. Use scsi_transport_reserve_device to let the
SCSI midlayer automatically allocate this with each SCSI device.
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>
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 3 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_def.h | 39 |
2 files changed, 42 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 68df57157d48..5c4b874591ea 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -159,6 +159,9 @@ static int __init zfcp_module_init(void) | |||
159 | fc_attach_transport(&zfcp_transport_functions); | 159 | fc_attach_transport(&zfcp_transport_functions); |
160 | if (!zfcp_data.scsi_transport_template) | 160 | if (!zfcp_data.scsi_transport_template) |
161 | goto out_transport; | 161 | goto out_transport; |
162 | scsi_transport_reserve_device(zfcp_data.scsi_transport_template, | ||
163 | sizeof(struct zfcp_scsi_dev)); | ||
164 | |||
162 | 165 | ||
163 | retval = misc_register(&zfcp_cfdc_misc); | 166 | retval = misc_register(&zfcp_cfdc_misc); |
164 | if (retval) { | 167 | if (retval) { |
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index e1c6b6e05a75..d31158c0de93 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -234,6 +234,45 @@ struct zfcp_unit { | |||
234 | }; | 234 | }; |
235 | 235 | ||
236 | /** | 236 | /** |
237 | * struct zfcp_scsi_dev - zfcp data per SCSI device | ||
238 | * @status: zfcp internal status flags | ||
239 | * @lun_handle: handle from "open lun" for issuing FSF requests | ||
240 | * @erp_action: zfcp erp data for opening and recovering this LUN | ||
241 | * @erp_counter: zfcp erp counter for this LUN | ||
242 | * @latencies: FSF channel and fabric latencies | ||
243 | * @port: zfcp_port where this LUN belongs to | ||
244 | */ | ||
245 | struct zfcp_scsi_dev { | ||
246 | atomic_t status; | ||
247 | u32 lun_handle; | ||
248 | struct zfcp_erp_action erp_action; | ||
249 | atomic_t erp_counter; | ||
250 | struct zfcp_latencies latencies; | ||
251 | struct zfcp_port *port; | ||
252 | }; | ||
253 | |||
254 | /** | ||
255 | * sdev_to_zfcp - Access zfcp LUN data for SCSI device | ||
256 | * @sdev: scsi_device where to get the zfcp_scsi_dev pointer | ||
257 | */ | ||
258 | static inline struct zfcp_scsi_dev *sdev_to_zfcp(struct scsi_device *sdev) | ||
259 | { | ||
260 | return scsi_transport_device_data(sdev); | ||
261 | } | ||
262 | |||
263 | /** | ||
264 | * zfcp_scsi_dev_lun - Return SCSI device LUN as 64 bit FCP LUN | ||
265 | * @sdev: SCSI device where to get the LUN from | ||
266 | */ | ||
267 | static inline u64 zfcp_scsi_dev_lun(struct scsi_device *sdev) | ||
268 | { | ||
269 | u64 fcp_lun; | ||
270 | |||
271 | int_to_scsilun(sdev->lun, (struct scsi_lun *)&fcp_lun); | ||
272 | return fcp_lun; | ||
273 | } | ||
274 | |||
275 | /** | ||
237 | * struct zfcp_fsf_req - basic FSF request structure | 276 | * struct zfcp_fsf_req - basic FSF request structure |
238 | * @list: list of FSF requests | 277 | * @list: list of FSF requests |
239 | * @req_id: unique request ID | 278 | * @req_id: unique request ID |