Lines Matching refs:bcp

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