Lines Matching refs:bp

11 nxt_buf_pool_mem_alloc(nxt_buf_pool_t *bp, size_t size)  in nxt_buf_pool_mem_alloc()  argument
15 b = bp->current; in nxt_buf_pool_mem_alloc()
21 b = bp->free; in nxt_buf_pool_mem_alloc()
24 bp->current = b; in nxt_buf_pool_mem_alloc()
25 bp->free = b->next; in nxt_buf_pool_mem_alloc()
30 if (bp->num >= bp->max) { in nxt_buf_pool_mem_alloc()
34 if (size == 0 || size >= bp->size + bp->size / 4) { in nxt_buf_pool_mem_alloc()
35 size = bp->size; in nxt_buf_pool_mem_alloc()
38 b = nxt_buf_mem_alloc(bp->mem_pool, size, bp->flags); in nxt_buf_pool_mem_alloc()
41 bp->current = b; in nxt_buf_pool_mem_alloc()
42 bp->num++; in nxt_buf_pool_mem_alloc()
51 nxt_buf_pool_file_alloc(nxt_buf_pool_t *bp, size_t size) in nxt_buf_pool_file_alloc() argument
55 b = bp->current; in nxt_buf_pool_file_alloc()
61 b = bp->free; in nxt_buf_pool_file_alloc()
64 bp->current = b; in nxt_buf_pool_file_alloc()
65 bp->free = b->next; in nxt_buf_pool_file_alloc()
70 if (bp->num >= bp->max) { in nxt_buf_pool_file_alloc()
74 if (size == 0 || size >= bp->size + bp->size / 4) { in nxt_buf_pool_file_alloc()
75 size = bp->size; in nxt_buf_pool_file_alloc()
78 b = nxt_buf_file_alloc(bp->mem_pool, size, bp->flags); in nxt_buf_pool_file_alloc()
81 bp->current = b; in nxt_buf_pool_file_alloc()
82 bp->num++; in nxt_buf_pool_file_alloc()
91 nxt_buf_pool_mmap_alloc(nxt_buf_pool_t *bp, size_t size) in nxt_buf_pool_mmap_alloc() argument
95 b = bp->current; in nxt_buf_pool_mmap_alloc()
101 b = bp->free; in nxt_buf_pool_mmap_alloc()
104 bp->current = b; in nxt_buf_pool_mmap_alloc()
105 bp->free = b->next; in nxt_buf_pool_mmap_alloc()
110 if (bp->num >= bp->max) { in nxt_buf_pool_mmap_alloc()
114 if (size == 0 || size >= bp->size + bp->size / 4) { in nxt_buf_pool_mmap_alloc()
115 size = bp->size; in nxt_buf_pool_mmap_alloc()
118 b = nxt_buf_mmap_alloc(bp->mem_pool, size); in nxt_buf_pool_mmap_alloc()
121 bp->mmap = 1; in nxt_buf_pool_mmap_alloc()
122 bp->current = b; in nxt_buf_pool_mmap_alloc()
123 bp->num++; in nxt_buf_pool_mmap_alloc()
132 nxt_buf_pool_free(nxt_buf_pool_t *bp, nxt_buf_t *b) in nxt_buf_pool_free() argument
140 if (bp->mmap) { in nxt_buf_pool_free()
144 if (bp->destroy) { in nxt_buf_pool_free()
146 if (b == bp->current) { in nxt_buf_pool_free()
147 bp->current = NULL; in nxt_buf_pool_free()
150 nxt_buf_free(bp->mem_pool, b); in nxt_buf_pool_free()
155 if (bp->mmap) { in nxt_buf_pool_free()
165 if (b != bp->current) { in nxt_buf_pool_free()
166 b->next = bp->free; in nxt_buf_pool_free()
167 bp->free = b; in nxt_buf_pool_free()
173 nxt_buf_pool_destroy(nxt_buf_pool_t *bp) in nxt_buf_pool_destroy() argument
177 bp->destroy = 1; in nxt_buf_pool_destroy()
179 for (b = bp->free; b != NULL; b = n) { in nxt_buf_pool_destroy()
181 nxt_buf_free(bp->mem_pool, b); in nxt_buf_pool_destroy()
184 bp->free = b; /* NULL */ in nxt_buf_pool_destroy()