Searched refs:prison (Results 1 - 4 of 4) sorted by relevance

/linux-4.4.14/drivers/md/
H A Ddm-bio-prison.c8 #include "dm-bio-prison.h"
35 struct dm_bio_prison *prison = kmalloc(sizeof(*prison), GFP_KERNEL); dm_bio_prison_create() local
37 if (!prison) dm_bio_prison_create()
40 spin_lock_init(&prison->lock); dm_bio_prison_create()
42 prison->cell_pool = mempool_create_slab_pool(MIN_CELLS, _cell_cache); dm_bio_prison_create()
43 if (!prison->cell_pool) { dm_bio_prison_create()
44 kfree(prison); dm_bio_prison_create()
48 prison->cells = RB_ROOT; dm_bio_prison_create()
50 return prison; dm_bio_prison_create()
54 void dm_bio_prison_destroy(struct dm_bio_prison *prison) dm_bio_prison_destroy() argument
56 mempool_destroy(prison->cell_pool); dm_bio_prison_destroy()
57 kfree(prison); dm_bio_prison_destroy()
61 struct dm_bio_prison_cell *dm_bio_prison_alloc_cell(struct dm_bio_prison *prison, gfp_t gfp) dm_bio_prison_alloc_cell() argument
63 return mempool_alloc(prison->cell_pool, gfp); dm_bio_prison_alloc_cell()
67 void dm_bio_prison_free_cell(struct dm_bio_prison *prison, dm_bio_prison_free_cell() argument
70 mempool_free(cell, prison->cell_pool); dm_bio_prison_free_cell()
107 static int __bio_detain(struct dm_bio_prison *prison, __bio_detain() argument
114 struct rb_node **new = &prison->cells.rb_node, *parent = NULL; __bio_detain()
139 rb_insert_color(&cell_prealloc->node, &prison->cells); __bio_detain()
144 static int bio_detain(struct dm_bio_prison *prison, bio_detain() argument
153 spin_lock_irqsave(&prison->lock, flags); bio_detain()
154 r = __bio_detain(prison, key, inmate, cell_prealloc, cell_result); bio_detain()
155 spin_unlock_irqrestore(&prison->lock, flags); bio_detain()
160 int dm_bio_detain(struct dm_bio_prison *prison, dm_bio_detain() argument
166 return bio_detain(prison, key, inmate, cell_prealloc, cell_result); dm_bio_detain()
170 int dm_get_cell(struct dm_bio_prison *prison, dm_get_cell() argument
175 return bio_detain(prison, key, NULL, cell_prealloc, cell_result); dm_get_cell()
182 static void __cell_release(struct dm_bio_prison *prison, __cell_release() argument
186 rb_erase(&cell->node, &prison->cells); __cell_release()
195 void dm_cell_release(struct dm_bio_prison *prison, dm_cell_release() argument
201 spin_lock_irqsave(&prison->lock, flags); dm_cell_release()
202 __cell_release(prison, cell, bios); dm_cell_release()
203 spin_unlock_irqrestore(&prison->lock, flags); dm_cell_release()
210 static void __cell_release_no_holder(struct dm_bio_prison *prison, __cell_release_no_holder() argument
214 rb_erase(&cell->node, &prison->cells); __cell_release_no_holder()
218 void dm_cell_release_no_holder(struct dm_bio_prison *prison, dm_cell_release_no_holder() argument
224 spin_lock_irqsave(&prison->lock, flags); dm_cell_release_no_holder()
225 __cell_release_no_holder(prison, cell, inmates); dm_cell_release_no_holder()
226 spin_unlock_irqrestore(&prison->lock, flags); dm_cell_release_no_holder()
230 void dm_cell_error(struct dm_bio_prison *prison, dm_cell_error() argument
237 dm_cell_release(prison, cell, &bios); dm_cell_error()
246 void dm_cell_visit_release(struct dm_bio_prison *prison, dm_cell_visit_release() argument
253 spin_lock_irqsave(&prison->lock, flags); dm_cell_visit_release()
255 rb_erase(&cell->node, &prison->cells); dm_cell_visit_release()
256 spin_unlock_irqrestore(&prison->lock, flags); dm_cell_visit_release()
260 static int __promote_or_release(struct dm_bio_prison *prison, __promote_or_release() argument
264 rb_erase(&cell->node, &prison->cells); __promote_or_release()
272 int dm_cell_promote_or_release(struct dm_bio_prison *prison, dm_cell_promote_or_release() argument
278 spin_lock_irqsave(&prison->lock, flags); dm_cell_promote_or_release()
279 r = __promote_or_release(prison, cell); dm_cell_promote_or_release()
280 spin_unlock_irqrestore(&prison->lock, flags); dm_cell_promote_or_release()
422 MODULE_DESCRIPTION(DM_NAME " bio prison");
H A Ddm-bio-prison.h19 * Sometimes we can't deal with a bio straight away. We put them in prison
50 void dm_bio_prison_destroy(struct dm_bio_prison *prison);
54 * Eventually all bio prison clients should manage their own cell memory.
59 struct dm_bio_prison_cell *dm_bio_prison_alloc_cell(struct dm_bio_prison *prison,
61 void dm_bio_prison_free_cell(struct dm_bio_prison *prison,
70 int dm_get_cell(struct dm_bio_prison *prison,
81 int dm_bio_detain(struct dm_bio_prison *prison,
87 void dm_cell_release(struct dm_bio_prison *prison,
90 void dm_cell_release_no_holder(struct dm_bio_prison *prison,
93 void dm_cell_error(struct dm_bio_prison *prison,
100 void dm_cell_visit_release(struct dm_bio_prison *prison,
114 int dm_cell_promote_or_release(struct dm_bio_prison *prison,
H A Ddm-cache-target.c8 #include "dm-bio-prison.h"
306 struct dm_bio_prison *prison; member in struct:cache
398 return dm_bio_prison_alloc_cell(cache->prison, GFP_NOWAIT); alloc_prison_cell()
403 dm_bio_prison_free_cell(cache->prison, cell); free_prison_cell()
537 r = dm_bio_detain(cache->prison, &key, bio, cell_prealloc, cell_result); bio_detain_range()
566 r = dm_get_cell(cache->prison, &key, cell_prealloc, cell_result); get_cell()
839 * You must increment the deferred set whilst the prison cell is held. To
1082 dm_cell_release(cache->prison, cell, &cache->deferred_bios); __cell_defer()
1092 if (!holder && dm_cell_promote_or_release(cache->prison, cell)) { cell_defer()
1110 dm_cell_error(cache->prison, cell, err); cell_error_with_code()
1715 dm_cell_visit_release(cache->prison, inc_fn, &detail, cell); remap_cell_to_origin_clear_discard()
1749 dm_cell_visit_release(cache->prison, inc_fn, &detail, cell); remap_cell_to_cache_dirty()
2322 if (cache->prison) destroy()
2323 dm_bio_prison_destroy(cache->prison); destroy()
2913 cache->prison = dm_bio_prison_create(); cache_create()
2914 if (!cache->prison) { cache_create()
2915 *error = "could not create bio prison"; cache_create()
H A Ddm-thin.c8 #include "dm-bio-prison.h"
239 struct dm_bio_prison *prison; member in struct:pool
416 * Allocate a cell from the prison's mempool. bio_detain()
419 cell_prealloc = dm_bio_prison_alloc_cell(pool->prison, GFP_NOIO); bio_detain()
421 r = dm_bio_detain(pool->prison, key, bio, cell_prealloc, cell_result); bio_detain()
427 dm_bio_prison_free_cell(pool->prison, cell_prealloc); bio_detain()
436 dm_cell_release(pool->prison, cell, bios); cell_release()
437 dm_bio_prison_free_cell(pool->prison, cell); cell_release()
445 dm_cell_visit_release(pool->prison, fn, context, cell); cell_visit_release()
446 dm_bio_prison_free_cell(pool->prison, cell); cell_visit_release()
453 dm_cell_release_no_holder(pool->prison, cell, bios); cell_release_no_holder()
454 dm_bio_prison_free_cell(pool->prison, cell); cell_release_no_holder()
460 dm_cell_error(pool->prison, cell, error_code); cell_error_with_code()
461 dm_bio_prison_free_cell(pool->prison, cell); cell_error_with_code()
875 * We can't issue the bios with the bio prison lock __inc_remap_and_issue_cell()
2750 dm_bio_prison_destroy(pool->prison); __pool_destroy()
2798 pool->prison = dm_bio_prison_create(); pool_create()
2799 if (!pool->prison) { pool_create()
2800 *error = "Error creating pool's bio prison"; pool_create()
2885 dm_bio_prison_destroy(pool->prison); pool_create()

Completed in 225 milliseconds