Motr  M0
data-block-allocator

Data Structures

struct  m0_balloc_group_desc
 
struct  m0_balloc_zone_param
 
struct  m0_lext
 
struct  m0_balloc_group_info
 
struct  m0_balloc_super_block
 
struct  m0_balloc
 
struct  m0_balloc_format_req
 
struct  m0_balloc_free_extent
 
struct  m0_balloc_allocate_req
 
struct  m0_balloc_free_req
 
struct  m0_balloc_discard_req
 

Enumerations

enum  m0_balloc_group_desc_format_version { M0_BALLOC_GROUP_DESC_FORMAT_VERSION_1 = 1, M0_BALLOC_GROUP_DESC_FORMAT_VERSION = M0_BALLOC_GROUP_DESC_FORMAT_VERSION_1 }
 
enum  m0_balloc_allocation_flag {
  M0_BALLOC_HINT_MERGE = 1 << 0, M0_BALLOC_HINT_RESERVED = 1 << 1, M0_BALLOC_HINT_METADATA = 1 << 2, M0_BALLOC_HINT_FIRST = 1 << 3,
  M0_BALLOC_HINT_BEST = 1 << 4, M0_BALLOC_HINT_DATA = 1 << 5, M0_BALLOC_HINT_NOPREALLOC = 1 << 6, M0_BALLOC_HINT_GROUP_ALLOC = 1 << 7,
  M0_BALLOC_HINT_GOAL_ONLY = 1 << 8, M0_BALLOC_HINT_TRY_GOAL = 1 << 9, M0_BALLOC_DELALLOC_RESERVED = 1 << 10, M0_BALLOC_STREAM_ALLOC = 1 << 11,
  M0_BALLOC_SPARE_ZONE = 1 << 12, M0_BALLOC_NORMAL_ZONE = 1 << 13
}
 
enum  m0_balloc_group_info_state { M0_BALLOC_GROUP_INFO_INIT = 1 << 0, M0_BALLOC_GROUP_INFO_DIRTY = 1 << 1 }
 
enum  m0_balloc_super_block_state { M0_BALLOC_SB_DIRTY = 1 << 0 }
 
enum  m0_balloc_super_block_version { M0_BALLOC_SB_VERSION = 1ULL }
 
enum  { M0_BALLOC_BUDDY_LOOKUP_MAX = 10 }
 
enum  m0_balloc_format_version { M0_BALLOC_FORMAT_VERSION_1 = 1, M0_BALLOC_FORMAT_VERSION = M0_BALLOC_FORMAT_VERSION_1 }
 
enum  { BALLOC_DEF_CONTAINER_SIZE = 4096ULL * 32 * 1024 * 1000, BALLOC_DEF_BLOCK_SHIFT = 12, BALLOC_DEF_GROUPS_NR = 64, BALLOC_DEF_BLOCKS_PER_GROUP = 32768 }
 

Functions

struct m0_balloc_group_desc M0_XCA_DOMAIN (be)
 
static struct m0_ballocb2m0 (const struct m0_ad_balloc *ballroom)
 
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)
 
M0_INTERNAL void m0_balloc_group_desc_init (struct m0_balloc_group_desc *desc)
 
M0_INTERNAL void m0_balloc_debug_dump_sb (const char *tag, struct m0_balloc_super_block *sb)
 
M0_INTERNAL void m0_balloc_debug_dump_group_extent (const char *tag, struct m0_balloc_group_info *grp)
 
M0_INTERNAL int m0_balloc_release_extents (struct m0_balloc_group_info *grp)
 
M0_INTERNAL int m0_balloc_load_extents (struct m0_balloc *cb, struct m0_balloc_group_info *grp)
 
M0_INTERNAL struct m0_balloc_group_infom0_balloc_gn2info (struct m0_balloc *cb, m0_bindex_t groupno)
 
M0_INTERNAL void m0_balloc_debug_dump_group (const char *tag, 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)
 

Variables

enum m0_balloc_group_desc_format_version M0_XCA_DOMAIN
 

Detailed Description

All data structures stored in db in little-endian format (Intel CPU endian). To correctly compare the key value, a custom specific comparison function is provided to db.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_BALLOC_BUDDY_LOOKUP_MAX 

Definition at line 212 of file balloc.h.

◆ anonymous enum

anonymous enum
Enumerator
BALLOC_DEF_CONTAINER_SIZE 
Todo:
should equal to size of HDD
BALLOC_DEF_BLOCK_SHIFT 
BALLOC_DEF_GROUPS_NR 

Approximate number of groups. Exact number of groups can differ depending on group size restrictions.

BALLOC_DEF_BLOCKS_PER_GROUP 

Used as minimal group size

Definition at line 327 of file balloc.h.

◆ m0_balloc_allocation_flag

Enumerator
M0_BALLOC_HINT_MERGE 

prefer goal again. length

M0_BALLOC_HINT_RESERVED 

blocks already reserved

M0_BALLOC_HINT_METADATA 

metadata is being allocated

