Lines Matching refs:pool
137 struct scsi_host_cmd_pool *pool = shost->cmd_pool; in scsi_host_free_command() local
141 kmem_cache_free(pool->sense_slab, cmd->sense_buffer); in scsi_host_free_command()
142 kmem_cache_free(pool->cmd_slab, cmd); in scsi_host_free_command()
156 struct scsi_host_cmd_pool *pool = shost->cmd_pool; in scsi_host_alloc_command() local
159 cmd = kmem_cache_zalloc(pool->cmd_slab, gfp_mask | pool->gfp_mask); in scsi_host_alloc_command()
163 cmd->sense_buffer = kmem_cache_alloc(pool->sense_slab, in scsi_host_alloc_command()
164 gfp_mask | pool->gfp_mask); in scsi_host_alloc_command()
177 kmem_cache_free(pool->sense_slab, cmd->sense_buffer); in scsi_host_alloc_command()
179 kmem_cache_free(pool->cmd_slab, cmd); in scsi_host_alloc_command()
305 scsi_free_host_cmd_pool(struct scsi_host_cmd_pool *pool) in scsi_free_host_cmd_pool() argument
307 kfree(pool->sense_name); in scsi_free_host_cmd_pool()
308 kfree(pool->cmd_name); in scsi_free_host_cmd_pool()
309 kfree(pool); in scsi_free_host_cmd_pool()
316 struct scsi_host_cmd_pool *pool; in scsi_alloc_host_cmd_pool() local
318 pool = kzalloc(sizeof(*pool), GFP_KERNEL); in scsi_alloc_host_cmd_pool()
319 if (!pool) in scsi_alloc_host_cmd_pool()
322 pool->cmd_name = kasprintf(GFP_KERNEL, "%s_cmd", hostt->proc_name); in scsi_alloc_host_cmd_pool()
323 pool->sense_name = kasprintf(GFP_KERNEL, "%s_sense", hostt->proc_name); in scsi_alloc_host_cmd_pool()
324 if (!pool->cmd_name || !pool->sense_name) { in scsi_alloc_host_cmd_pool()
325 scsi_free_host_cmd_pool(pool); in scsi_alloc_host_cmd_pool()
329 pool->slab_flags = SLAB_HWCACHE_ALIGN; in scsi_alloc_host_cmd_pool()
331 pool->slab_flags |= SLAB_CACHE_DMA; in scsi_alloc_host_cmd_pool()
332 pool->gfp_mask = __GFP_DMA; in scsi_alloc_host_cmd_pool()
336 hostt->cmd_pool = pool; in scsi_alloc_host_cmd_pool()
338 return pool; in scsi_alloc_host_cmd_pool()
345 struct scsi_host_cmd_pool *retval = NULL, *pool; in scsi_get_host_cmd_pool() local
353 pool = scsi_find_host_cmd_pool(shost); in scsi_get_host_cmd_pool()
354 if (!pool) { in scsi_get_host_cmd_pool()
355 pool = scsi_alloc_host_cmd_pool(shost); in scsi_get_host_cmd_pool()
356 if (!pool) in scsi_get_host_cmd_pool()
360 if (!pool->users) { in scsi_get_host_cmd_pool()
361 pool->cmd_slab = kmem_cache_create(pool->cmd_name, cmd_size, 0, in scsi_get_host_cmd_pool()
362 pool->slab_flags, NULL); in scsi_get_host_cmd_pool()
363 if (!pool->cmd_slab) in scsi_get_host_cmd_pool()
366 pool->sense_slab = kmem_cache_create(pool->sense_name, in scsi_get_host_cmd_pool()
368 pool->slab_flags, NULL); in scsi_get_host_cmd_pool()
369 if (!pool->sense_slab) in scsi_get_host_cmd_pool()
373 pool->users++; in scsi_get_host_cmd_pool()
374 retval = pool; in scsi_get_host_cmd_pool()
380 kmem_cache_destroy(pool->cmd_slab); in scsi_get_host_cmd_pool()
383 scsi_free_host_cmd_pool(pool); in scsi_get_host_cmd_pool()
392 struct scsi_host_cmd_pool *pool; in scsi_put_host_cmd_pool() local
395 pool = scsi_find_host_cmd_pool(shost); in scsi_put_host_cmd_pool()
402 BUG_ON(pool->users == 0); in scsi_put_host_cmd_pool()
404 if (!--pool->users) { in scsi_put_host_cmd_pool()
405 kmem_cache_destroy(pool->cmd_slab); in scsi_put_host_cmd_pool()
406 kmem_cache_destroy(pool->sense_slab); in scsi_put_host_cmd_pool()
408 scsi_free_host_cmd_pool(pool); in scsi_put_host_cmd_pool()