|
static int | btree_lookup_sync (struct m0_be_btree *tree, const struct m0_buf *key, struct m0_buf *val) |
|
static int | btree_insert_sync (struct m0_be_btree *tree, struct m0_be_tx *tx, const struct m0_buf *key, const struct m0_buf *val) |
|
static int | btree_update_sync (struct m0_be_btree *tree, struct m0_be_tx *tx, const struct m0_buf *key, const struct m0_buf *val) |
|
static int | btree_delete_sync (struct m0_be_btree *tree, struct m0_be_tx *tx, const struct m0_buf *key) |
|
static int | is_group_good_enough (struct balloc_allocation_context *bac, m0_bcount_t maxchunk, m0_bcount_t free, m0_bcount_t fragments) |
|
static m0_bindex_t | zone_start_get (struct m0_balloc_group_info *grp, enum m0_balloc_allocation_flag alloc_flag) |
|
static int | allocate_blocks (int cr, struct balloc_allocation_context *bac, struct m0_balloc_group_info *grp, m0_bcount_t len, enum m0_balloc_allocation_flag alloc_type) |
|
static m0_bcount_t | group_spare_freeblocks_get (struct m0_balloc_group_info *grp) |
|
static m0_bcount_t | group_freeblocks_get (struct m0_balloc_group_info *grp) |
|
static m0_bcount_t | group_maxchunk_get (struct m0_balloc_group_info *grp) |
|
static m0_bcount_t | group_spare_maxchunk_get (struct m0_balloc_group_info *grp) |
|
static m0_bcount_t | group_fragments_get (struct m0_balloc_group_info *grp) |
|
static m0_bcount_t | group_spare_fragments_get (struct m0_balloc_group_info *grp) |
|
static struct m0_list * | group_normal_ext (struct m0_balloc_group_info *grp) |
|
static struct m0_list * | group_spare_ext (struct m0_balloc_group_info *grp) |
|
static void | balloc_zone_init (struct m0_balloc_zone_param *zone, uint64_t type, m0_bcount_t start, m0_bcount_t size, m0_bcount_t freeblocks, m0_bcount_t fragments, m0_bcount_t maxchunk) |
|
static uint64_t | ext_range_locate (struct m0_ext *ip_ext, struct m0_balloc_group_info *grp) |
|
static bool | is_spare (uint64_t alloc_flags) |
|
static bool | is_normal (uint64_t alloc_flags) |
|
static bool | is_any (uint64_t alloc_flag) |
|
static void | balloc_debug_dump_extent (const char *tag, struct m0_ext *ex) |
|
M0_INTERNAL void | m0_balloc_debug_dump_group (const char *tag, struct m0_balloc_group_info *grp) |
|
M0_INTERNAL void | m0_balloc_debug_dump_group_extent (const char *tag, struct m0_balloc_group_info *grp) |
|
M0_INTERNAL void | m0_balloc_debug_dump_sb (const char *tag, struct m0_balloc_super_block *sb) |
|
static m0_bindex_t | balloc_bn2gn (m0_bindex_t blockno, struct m0_balloc *cb) |
|
M0_INTERNAL struct m0_balloc_group_info * | m0_balloc_gn2info (struct m0_balloc *cb, m0_bindex_t groupno) |
|
static struct m0_mutex * | bgi_mutex (struct m0_balloc_group_info *grp) |
|
static void | lext_del (struct m0_lext *le) |
|
static struct m0_lext * | lext_create (struct m0_ext *ex) |
|
static void | extents_release (struct m0_balloc_group_info *grp, enum m0_balloc_allocation_flag zone_type) |
|
M0_INTERNAL int | m0_balloc_release_extents (struct m0_balloc_group_info *grp) |
|
M0_INTERNAL void | m0_balloc_lock_group (struct m0_balloc_group_info *grp) |
|
M0_INTERNAL int | m0_balloc_trylock_group (struct m0_balloc_group_info *grp) |
|
M0_INTERNAL void | m0_balloc_unlock_group (struct m0_balloc_group_info *grp) |
|
M0_INTERNAL void | m0_balloc_group_desc_init (struct m0_balloc_group_desc *desc) |
|
static void | balloc_format_init (struct m0_balloc *cb) |
|
static int | balloc_group_info_init (struct m0_balloc_group_info *gi, struct m0_balloc *cb) |
|
static void | balloc_group_info_fini (struct m0_balloc_group_info *gi) |
|
static int | balloc_group_info_load (struct m0_balloc *bal) |
|
static void | balloc_fini_internal (struct m0_balloc *bal) |
|
static m0_bcount_t | ge_tree_kv_size (const void *kv) |
|
static int | ge_tree_cmp (const void *k0, const void *k1) |
|
static m0_bcount_t | gd_tree_key_size (const void *k) |
|
static m0_bcount_t | gd_tree_val_size (const void *v) |
|
static int | gd_tree_cmp (const void *k0, const void *k1) |
|
static void | balloc_sb_sync (struct m0_balloc *cb, struct m0_be_tx *tx) |
|
static int | sb_update (struct m0_balloc *bal, struct m0_sm_group *grp) |
|
static int | balloc_sb_write (struct m0_balloc *bal, struct m0_balloc_format_req *req, struct m0_sm_group *grp) |
|
static void | balloc_group_write_credit (struct m0_balloc *bal, struct m0_be_tx_bulk *tb, struct balloc_groups_write_cfg *bgs, struct m0_be_tx_credit *credit) |
|
static void | balloc_group_work_put (struct m0_balloc *bal, struct m0_be_tx_bulk *tb, struct balloc_groups_write_cfg *bgs) |
|
static void | balloc_group_write_do (struct m0_be_tx_bulk *tb, struct m0_be_tx *tx, struct m0_be_op *op, void *datum, void *user, uint64_t worker_index, uint64_t partition) |
|
static void | balloc_group_write_done (struct m0_be_tx_bulk *tb, void *datum, void *user, uint64_t worker_index, uint64_t partition) |
|
static int | balloc_groups_write (struct m0_balloc *bal) |
|
static int | balloc_format (struct m0_balloc *bal, struct m0_balloc_format_req *req, struct m0_sm_group *grp) |
|
static void | balloc_gi_sync_credit (const struct m0_balloc *cb, struct m0_be_tx_credit *accum) |
|
static int | balloc_gi_sync (struct m0_balloc *cb, struct m0_be_tx *tx, struct m0_balloc_group_info *gi) |
|
static int | sb_mount (struct m0_balloc *bal, struct m0_sm_group *grp) |
|
static int | balloc_init_internal (struct m0_balloc *bal, struct m0_be_seg *seg, struct m0_sm_group *grp, uint32_t bshift, m0_bcount_t container_size, m0_bcount_t blocks_per_group, m0_bcount_t spare_blocks_per_group) |
|
static int | balloc_init_ac (struct balloc_allocation_context *bac, struct m0_balloc *motr, struct m0_be_tx *tx, struct m0_balloc_allocate_req *req) |
|
static int | balloc_use_prealloc (struct balloc_allocation_context *bac) |
|
static bool | balloc_got_freespace (const struct m0_balloc *ctx, m0_bcount_t blocks, uint64_t alloc_flags) |
|
static void | balloc_normalize_group_request (struct balloc_allocation_context *bac) |
|
static void | balloc_normalize_request (struct balloc_allocation_context *bac) |
|
static void | zone_params_update (struct m0_balloc_group_info *grp, struct m0_ext *ext, uint64_t balloc_zone) |
|
M0_INTERNAL int | m0_balloc_load_extents (struct m0_balloc *cb, struct m0_balloc_group_info *grp) |
|
static int | balloc_find_extent_buddy (struct balloc_allocation_context *bac, struct m0_balloc_group_info *grp, m0_bcount_t len, enum m0_balloc_allocation_flag alloc_flag, struct m0_ext *ex) |
|
static int | balloc_use_best_found (struct balloc_allocation_context *bac, m0_bindex_t start) |
|
static int | balloc_new_preallocation (struct balloc_allocation_context *bac) |
|
static void | balloc_sb_sync_credit (const struct m0_balloc *bal, struct m0_be_tx_credit *accum) |
|
static void | balloc_db_update_credit (const struct m0_balloc *bal, int nr, struct m0_be_tx_credit *accum) |
|
static bool | is_extent_free (struct m0_balloc_group_info *grp, const struct m0_ext *tgt, uint64_t alloc_type, struct m0_ext **current) |
|
static int | balloc_alloc_db_update (struct m0_balloc *motr, struct m0_be_tx *tx, struct m0_balloc_group_info *grp, struct m0_ext *tgt, uint64_t alloc_type, struct m0_ext *cur) |
|
static int | balloc_free_db_update (struct m0_balloc *motr, struct m0_be_tx *tx, struct m0_balloc_group_info *grp, struct m0_ext *tgt, uint64_t alloc_flag) |
|
static int | balloc_is_good_group (struct balloc_allocation_context *bac, struct m0_balloc_group_info *gi) |
|
static int | balloc_simple_scan_group (struct balloc_allocation_context *bac, struct m0_balloc_group_info *grp, enum m0_balloc_allocation_flag alloc_flag) |
|
| __attribute__ ((unused)) |
|
static int | balloc_check_limits (struct balloc_allocation_context *bac, struct m0_balloc_group_info *grp, int end_of_group, enum m0_balloc_allocation_flag alloc_flag) |
|
static int | balloc_measure_extent (struct balloc_allocation_context *bac, struct m0_balloc_group_info *grp, enum m0_balloc_allocation_flag alloc_flag, struct m0_ext *ex, int end_of_group) |
|
static int | balloc_wild_scan_group (struct balloc_allocation_context *bac, struct m0_balloc_group_info *grp, enum m0_balloc_allocation_flag alloc_flag) |
|
static int | balloc_try_best_found (struct balloc_allocation_context *bac, enum m0_balloc_allocation_flag alloc_flag) |
|
static void | balloc_alloc_credit (const struct m0_ad_balloc *balroom, int nr, struct m0_be_tx_credit *accum) |
|
static bool | is_free_space_unavailable (struct m0_balloc_group_info *grp, uint64_t alloc_flags) |
|
static int | balloc_regular_allocator (struct balloc_allocation_context *bac) |
|
static int | balloc_allocate_internal (struct m0_balloc *ctx, struct m0_be_tx *tx, struct m0_balloc_allocate_req *req) |
|
static void | balloc_free_credit (const struct m0_ad_balloc *balroom, int nr, struct m0_be_tx_credit *accum) |
|
static int | balloc_free_internal (struct m0_balloc *ctx, struct m0_be_tx *tx, struct m0_balloc_free_req *req) |
|
static int | balloc_reserve_extent (struct m0_ad_balloc *ballroom, struct m0_be_tx *tx, struct m0_ext *ext, uint64_t alloc_zone) |
|
static int | balloc_alloc (struct m0_ad_balloc *ballroom, struct m0_dtx *tx, m0_bcount_t count, struct m0_ext *out, uint64_t alloc_zone) |
|
static int | balloc_free (struct m0_ad_balloc *ballroom, struct m0_dtx *tx, struct m0_ext *ext) |
|
static int | balloc_init (struct m0_ad_balloc *ballroom, struct m0_be_seg *db, uint32_t bshift, m0_bcount_t container_size, m0_bcount_t blocks_per_group, m0_bcount_t spare_blocks_per_group) |
|
static void | balloc_fini (struct m0_ad_balloc *ballroom) |
|
static int | balloc_trees_create (struct m0_balloc *bal, struct m0_be_tx *tx, const struct m0_fid *fid) |
|
M0_INTERNAL void | m0_balloc_init (struct m0_balloc *cb) |
|
M0_INTERNAL int | m0_balloc_create (uint64_t cid, struct m0_be_seg *seg, struct m0_sm_group *grp, struct m0_balloc **out, const struct m0_fid *fid) |
|
Allocate multiple blocks for some object.
This routine will search suitable free space, and determine where to allocate from. Caller can provide some hint (goal). Pre-allocation is used depending the character of the I/O sequences, and the current state of the active I/O. When trying allocate blocks from free space, we will allocate from the best suitable chunks, which are represented as buddy.
Allocation will first try to use pre-allocation if it exists. Pre-allocation can be per-object, or group based.
This routine will first check the group description to see if enough free space is available, and if largest contiguous chunk satisfy the request. This checking will be done group by group, until allocation succeeded or failed. If failed, the largest available contiguous chunk size is returned, and the caller can decide whether to use a smaller request.
While searching free space from group to group, the free space extent will be loaded into cache. We cache as much free space extent up to some specified memory limitation. This is a configurable parameter, or default value will be chosen based on system memory.
- Parameters
-
ctx | balloc operation context environment. |
req | allocate request which includes all parameters. |
- Returns
- 0 means success. Result allocated blocks are again stored in "req": result physical block number = bar_physical, result count of blocks = bar_len. Upon failure, non-zero error number is returned.
Definition at line 2600 of file balloc.c.