Motr  M0
index_gc.c File Reference
#include "lib/trace.h"
#include "lib/memory.h"
#include "lib/assert.h"
#include "lib/cond.h"
#include "fop/fop.h"
#include "fop/fom_long_lock.h"
#include "fop/fom_generic.h"
#include "rpc/rpc_opcodes.h"
#include "rpc/item.h"
#include "cas/ctg_store.h"
#include "motr/setup.h"
Include dependency graph for index_gc.c:

Go to the source code of this file.

Data Structures

struct  cgc_fom
 
struct  cgc_context
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CAS
 

Enumerations

enum  cgc_fom_phase {
  CGC_TREE_CLEAN = M0_FOPH_TYPE_SPECIFIC, CGC_LOOKUP, CGC_INDEX_FOUND, CGC_CREDITS,
  CGC_TREE_DROP, CGC_LOCK_DEAD_INDEX, CGC_RM_FROM_DEAD_INDEX, CGC_SUCCESS,
  CGC_NR
}
 

Functions

static size_t cgc_fom_home_locality (const struct m0_fom *fom)
 
static int cgc_fom_tick (struct m0_fom *fom)
 
static void cgc_fom_fini (struct m0_fom *fom)
 
static void cgc_retry (void)
 
M0_INTERNAL void m0_cas_gc_init (void)
 
M0_INTERNAL void m0_cas_gc_fini (void)
 
static void cgc_fop_release (struct m0_ref *ref)
 
static void cgc_start_fom (struct m0_fom *fom0, struct m0_fop *fop)
 
M0_INTERNAL void m0_cas_gc_start (struct m0_reqh_service *service)
 
M0_INTERNAL void m0_cas_gc_wait_sync (void)
 
M0_INTERNAL void m0_cas_gc_wait_async (struct m0_be_op *beop)
 

Variables

static struct cgc_context gc
 
static const struct m0_fom_ops cgc_fom_ops
 
M0_INTERNAL struct m0_fop_type cgc_fake_fopt
 
static const struct m0_fom_type_ops cgc_fom_type_ops
 
static struct m0_sm_state_descr cgc_fom_phases []
 
struct m0_sm_trans_descr cgc_fom_trans []
 
static struct m0_sm_conf cgc_sm_conf
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CAS

Definition at line 23 of file index_gc.c.

Enumeration Type Documentation

◆ cgc_fom_phase

Enumerator
CGC_TREE_CLEAN 
CGC_LOOKUP 
CGC_INDEX_FOUND 
CGC_CREDITS 
CGC_TREE_DROP 
CGC_LOCK_DEAD_INDEX 
CGC_RM_FROM_DEAD_INDEX 
CGC_SUCCESS 
CGC_NR 

Definition at line 99 of file index_gc.c.

Function Documentation

◆ cgc_fom_fini()

static void cgc_fom_fini ( struct m0_fom fom0)
static

Finalise current index GC fom and, maybe, start new one.

Definition at line 502 of file index_gc.c.

Here is the call graph for this function:

◆ cgc_fom_home_locality()

static size_t cgc_fom_home_locality ( const struct m0_fom fom)
static

Definition at line 205 of file index_gc.c.

◆ cgc_fom_tick()

static int cgc_fom_tick ( struct m0_fom fom)
static

Definition at line 210 of file index_gc.c.

Here is the call graph for this function:

◆ cgc_fop_release()

static void cgc_fop_release ( struct m0_ref ref)
static

Definition at line 466 of file index_gc.c.

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

◆ cgc_retry()

static void cgc_retry ( void  )
static

Definition at line 415 of file index_gc.c.

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

◆ cgc_start_fom()

static void cgc_start_fom ( struct m0_fom fom0,
struct m0_fop fop 
)
static

Definition at line 477 of file index_gc.c.

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

◆ m0_cas_gc_fini()

M0_INTERNAL void m0_cas_gc_fini ( void  )

Finalises index garbage collector.

Definition at line 455 of file index_gc.c.

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

◆ m0_cas_gc_init()

M0_INTERNAL void m0_cas_gc_init ( void  )

Initialises index garbage collector.

Definition at line 426 of file index_gc.c.

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

◆ m0_cas_gc_start()

M0_INTERNAL void m0_cas_gc_start ( struct m0_reqh_service service)

