Lines Matching refs:bcp

244 	bcache_t *bcp = cdrarg;  in bcache_dblk_constructor()  local
249 dbp->db_base = kmem_cache_alloc(bcp->buffer_cache, kmflags); in bcache_dblk_constructor()
256 dbp->db_cache = (void *)bcp; in bcache_dblk_constructor()
257 dbp->db_lim = dbp->db_base + bcp->size; in bcache_dblk_constructor()
291 bcache_t *bcp = cdrarg; in bcache_dblk_destructor() local
293 kmem_cache_free(bcp->buffer_cache, dbp->db_base); in bcache_dblk_destructor()
995 bcache_t *bcp = dbp->db_cache; in bcache_dblk_lastfree() local
1010 mutex_enter(&bcp->mutex); in bcache_dblk_lastfree()
1011 kmem_cache_free(bcp->dblk_cache, dbp); in bcache_dblk_lastfree()
1012 bcp->alloc--; in bcache_dblk_lastfree()
1014 if (bcp->alloc == 0 && bcp->destroy != 0) { in bcache_dblk_lastfree()
1015 kmem_cache_destroy(bcp->dblk_cache); in bcache_dblk_lastfree()
1016 kmem_cache_destroy(bcp->buffer_cache); in bcache_dblk_lastfree()
1017 mutex_exit(&bcp->mutex); in bcache_dblk_lastfree()
1018 mutex_destroy(&bcp->mutex); in bcache_dblk_lastfree()
1019 kmem_free(bcp, sizeof (bcache_t)); in bcache_dblk_lastfree()
1021 mutex_exit(&bcp->mutex); in bcache_dblk_lastfree()
1028 bcache_t *bcp; in bcache_create() local
1033 if ((bcp = kmem_alloc(sizeof (bcache_t), KM_NOSLEEP)) == NULL) in bcache_create()
1036 bcp->size = size; in bcache_create()
1037 bcp->align = align; in bcache_create()
1038 bcp->alloc = 0; in bcache_create()
1039 bcp->destroy = 0; in bcache_create()
1041 mutex_init(&bcp->mutex, NULL, MUTEX_DRIVER, NULL); in bcache_create()
1044 bcp->buffer_cache = kmem_cache_create(buffer, size, align, NULL, NULL, in bcache_create()
1047 bcp->dblk_cache = kmem_cache_create(buffer, sizeof (dblk_t), in bcache_create()
1049 NULL, (void *)bcp, NULL, 0); in bcache_create()
1051 return (bcp); in bcache_create()
1055 bcache_destroy(bcache_t *bcp) in bcache_destroy() argument
1057 ASSERT(bcp != NULL); in bcache_destroy()
1059 mutex_enter(&bcp->mutex); in bcache_destroy()
1060 if (bcp->alloc == 0) { in bcache_destroy()
1061 kmem_cache_destroy(bcp->dblk_cache); in bcache_destroy()
1062 kmem_cache_destroy(bcp->buffer_cache); in bcache_destroy()
1063 mutex_exit(&bcp->mutex); in bcache_destroy()
1064 mutex_destroy(&bcp->mutex); in bcache_destroy()
1065 kmem_free(bcp, sizeof (bcache_t)); in bcache_destroy()
1067 bcp->destroy++; in bcache_destroy()
1068 mutex_exit(&bcp->mutex); in bcache_destroy()
1074 bcache_allocb(bcache_t *bcp, uint_t pri) in bcache_allocb() argument
1079 ASSERT(bcp != NULL); in bcache_allocb()
1081 mutex_enter(&bcp->mutex); in bcache_allocb()
1082 if (bcp->destroy != 0) { in bcache_allocb()
1083 mutex_exit(&bcp->mutex); in bcache_allocb()
1087 if ((dbp = kmem_cache_alloc(bcp->dblk_cache, KM_NOSLEEP)) == NULL) { in bcache_allocb()
1088 mutex_exit(&bcp->mutex); in bcache_allocb()
1091 bcp->alloc++; in bcache_allocb()
1092 mutex_exit(&bcp->mutex); in bcache_allocb()
1094 ASSERT(((uintptr_t)(dbp->db_base) & (bcp->align - 1)) == 0); in bcache_allocb()
1102 STR_FTALLOC(&dbp->db_fthdr, FTEV_BCALLOCB, bcp->size); in bcache_allocb()
1279 struct strbufcall *bcp; in bufcall() local
1281 if ((bcp = kmem_alloc(sizeof (strbufcall_t), KM_NOSLEEP)) == NULL) in bufcall()
1284 bcp->bc_func = func; in bufcall()
1285 bcp->bc_arg = arg; in bufcall()
1286 bcp->bc_size = size; in bufcall()
1287 bcp->bc_next = NULL; in bufcall()
1288 bcp->bc_executor = NULL; in bufcall()
1297 bc_id = bcp->bc_id = (bufcall_id_t)(bid += 2); /* keep it odd */ in bufcall()
1304 strbcalls.bc_head = strbcalls.bc_tail = bcp; in bufcall()
1306 strbcalls.bc_tail->bc_next = bcp; in bufcall()
1307 strbcalls.bc_tail = bcp; in bufcall()
1321 strbufcall_t *bcp, *pbcp; in unbufcall() local
1326 for (bcp = strbcalls.bc_head; bcp; bcp = bcp->bc_next) { in unbufcall()
1327 if (id == bcp->bc_id) in unbufcall()
1329 pbcp = bcp; in unbufcall()
1331 if (bcp) { in unbufcall()
1332 if (bcp->bc_executor != NULL) { in unbufcall()
1333 if (bcp->bc_executor != curthread) { in unbufcall()
1339 pbcp->bc_next = bcp->bc_next; in unbufcall()
1341 strbcalls.bc_head = bcp->bc_next; in unbufcall()
1342 if (bcp == strbcalls.bc_tail) in unbufcall()
1344 kmem_free(bcp, sizeof (strbufcall_t)); in unbufcall()