aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-11-24 10:54:14 -0500
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:02:16 -0500
commitee744622c65cd66824e8dd1b9509e515c800de14 (patch)
tree4925603f5170400b07cde7cc18d2519cfcf788e2 /drivers/s390
parent7c7dc196814b9e1d5cc254dc579a5fa78ae524f7 (diff)
[SCSI] zfcp: Improve ELS ADISC handling
Introduce kmem_cache for ELS ADISC data to guarantee the required hardware alignment and free the allocated memory in case the send failes. 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>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c8
-rw-r--r--drivers/s390/scsi/zfcp_def.h1
-rw-r--r--drivers/s390/scsi/zfcp_fc.c11
3 files changed, 17 insertions, 3 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 58bb17732f56..9d0c941b7d33 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -179,6 +179,11 @@ static int __init zfcp_module_init(void)
179 if (!zfcp_data.gid_pn_cache) 179 if (!zfcp_data.gid_pn_cache)
180 goto out_gid_cache; 180 goto out_gid_cache;
181 181
182 zfcp_data.adisc_cache = zfcp_cache_hw_align("zfcp_adisc",
183 sizeof(struct zfcp_fc_els_adisc));
184 if (!zfcp_data.adisc_cache)
185 goto out_adisc_cache;
186
182 zfcp_data.scsi_transport_template = 187 zfcp_data.scsi_transport_template =
183 fc_attach_transport(&zfcp_transport_functions); 188 fc_attach_transport(&zfcp_transport_functions);
184 if (!zfcp_data.scsi_transport_template) 189 if (!zfcp_data.scsi_transport_template)
@@ -206,6 +211,8 @@ out_ccw_register:
206out_misc: 211out_misc:
207 fc_release_transport(zfcp_data.scsi_transport_template); 212 fc_release_transport(zfcp_data.scsi_transport_template);
208out_transport: 213out_transport:
214 kmem_cache_destroy(zfcp_data.adisc_cache);
215out_adisc_cache:
209 kmem_cache_destroy(zfcp_data.gid_pn_cache); 216 kmem_cache_destroy(zfcp_data.gid_pn_cache);
210out_gid_cache: 217out_gid_cache:
211 kmem_cache_destroy(zfcp_data.sr_buffer_cache); 218 kmem_cache_destroy(zfcp_data.sr_buffer_cache);
@@ -224,6 +231,7 @@ static void __exit zfcp_module_exit(void)
224 ccw_driver_unregister(&zfcp_ccw_driver); 231 ccw_driver_unregister(&zfcp_ccw_driver);
225 misc_deregister(&zfcp_cfdc_misc); 232 misc_deregister(&zfcp_cfdc_misc);
226 fc_release_transport(zfcp_data.scsi_transport_template); 233 fc_release_transport(zfcp_data.scsi_transport_template);
234 kmem_cache_destroy(zfcp_data.adisc_cache);
227 kmem_cache_destroy(zfcp_data.gid_pn_cache); 235 kmem_cache_destroy(zfcp_data.gid_pn_cache);
228 kmem_cache_destroy(zfcp_data.sr_buffer_cache); 236 kmem_cache_destroy(zfcp_data.sr_buffer_cache);
229 kmem_cache_destroy(zfcp_data.qtcb_cache); 237 kmem_cache_destroy(zfcp_data.qtcb_cache);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 21b29804a7a6..469d57f105db 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -347,6 +347,7 @@ struct zfcp_data {
347 struct kmem_cache *qtcb_cache; 347 struct kmem_cache *qtcb_cache;
348 struct kmem_cache *sr_buffer_cache; 348 struct kmem_cache *sr_buffer_cache;
349 struct kmem_cache *gid_pn_cache; 349 struct kmem_cache *gid_pn_cache;
350 struct kmem_cache *adisc_cache;
350}; 351};
351 352
352/********************** ZFCP SPECIFIC DEFINES ********************************/ 353/********************** ZFCP SPECIFIC DEFINES ********************************/
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 6d5ccc053e3a..ac5e3b7a3576 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -389,15 +389,16 @@ static void zfcp_fc_adisc_handler(void *data)
389 out: 389 out:
390 atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status); 390 atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status);
391 put_device(&port->sysfs_device); 391 put_device(&port->sysfs_device);
392 kfree(adisc); 392 kmem_cache_free(zfcp_data.adisc_cache, adisc);
393} 393}
394 394
395static int zfcp_fc_adisc(struct zfcp_port *port) 395static int zfcp_fc_adisc(struct zfcp_port *port)
396{ 396{
397 struct zfcp_fc_els_adisc *adisc; 397 struct zfcp_fc_els_adisc *adisc;
398 struct zfcp_adapter *adapter = port->adapter; 398 struct zfcp_adapter *adapter = port->adapter;
399 int ret;
399 400
400 adisc = kzalloc(sizeof(struct zfcp_fc_els_adisc), GFP_ATOMIC); 401 adisc = kmem_cache_alloc(zfcp_data.adisc_cache, GFP_ATOMIC);
401 if (!adisc) 402 if (!adisc)
402 return -ENOMEM; 403 return -ENOMEM;
403 404
@@ -420,7 +421,11 @@ static int zfcp_fc_adisc(struct zfcp_port *port)
420 hton24(adisc->adisc_req.adisc_port_id, 421 hton24(adisc->adisc_req.adisc_port_id,
421 fc_host_port_id(adapter->scsi_host)); 422 fc_host_port_id(adapter->scsi_host));
422 423
423 return zfcp_fsf_send_els(adapter, port->d_id, &adisc->els); 424 ret = zfcp_fsf_send_els(adapter, port->d_id, &adisc->els);
425 if (ret)
426 kmem_cache_free(zfcp_data.adisc_cache, adisc);
427
428 return ret;
424} 429}
425 430
426void zfcp_fc_link_test_work(struct work_struct *work) 431void zfcp_fc_link_test_work(struct work_struct *work)