M0_BALLOC_HINT_FIRST 

use the first found extent

M0_BALLOC_HINT_BEST 

search for the best chunk

M0_BALLOC_HINT_DATA 

data is being allocated

M0_BALLOC_HINT_NOPREALLOC 

don't preallocate (for tails)

M0_BALLOC_HINT_GROUP_ALLOC 

allocate for locality group

M0_BALLOC_HINT_GOAL_ONLY 

allocate goal blocks or none

M0_BALLOC_HINT_TRY_GOAL 

goal is meaningful

M0_BALLOC_DELALLOC_RESERVED 

blocks already pre-reserved by delayed allocation

M0_BALLOC_STREAM_ALLOC 

We are doing stream allocation

M0_BALLOC_SPARE_ZONE 

Allocate in spare zone.

M0_BALLOC_NORMAL_ZONE 

Allocate in normal zone.

Definition at line 87 of file balloc.h.

◆ m0_balloc_format_version

Enumerator
M0_BALLOC_FORMAT_VERSION_1 
M0_BALLOC_FORMAT_VERSION 

Current version, should point to the latest version present

Definition at line 254 of file balloc.h.

◆ m0_balloc_group_desc_format_version

Enumerator
M0_BALLOC_GROUP_DESC_FORMAT_VERSION_1 
M0_BALLOC_GROUP_DESC_FORMAT_VERSION 

Current version, should point to the latest version present

Definition at line 76 of file balloc.h.

◆ m0_balloc_group_info_state

Enumerator
M0_BALLOC_GROUP_INFO_INIT 

inited from disk

M0_BALLOC_GROUP_INFO_DIRTY 

dirty, need sync

Definition at line 164 of file balloc.h.

◆ m0_balloc_super_block_state

Enumerator
M0_BALLOC_SB_DIRTY 

Definition at line 204 of file balloc.h.

◆ m0_balloc_super_block_version

Enumerator
M0_BALLOC_SB_VERSION 

Definition at line 208 of file balloc.h.

Function Documentation

◆ b2m0()

static struct m0_balloc* b2m0 ( const struct m0_ad_balloc ballroom)
inlinestatic

Definition at line 265 of file balloc.h.

Here is the caller graph for this function:

◆ m0_balloc_create()

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 
)

Creates struct m0_balloc instance with container on back-end segment .

One balloc instance is allocated and initialised per storage domain.

Parameters
fid- unique fid for balloc tree.
See also
struct ad_balloc_ops
Precondition
out != NULL

Definition at line 3015 of file balloc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_balloc_debug_dump_group()

M0_INTERNAL void m0_balloc_debug_dump_group ( const char *  tag,
struct m0_balloc_group_info grp 
)

Definition at line 171 of file balloc.c.

Here is the call graph for this function:

◆ m0_balloc_debug_dump_group_extent()

M0_INTERNAL void m0_balloc_debug_dump_group_extent ( const char *  tag,
struct m0_balloc_group_info grp 
)

Definition at line 192 of file balloc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_balloc_debug_dump_sb()

M0_INTERNAL void m0_balloc_debug_dump_sb ( const char *  tag,
struct m0_balloc_super_block sb 
)

Definition at line 212 of file balloc.c.

Here is the call graph for this function:

◆ m0_balloc_gn2info()

M0_INTERNAL struct m0_balloc_group_info* m0_balloc_gn2info ( struct m0_balloc cb,
m0_bindex_t  groupno 
)

Definition at line 260 of file balloc.c.

Here is the caller graph for this function:

◆ m0_balloc_group_desc_init()

M0_INTERNAL void m0_balloc_group_desc_init ( struct m0_balloc_group_desc desc)

Definition at line 341 of file balloc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_balloc_init()

M0_INTERNAL void m0_balloc_init ( struct m0_balloc cb)

Initialises volatile only fields in m0_balloc

Definition at line 3010 of file balloc.c.

Here is the caller graph for this function:

◆ m0_balloc_load_extents()

M0_INTERNAL int m0_balloc_load_extents ( struct m0_balloc cb,
struct m0_balloc_group_info grp 
)

Definition at line 1273 of file balloc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_balloc_lock_group()

M0_INTERNAL void m0_balloc_lock_group ( struct m0_balloc_group_info grp)

Definition at line 324 of file balloc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_balloc_release_extents()

M0_INTERNAL int m0_balloc_release_extents ( struct m0_balloc_group_info grp)

Definition at line 312 of file balloc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_balloc_trylock_group()

M0_INTERNAL int m0_balloc_trylock_group ( struct m0_balloc_group_info grp)

Definition at line 329 of file balloc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_balloc_unlock_group()

M0_INTERNAL void m0_balloc_unlock_group ( struct m0_balloc_group_info grp)

Definition at line 334 of file balloc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ M0_XCA_DOMAIN()

struct m0_balloc_group_desc M0_XCA_DOMAIN ( be  )

Variable Documentation

◆ M0_XCA_DOMAIN

enum m0_balloc_format_version M0_XCA_DOMAIN