aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_aux.c
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2009-08-18 09:43:15 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 09:49:20 -0400
commita4623c467ff76f9258555d44d68371e10c5406c2 (patch)
treee310a629eb7fbd4da4d9ab05049af16176b2b551 /drivers/s390/scsi/zfcp_aux.c
parent058b8647892ed49ba6a0d2c0966a72e20e2e69ff (diff)
[SCSI] zfcp: Improve request allocation through mempools
Remove the special case for NO_QTCB requests and optimize the mempool and cache processing for fsfreqs. Especially use seperate mempools for the zfcp_fsf_req and zfcp_qtcb structs. Signed-off-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/scsi/zfcp_aux.c')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c98
1 files changed, 55 insertions, 43 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 7aba6840243f..de623292277b 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -42,6 +42,12 @@ static char *init_device;
42module_param_named(device, init_device, charp, 0400); 42module_param_named(device, init_device, charp, 0400);
43MODULE_PARM_DESC(device, "specify initial device"); 43MODULE_PARM_DESC(device, "specify initial device");
44 44
45static struct kmem_cache *zfcp_cache_hw_align(const char *name,
46 unsigned long size)
47{
48 return kmem_cache_create(name, size, roundup_pow_of_two(size), 0, NULL);
49}
50
45static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter) 51static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter)
46{ 52{
47 int idx; 53 int idx;
@@ -110,14 +116,6 @@ out_adapter:
110 return; 116 return;
111} 117}
112 118
113static struct kmem_cache *zfcp_cache_create(int size, char *name)
114{
115 int align = 1;
116 while ((size - align) > 0)
117 align <<= 1;
118 return kmem_cache_create(name , size, align, 0, NULL);
119}
120
121static void __init zfcp_init_device_setup(char *devstr) 119static void __init zfcp_init_device_setup(char *devstr)
122{ 120{
123 char *token; 121 char *token;
@@ -158,18 +156,23 @@ static int __init zfcp_module_init(void)
158{ 156{
159 int retval = -ENOMEM; 157 int retval = -ENOMEM;
160 158
161 zfcp_data.fsf_req_qtcb_cache = zfcp_cache_create( 159 zfcp_data.gpn_ft_cache = zfcp_cache_hw_align("zfcp_gpn",
162 sizeof(struct zfcp_fsf_req_qtcb), "zfcp_fsf"); 160 sizeof(struct ct_iu_gpn_ft_req));
163 if (!zfcp_data.fsf_req_qtcb_cache) 161 if (!zfcp_data.gpn_ft_cache)
164 goto out; 162 goto out;
165 163
166 zfcp_data.sr_buffer_cache = zfcp_cache_create( 164 zfcp_data.qtcb_cache = zfcp_cache_hw_align("zfcp_qtcb",
167 sizeof(struct fsf_status_read_buffer), "zfcp_sr"); 165 sizeof(struct fsf_qtcb));
166 if (!zfcp_data.qtcb_cache)
167 goto out_qtcb_cache;
168
169 zfcp_data.sr_buffer_cache = zfcp_cache_hw_align("zfcp_sr",
170 sizeof(struct fsf_status_read_buffer));
168 if (!zfcp_data.sr_buffer_cache) 171 if (!zfcp_data.sr_buffer_cache)
169 goto out_sr_cache; 172 goto out_sr_cache;
170 173
171 zfcp_data.gid_pn_cache = zfcp_cache_create( 174 zfcp_data.gid_pn_cache = zfcp_cache_hw_align("zfcp_gid",
172 sizeof(struct zfcp_gid_pn_data), "zfcp_gid"); 175 sizeof(struct zfcp_gid_pn_data));
173 if (!zfcp_data.gid_pn_cache) 176 if (!zfcp_data.gid_pn_cache)
174 goto out_gid_cache; 177 goto out_gid_cache;
175 178
@@ -209,7 +212,9 @@ out_transport:
209out_gid_cache: 212out_gid_cache:
210 kmem_cache_destroy(zfcp_data.sr_buffer_cache); 213 kmem_cache_destroy(zfcp_data.sr_buffer_cache);
211out_sr_cache: 214out_sr_cache:
212 kmem_cache_destroy(zfcp_data.fsf_req_qtcb_cache); 215 kmem_cache_destroy(zfcp_data.qtcb_cache);
216out_qtcb_cache:
217 kmem_cache_destroy(zfcp_data.gpn_ft_cache);
213out: 218out:
214 return retval; 219 return retval;
215} 220}
@@ -354,36 +359,41 @@ void zfcp_unit_dequeue(struct zfcp_unit *unit)
354static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter) 359static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter)
355{ 360{
356 /* must only be called with zfcp_data.config_sema taken */ 361 /* must only be called with zfcp_data.config_sema taken */
357 adapter->pool.fsf_req_erp = 362 adapter->pool.erp_req =
358 mempool_create_slab_pool(1, zfcp_data.fsf_req_qtcb_cache); 363 mempool_create_kmalloc_pool(1, sizeof(struct zfcp_fsf_req));
359 if (!adapter->pool.fsf_req_erp) 364 if (!adapter->pool.erp_req)
360 return -ENOMEM; 365 return -ENOMEM;
361 366
362 adapter->pool.fsf_req_scsi = 367 adapter->pool.scsi_req =
363 mempool_create_slab_pool(1, zfcp_data.fsf_req_qtcb_cache); 368 mempool_create_kmalloc_pool(1, sizeof(struct zfcp_fsf_req));
364 if (!adapter->pool.fsf_req_scsi) 369 if (!adapter->pool.scsi_req)
365 return -ENOMEM; 370 return -ENOMEM;
366 371
367 adapter->pool.fsf_req_abort = 372 adapter->pool.scsi_abort =
368 mempool_create_slab_pool(1, zfcp_data.fsf_req_qtcb_cache); 373 mempool_create_kmalloc_pool(1, sizeof(struct zfcp_fsf_req));
369 if (!adapter->pool.fsf_req_abort) 374 if (!adapter->pool.scsi_abort)
370 return -ENOMEM; 375 return -ENOMEM;
371 376
372 adapter->pool.fsf_req_status_read = 377 adapter->pool.status_read_req =
373 mempool_create_kmalloc_pool(FSF_STATUS_READS_RECOM, 378 mempool_create_kmalloc_pool(FSF_STATUS_READS_RECOM,
374 sizeof(struct zfcp_fsf_req)); 379 sizeof(struct zfcp_fsf_req));
375 if (!adapter->pool.fsf_req_status_read) 380 if (!adapter->pool.status_read_req)
381 return -ENOMEM;
382
383 adapter->pool.qtcb_pool =
384 mempool_create_slab_pool(3, zfcp_data.qtcb_cache);
385 if (!adapter->pool.qtcb_pool)
376 return -ENOMEM; 386 return -ENOMEM;
377 387
378 adapter->pool.data_status_read = 388 adapter->pool.status_read_data =
379 mempool_create_slab_pool(FSF_STATUS_READS_RECOM, 389 mempool_create_slab_pool(FSF_STATUS_READS_RECOM,
380 zfcp_data.sr_buffer_cache); 390 zfcp_data.sr_buffer_cache);
381 if (!adapter->pool.data_status_read) 391 if (!adapter->pool.status_read_data)
382 return -ENOMEM; 392 return -ENOMEM;
383 393
384 adapter->pool.data_gid_pn = 394 adapter->pool.gid_pn_data =
385 mempool_create_slab_pool(1, zfcp_data.gid_pn_cache); 395 mempool_create_slab_pool(1, zfcp_data.gid_pn_cache);
386 if (!adapter->pool.data_gid_pn) 396 if (!adapter->pool.gid_pn_data)
387 return -ENOMEM; 397 return -ENOMEM;
388 398
389 return 0; 399 return 0;
@@ -392,18 +402,20 @@ static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter)
392static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter) 402static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
393{ 403{
394 /* zfcp_data.config_sema must be held */ 404 /* zfcp_data.config_sema must be held */
395 if (adapter->pool.fsf_req_erp) 405 if (adapter->pool.erp_req)
396 mempool_destroy(adapter->pool.fsf_req_erp); 406 mempool_destroy(adapter->pool.erp_req);
397 if (adapter->pool.fsf_req_scsi) 407 if (adapter->pool.scsi_req)
398 mempool_destroy(adapter->pool.fsf_req_scsi); 408 mempool_destroy(adapter->pool.scsi_req);
399 if (adapter->pool.fsf_req_abort) 409 if (adapter->pool.scsi_abort)
400 mempool_destroy(adapter->pool.fsf_req_abort); 410 mempool_destroy(adapter->pool.scsi_abort);
401 if (adapter->pool.fsf_req_status_read) 411 if (adapter->pool.qtcb_pool)
402 mempool_destroy(adapter->pool.fsf_req_status_read); 412 mempool_destroy(adapter->pool.qtcb_pool);
403 if (adapter->pool.data_status_read) 413 if (adapter->pool.status_read_req)
404 mempool_destroy(adapter->pool.data_status_read); 414 mempool_destroy(adapter->pool.status_read_req);
405 if (adapter->pool.data_gid_pn) 415 if (adapter->pool.status_read_data)
406 mempool_destroy(adapter->pool.data_gid_pn); 416 mempool_destroy(adapter->pool.status_read_data);
417 if (adapter->pool.gid_pn_data)
418 mempool_destroy(adapter->pool.gid_pn_data);
407} 419}
408 420
409/** 421/**