Motr  M0
balloc.h File Reference
#include "lib/ext.h"
#include "lib/types.h"
#include "lib/list.h"
#include "lib/mutex.h"
#include "be/btree.h"
#include "be/btree_xc.h"
#include "format/format.h"
#include "stob/ad.h"
#include "stob/ad_xc.h"
Include dependency graph for balloc.h:

Go to the source code of this file.

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
 

Macros

#define __MOTR_BALLOC_BALLOC_H__
 

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

struct m0_format_header bgd_header
 
m0_bindex_t bgd_groupno
 
m0_bcount_t bgd_freeblocks
 
m0_bcount_t bgd_fragments
 
m0_bcount_t bgd_maxchunk
 
struct m0_format_footer bgd_footer
 
enum m0_balloc_group_desc_format_version M0_XCA_DOMAIN
 
uint64_t bsb_magic
 
uint64_t bsb_state
 
uint64_t bsb_version
 
uint8_t bsb_uuid [128]
 
m0_bcount_t bsb_totalsize
 
m0_bcount_t bsb_freeblocks
 
m0_bcount_t bsb_blocksize
 
m0_bcount_t bsb_groupsize
 
uint32_t bsb_bsbits
 
uint32_t bsb_gsbits
 
m0_bcount_t bsb_groupcount
 
m0_bcount_t bsb_prealloc_count
 
uint64_t bsb_format_time
 
uint64_t bsb_write_time
 
uint64_t bsb_mnt_time
 
uint64_t bsb_last_check_time
 
uint64_t bsb_mnt_count
 
uint64_t bsb_max_mnt_count
 
m0_bcount_t bsb_stripe_size
 
struct m0_format_header cb_header
 
uint64_t cb_container_id
 
struct m0_balloc_super_block cb_sb
 
m0_bindex_t cb_last
 
struct m0_ad_balloc cb_ballroom
 
struct m0_format_footer cb_footer
 
struct m0_be_btree cb_db_group_extents
 
struct m0_be_btree cb_db_group_desc
 
struct m0_balloc_group_infocb_group_info
 
struct m0_be_mutex cb_sb_mutex
 
struct m0_be_segcb_be_seg
 

Macro Definition Documentation

◆ __MOTR_BALLOC_BALLOC_H__

#define __MOTR_BALLOC_BALLOC_H__

Definition at line 26 of file balloc.h.

Variable Documentation

◆ bgd_footer

struct m0_format_footer bgd_footer

Definition at line 653 of file balloc.h.

◆ bgd_fragments

m0_bcount_t bgd_fragments

nr of freespace fragments

Definition at line 640 of file balloc.h.

◆ bgd_freeblocks

m0_bcount_t bgd_freeblocks

total free blocks

Definition at line 638 of file balloc.h.

◆ bgd_groupno

m0_bindex_t bgd_groupno

group number

Definition at line 636 of file balloc.h.

◆ bgd_header

struct m0_format_header bgd_header

Definition at line 634 of file balloc.h.

◆ bgd_maxchunk

m0_bcount_t bgd_maxchunk

max bytes of freespace chunk

Definition at line 642 of file balloc.h.

◆ bsb_blocksize

m0_bcount_t bsb_blocksize

block size in bytes

Definition at line 645 of file balloc.h.

◆ bsb_bsbits

uint32_t bsb_bsbits

block size bits: power of 2

Definition at line 647 of file balloc.h.

◆ bsb_format_time

uint64_t bsb_format_time

Definition at line 652 of file balloc.h.

◆ bsb_freeblocks

m0_bcount_t bsb_freeblocks

nr of free blocks

Definition at line 640 of file balloc.h.

◆ bsb_groupcount

m0_bcount_t bsb_groupcount

of group

Definition at line 649 of file balloc.h.

◆ bsb_groupsize

m0_bcount_t bsb_groupsize

group size in blocks

Definition at line 646 of file balloc.h.

◆ bsb_gsbits

uint32_t bsb_gsbits

group size bits: power of 2

Definition at line 648 of file balloc.h.

◆ bsb_last_check_time

uint64_t bsb_last_check_time

Definition at line 655 of file balloc.h.

◆ bsb_magic

uint64_t bsb_magic

Definition at line 634 of file balloc.h.

◆ bsb_max_mnt_count

uint64_t bsb_max_mnt_count

Definition at line 658 of file balloc.h.

◆ bsb_mnt_count

uint64_t bsb_mnt_count

Definition at line 657 of file balloc.h.

◆ bsb_mnt_time

uint64_t bsb_mnt_time

Definition at line 654 of file balloc.h.

◆ bsb_prealloc_count

m0_bcount_t bsb_prealloc_count

nr of pre-alloc blocks

Definition at line 650 of file balloc.h.

◆ bsb_state

uint64_t bsb_state

Definition at line 635 of file balloc.h.

◆ bsb_stripe_size

m0_bcount_t bsb_stripe_size

stripe size in blocks

Definition at line 660 of file balloc.h.

◆ bsb_totalsize

m0_bcount_t bsb_totalsize

total size in bytes

Definition at line 639 of file balloc.h.

◆ bsb_uuid

uint8_t bsb_uuid[128]

Definition at line 637 of file balloc.h.

◆ bsb_version

uint64_t bsb_version

Definition at line 636 of file balloc.h.

◆ bsb_write_time

uint64_t bsb_write_time

Definition at line 653 of file balloc.h.

◆ cb_ballroom

struct m0_ad_balloc cb_ballroom

Definition at line 643 of file balloc.h.

◆ cb_be_seg

struct m0_be_seg* cb_be_seg

Definition at line 663 of file balloc.h.

◆ cb_container_id

uint64_t cb_container_id

container this block allocator belongs to.

Definition at line 637 of file balloc.h.

◆ cb_db_group_desc

struct m0_be_btree cb_db_group_desc

db for group desc

Definition at line 653 of file balloc.h.

◆ cb_db_group_extents

struct m0_be_btree cb_db_group_extents

db for free extent

Definition at line 651 of file balloc.h.

◆ cb_footer

struct m0_format_footer cb_footer

Definition at line 644 of file balloc.h.

◆ cb_group_info

struct m0_balloc_group_info* cb_group_info

array of group info

Definition at line 660 of file balloc.h.

◆ cb_header

struct m0_format_header cb_header

Definition at line 634 of file balloc.h.

◆ cb_last

m0_bindex_t cb_last

Definition at line 641 of file balloc.h.

◆ cb_sb

struct m0_balloc_super_block cb_sb

the on-disk and in-memory sb

Definition at line 639 of file balloc.h.

◆ cb_sb_mutex

struct m0_be_mutex cb_sb_mutex

super block lock

Definition at line 662 of file balloc.h.