Instructs index garbage collector to destroy all indices referenced in "dead index" catalogue.

After all records in "dead index" catalogue are processed a garbage collector stops. In other words, garbage collector doesn't monitor the contents of "dead index" catalogue and this function should be called every time when user decides to destroy catalogues referenced in "dead index" catalogue.

Can be called when garbage collector is already started. In this case garbage collector will not stop after destroying catalogues and will recheck "dead index" contents for new records.

Definition at line 549 of file index_gc.c.

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

◆ m0_cas_gc_wait_async()

M0_INTERNAL void m0_cas_gc_wait_async ( struct m0_be_op beop)

Asynchronously waits until garbage collector stops.

Provided 'beop' will be moved to M0_BOS_DONE state once garbage collector stops.

Definition at line 601 of file index_gc.c.

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

◆ m0_cas_gc_wait_sync()

M0_INTERNAL void m0_cas_gc_wait_sync ( void  )

Synchronously waits until garbage collector stops.

Definition at line 591 of file index_gc.c.

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

Variable Documentation

◆ cgc_fake_fopt

M0_INTERNAL struct m0_fop_type cgc_fake_fopt

Definition at line 140 of file index_gc.c.

◆ cgc_fom_ops

const struct m0_fom_ops cgc_fom_ops
static
Initial value:
= {
.fo_fini = &cgc_fom_fini,
.fo_tick = &cgc_fom_tick,
.fo_home_locality = &cgc_fom_home_locality
}
static void cgc_fom_fini(struct m0_fom *fom)
Definition: index_gc.c:502
static int cgc_fom_tick(struct m0_fom *fom)
Definition: index_gc.c:210
static size_t cgc_fom_home_locality(const struct m0_fom *fom)
Definition: index_gc.c:205

Definition at line 134 of file index_gc.c.

◆ cgc_fom_phases

struct m0_sm_state_descr cgc_fom_phases[]
static

Definition at line 146 of file index_gc.c.

◆ cgc_fom_trans

struct m0_sm_trans_descr cgc_fom_trans[]
Initial value:
= {
{ "cgc-starting", M0_FOPH_TXN_INIT, CGC_LOOKUP },
{ "cgc-index-lookup", CGC_LOOKUP, CGC_INDEX_FOUND },
{ "cgc-start-txn", CGC_INDEX_FOUND, M0_FOPH_TXN_INIT },
{ "cgc-no-job", CGC_INDEX_FOUND, M0_FOPH_SUCCESS },
{ "cgc-starting", M0_FOPH_TXN_OPEN, CGC_CREDITS },
{ "cgc-credits", CGC_CREDITS, M0_FOPH_TXN_OPEN },
{ "cgc-tree-drop", CGC_TREE_CLEAN, CGC_TREE_DROP },
{ "cgc-start-lock", CGC_TREE_DROP, CGC_LOCK_DEAD_INDEX },
{ "cgc-commit-clean", CGC_TREE_DROP, M0_FOPH_SUCCESS },
{ "cgc-forget", CGC_RM_FROM_DEAD_INDEX, CGC_SUCCESS },
{ "cgc-done", CGC_SUCCESS, M0_FOPH_SUCCESS }
}
struct m0_sm_trans_descr m0_generic_phases_trans[]
Definition: fom_generic.c:765
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 181 of file index_gc.c.

◆ cgc_fom_type_ops

const struct m0_fom_type_ops cgc_fom_type_ops
static
Initial value:
= {
.fto_create = NULL
}
#define NULL
Definition: misc.h:38

Definition at line 142 of file index_gc.c.

◆ cgc_sm_conf

struct m0_sm_conf cgc_sm_conf
static
Initial value:
= {
.scf_name = "cgc-fom",
.scf_nr_states = ARRAY_SIZE(cgc_fom_phases),
.scf_state = cgc_fom_phases,
.scf_trans_nr = ARRAY_SIZE(cgc_fom_trans),
.scf_trans = cgc_fom_trans
}
struct m0_sm_trans_descr cgc_fom_trans[]
Definition: index_gc.c:181
static struct m0_sm_state_descr cgc_fom_phases[]
Definition: index_gc.c:146
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 197 of file index_gc.c.

◆ gc

struct cgc_context gc
static

Definition at line 132 of file index_gc.c.