Lines Matching refs:pool
183 struct scsi_host_cmd_pool *pool = shost->cmd_pool; in scsi_host_free_command() local
187 kmem_cache_free(pool->sense_slab, cmd->sense_buffer); in scsi_host_free_command()
188 kmem_cache_free(pool->cmd_slab, cmd); in scsi_host_free_command()
202 struct scsi_host_cmd_pool *pool = shost->cmd_pool; in scsi_host_alloc_command() local
205 cmd = kmem_cache_zalloc(pool->cmd_slab, gfp_mask | pool->gfp_mask); in scsi_host_alloc_command()
209 cmd->sense_buffer = kmem_cache_alloc(pool->sense_slab, in scsi_host_alloc_command()
210 gfp_mask | pool->gfp_mask); in scsi_host_alloc_command()
223 kmem_cache_free(pool->sense_slab, cmd->sense_buffer); in scsi_host_alloc_command()
225 kmem_cache_free(pool->cmd_slab, cmd); in scsi_host_alloc_command()
351 scsi_free_host_cmd_pool(struct scsi_host_cmd_pool *pool) in scsi_free_host_cmd_pool() argument
353 kfree(pool->sense_name); in scsi_free_host_cmd_pool()
354 kfree(pool->cmd_name); in scsi_free_host_cmd_pool()
355 kfree(pool); in scsi_free_host_cmd_pool()
362 struct scsi_host_cmd_pool *pool; in scsi_alloc_host_cmd_pool() local
364 pool = kzalloc(sizeof(*pool), GFP_KERNEL); in scsi_alloc_host_cmd_pool()
365 if (!pool) in scsi_alloc_host_cmd_pool()
368 pool->cmd_name = kasprintf(GFP_KERNEL, "%s_cmd", hostt->proc_name); in scsi_alloc_host_cmd_pool()
369 pool->sense_name = kasprintf(GFP_KERNEL, "%s_sense", hostt->proc_name); in scsi_alloc_host_cmd_pool()
370 if (!pool->cmd_name || !pool->sense_name) { in scsi_alloc_host_cmd_pool()
371 scsi_free_host_cmd_pool(pool); in scsi_alloc_host_cmd_pool()
375 pool->slab_flags = SLAB_HWCACHE_ALIGN; in scsi_alloc_host_cmd_pool()
377 pool->slab_flags |= SLAB_CACHE_DMA; in scsi_alloc_host_cmd_pool()
378 pool->gfp_mask = __GFP_DMA; in scsi_alloc_host_cmd_pool()
382 hostt->cmd_pool = pool; in scsi_alloc_host_cmd_pool()
384 return pool; in scsi_alloc_host_cmd_pool()
391 struct scsi_host_cmd_pool *retval = NULL, *pool; in scsi_get_host_cmd_pool() local
399 pool = scsi_find_host_cmd_pool(shost); in scsi_get_host_cmd_pool()
400 if (!pool) { in scsi_get_host_cmd_pool()
401 pool = scsi_alloc_host_cmd_pool(shost); in scsi_get_host_cmd_pool()
402 if (!pool) in scsi_get_host_cmd_pool()
406 if (!pool->users) { in scsi_get_host_cmd_pool()
407 pool->cmd_slab = kmem_cache_create(pool->cmd_name, cmd_size, 0, in scsi_get_host_cmd_pool()
408 pool->slab_flags, NULL); in scsi_get_host_cmd_pool()
409 if (!pool->cmd_slab) in scsi_get_host_cmd_pool()
412 pool->sense_slab = kmem_cache_create(pool->sense_name, in scsi_get_host_cmd_pool()
414 pool->slab_flags, NULL); in scsi_get_host_cmd_pool()
415 if (!pool->sense_slab) in scsi_get_host_cmd_pool()
419 pool->users++; in scsi_get_host_cmd_pool()
420 retval = pool; in scsi_get_host_cmd_pool()
426 kmem_cache_destroy(pool->cmd_slab); in scsi_get_host_cmd_pool()
429 scsi_free_host_cmd_pool(pool); in scsi_get_host_cmd_pool()
438 struct scsi_host_cmd_pool *pool; in scsi_put_host_cmd_pool() local
441 pool = scsi_find_host_cmd_pool(shost); in scsi_put_host_cmd_pool()
448 BUG_ON(pool->users == 0); in scsi_put_host_cmd_pool()
450 if (!--pool->users) { in scsi_put_host_cmd_pool()
451 kmem_cache_destroy(pool->cmd_slab); in scsi_put_host_cmd_pool()
452 kmem_cache_destroy(pool->sense_slab); in scsi_put_host_cmd_pool()
454 scsi_free_host_cmd_pool(pool); in scsi_put_host_cmd_pool()