24 #ifndef __MOTR_BE_ALLOC_H__ 25 #define __MOTR_BE_ALLOC_H__ 179 uint32_t *zone_percent,
322 #define M0_BE_ALLOC_ARR(arr, nr, seg, tx, op) \ 323 m0_be_alloc(m0_be_seg_allocator(seg), (tx), (op), \ 324 (void **)&(arr), (nr) * sizeof((arr)[0])) 332 #define M0_BE_ALLOC_PTR(ptr, seg, tx, op) \ 333 M0_BE_ALLOC_ARR((ptr), 1, (seg), (tx), (op)) 335 #define M0_BE_ALLOC_ARR_SYNC(arr, nr, seg, tx) \ 336 M0_BE_OP_SYNC(__op, \ 337 M0_BE_ALLOC_ARR((arr), (nr), (seg), (tx), &__op)) 339 #define M0_BE_ALLOC_PTR_SYNC(ptr, seg, tx) \ 340 M0_BE_OP_SYNC(__op, M0_BE_ALLOC_PTR((ptr), (seg), (tx), &__op)) 342 #define M0_BE_FREE_PTR(ptr, seg, tx, op) \ 343 m0_be_free(m0_be_seg_allocator(seg), (tx), (op), (ptr)) 345 #define M0_BE_FREE_PTR_SYNC(ptr, seg, tx) \ 346 M0_BE_OP_SYNC(__op, M0_BE_FREE_PTR((ptr), (seg), (tx), &__op)) 348 #define M0_BE_ALLOC_BUF(buf, seg, tx, op) \ 349 m0_be_alloc(m0_be_seg_allocator(seg), (tx), (op), \ 350 &(buf)->b_addr, (buf)->b_nob) 352 #define M0_BE_ALLOC_BUF_SYNC(buf, seg, tx) \ 353 M0_BE_OP_SYNC(__op, M0_BE_ALLOC_BUF((buf), (seg), (tx), &__op)) 355 #define M0_BE_ALLOC_CREDIT_PTR(ptr, seg, accum) \ 356 m0_be_allocator_credit(m0_be_seg_allocator(seg), \ 357 M0_BAO_ALLOC, sizeof *(ptr), 0, (accum)) 359 #define M0_BE_FREE_CREDIT_PTR(ptr, seg, accum) \ 360 m0_be_allocator_credit(m0_be_seg_allocator(seg), \ 361 M0_BAO_FREE, sizeof *(ptr), 0, (accum)) 363 #define M0_BE_ALLOC_CREDIT_ARR(arr, nr, seg, accum) \ 364 m0_be_allocator_credit(m0_be_seg_allocator(seg), \ 365 M0_BAO_ALLOC, (nr) * sizeof((arr)[0]), 0, (accum)) 367 #define M0_BE_FREE_CREDIT_ARR(arr, nr, seg, accum) \ 368 m0_be_allocator_credit(m0_be_seg_allocator(seg), \ 369 M0_BAO_FREE, (nr) * sizeof((arr)[0]), 0, (accum)) 371 #define M0_BE_ALLOC_CREDIT_BUF(buf, seg, accum) \ 372 m0_be_allocator_credit(m0_be_seg_allocator(seg), \ 373 M0_BAO_ALLOC, (buf)->b_nob, 0, (accum)) static void ptr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
struct m0_be_allocator_call_stats bas_stat0
m0_bcount_t bas_stat0_boundary
m0_bcount_t bas_space_total
M0_INTERNAL void m0_be_alloc_stats_capture(struct m0_be_allocator *a, struct m0_be_tx *tx)
M0_INTERNAL void m0_be_alloc_stats(struct m0_be_allocator *a, struct m0_be_allocator_stats *out)
M0_INTERNAL void m0_be_alloc_aligned(struct m0_be_allocator *a, struct m0_be_tx *tx, struct m0_be_op *op, void **ptr, m0_bcount_t size, unsigned shift, uint64_t zonemask)
m0_bcount_t bas_chunk_overhead
m0_bcount_t bas_space_used
struct m0_be_allocator_call_stats bzs_stats
M0_INTERNAL void m0_be_alloc_stats_credit(struct m0_be_allocator *a, struct m0_be_tx_credit *accum)
m0_bcount_t bas_free_chunks_nr
struct m0_be_allocator_call_stat bacs_free
enum m0_be_alloc_zone_type M0_XCA_ENUM
struct m0_be_allocator_call_stats bas_stat1
struct m0_be_allocator_header * ba_h[M0_BAP_NR]
struct m0_be_allocator_call_stats bas_total
M0_INTERNAL void m0_be_alloc(struct m0_be_allocator *a, struct m0_be_tx *tx, struct m0_be_op *op, void **ptr, m0_bcount_t size)
m0_bcount_t bas_chunks_nr
M0_INTERNAL bool m0_be_allocator__invariant(struct m0_be_allocator *a)
struct m0_be_allocator_call_stat bacs_alloc_failure
uint32_t bzs_type M0_XCA_FENUM(m0_be_alloc_zone_type)
unsigned long bas_print_index
M0_INTERNAL void m0_be_allocator_destroy(struct m0_be_allocator *a, struct m0_be_tx *tx)
struct m0_be_seg * ba_seg
M0_INTERNAL void m0_be_free(struct m0_be_allocator *a, struct m0_be_tx *tx, struct m0_be_op *op, void *ptr)
struct m0_be_allocator_call_stat bacs_alloc_success
unsigned long bas_print_interval
M0_INTERNAL void m0_be_free_aligned(struct m0_be_allocator *a, struct m0_be_tx *tx, struct m0_be_op *op, void *ptr)
static struct m0_be_seg * seg
M0_INTERNAL int m0_be_allocator_create(struct m0_be_allocator *a, struct m0_be_tx *tx, uint32_t *zone_percent, uint32_t zones_nr)
M0_INTERNAL int m0_be_allocator_init(struct m0_be_allocator *a, struct m0_be_seg *seg)
M0_INTERNAL void m0_be_allocator_credit(struct m0_be_allocator *a, enum m0_be_allocator_op optype, m0_bcount_t size, unsigned shift, struct m0_be_tx_credit *accum)
m0_bcount_t bas_space_free
static struct m0_be_ut_backend be
M0_INTERNAL void m0_be_allocator_fini(struct m0_be_allocator *a)