Lines Matching refs:bl
207 blist_t bl; in blist_create() local
227 bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags | in blist_create()
229 if (bl == NULL) in blist_create()
232 bl->bl_blocks = blocks; in blist_create()
233 bl->bl_radix = radix; in blist_create()
239 (long long)bl->bl_blocks, in blist_create()
240 (long long)bl->bl_blocks * 4 / 1024, in blist_create()
247 return (bl); in blist_create()
251 blist_destroy(blist_t bl) in blist_destroy() argument
254 free(bl, M_SWAP); in blist_destroy()
263 blist_alloc(blist_t bl, int *count, int maxcount) in blist_alloc() argument
278 for (cursor = bl->bl_cursor;; cursor = 0) { in blist_alloc()
279 blk = blst_meta_alloc(bl->bl_root, cursor, count, maxcount, in blist_alloc()
280 bl->bl_radix); in blist_alloc()
282 bl->bl_avail -= *count; in blist_alloc()
283 bl->bl_cursor = blk + *count; in blist_alloc()
284 if (bl->bl_cursor == bl->bl_blocks) in blist_alloc()
285 bl->bl_cursor = 0; in blist_alloc()
297 blist_avail(blist_t bl) in blist_avail() argument
300 return (bl->bl_avail); in blist_avail()
308 blist_free(blist_t bl, daddr_t blkno, daddr_t count) in blist_free() argument
311 KASSERT(blkno >= 0 && blkno + count <= bl->bl_blocks, in blist_free()
313 (uintmax_t)blkno, (int)count, (uintmax_t)bl->bl_blocks)); in blist_free()
314 blst_meta_free(bl->bl_root, blkno, count, bl->bl_radix); in blist_free()
315 bl->bl_avail += count; in blist_free()
325 blist_fill(blist_t bl, daddr_t blkno, daddr_t count) in blist_fill() argument
329 KASSERT(blkno >= 0 && blkno + count <= bl->bl_blocks, in blist_fill()
331 (uintmax_t)blkno, (int)count, (uintmax_t)bl->bl_blocks)); in blist_fill()
332 filled = blst_meta_fill(bl->bl_root, blkno, count, bl->bl_radix); in blist_fill()
333 bl->bl_avail -= filled; in blist_fill()
370 blist_print(blist_t bl) in blist_print() argument
373 (uintmax_t)bl->bl_avail, (uintmax_t)bl->bl_cursor); in blist_print()
375 if (bl->bl_root->bm_bitmap != 0) in blist_print()
376 blst_radix_print(bl->bl_root, 0, bl->bl_radix, 4); in blist_print()
508 blist_stats(blist_t bl, struct sbuf *s) in blist_stats() argument
518 radix = bl->bl_radix; in blist_stats()
519 for (i = 0; i < bl->bl_blocks; ) { in blist_stats()
524 if (bl->bl_root[nodes].bm_bitmap == 0) { in blist_stats()
540 mask = bl->bl_root[nodes].bm_bitmap; in blist_stats()
1081 blist_t bl; in main() local
1094 bl = blist_create(size, M_WAITOK); in main()
1095 if (bl == NULL) { in main()
1099 blist_free(bl, 0, size); in main()
1106 printf("%lld/%lld/%lld> ", (long long)blist_avail(bl), in main()
1107 (long long)size, (long long)bl->bl_radix * BLIST_RADIX); in main()
1114 blist_resize(&bl, count, 1, M_WAITOK); in main()
1119 blist_print(bl); in main()
1123 blist_stats(bl, s); in main()
1130 daddr_t blk = blist_alloc(bl, &count, maxcount); in main()
1139 blist_free(bl, da, count); in main()
1147 (intmax_t)blist_fill(bl, da, count)); in main()