Motr
M0
|
Data Structures | |
struct | m0_cas_ctg |
struct | m0_cas_state |
struct | m0_ctg_op |
Macros | |
#define | CTG_OP_COMBINE(opc, ct) (((uint64_t)(opc)) | ((ct) << 16)) |
Enumerations | |
enum | m0_cas_ctg_format_version { M0_CAS_CTG_FORMAT_VERSION_1 = 1, M0_CAS_CTG_FORMAT_VERSION_2, M0_CAS_CTG_FORMAT_VERSION = M0_CAS_CTG_FORMAT_VERSION_2 } |
enum | m0_cas_state_format_version { M0_CAS_STATE_FORMAT_VERSION_1 = 1, M0_CAS_STATE_FORMAT_VERSION = M0_CAS_STATE_FORMAT_VERSION_1 } |
enum | { M0_CAS_CTG_VAL_HDR_SIZE = sizeof(uint64_t) + sizeof(uint64_t), M0_CAS_CTG_KEY_HDR_SIZE = sizeof(uint64_t) } |
Functions | |
struct m0_cas_ctg | M0_XCA_DOMAIN (be) |
M0_INTERNAL int | m0_ctg_store_init (struct m0_be_domain *dom) |
M0_INTERNAL void | m0_ctg_store_fini (void) |
M0_INTERNAL struct m0_cas_ctg * | m0_ctg_meta (void) |
M0_INTERNAL struct m0_cas_ctg * | m0_ctg_dead_index (void) |
M0_INTERNAL struct m0_cas_ctg * | m0_ctg_ctidx (void) |
M0_INTERNAL void | m0_ctg_op_init (struct m0_ctg_op *ctg_op, struct m0_fom *fom, uint32_t flags) |
M0_INTERNAL int | m0_ctg_op_rc (struct m0_ctg_op *ctg_op) |
M0_INTERNAL void | m0_ctg_op_fini (struct m0_ctg_op *ctg_op) |
M0_INTERNAL int | m0_ctg_meta_insert (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase) |
M0_INTERNAL int | m0_ctg_gc_wait (struct m0_ctg_op *ctg_op, int next_phase) |
M0_INTERNAL int | m0_ctg_dead_index_insert (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase) |
M0_INTERNAL int | m0_ctg_meta_lookup (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase) |
M0_INTERNAL struct m0_cas_ctg * | m0_ctg_meta_lookup_result (struct m0_ctg_op *ctg_op) |
M0_INTERNAL int | m0_ctg_meta_delete (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase) |
M0_INTERNAL int | m0_ctg_insert (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, const struct m0_buf *val, int next_phase) |
M0_INTERNAL int | m0_ctg_lookup_delete (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, struct m0_buf *val, int flags, int next_phase) |
M0_INTERNAL int | m0_ctg_delete (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, int next_phase) |
M0_INTERNAL int | m0_ctg_lookup (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, int next_phase) |
M0_INTERNAL void | m0_ctg_lookup_result (struct m0_ctg_op *ctg_op, struct m0_buf *buf) |
M0_INTERNAL void | m0_ctg_op_get_ver (struct m0_ctg_op *ctg_op, struct m0_crv *out) |
M0_INTERNAL int | m0_ctg_minkey (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase) |
M0_INTERNAL int | m0_ctg_truncate (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, m0_bcount_t limit, int next_phase) |
M0_INTERNAL int | m0_ctg_drop (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase) |
M0_INTERNAL void | m0_ctg_meta_cursor_init (struct m0_ctg_op *ctg_op) |
M0_INTERNAL int | m0_ctg_meta_cursor_get (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase) |
M0_INTERNAL int | m0_ctg_meta_cursor_next (struct m0_ctg_op *ctg_op, int next_phase) |
M0_INTERNAL void | m0_ctg_cursor_init (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg) |
M0_INTERNAL bool | m0_ctg_cursor_is_initialised (struct m0_ctg_op *ctg_op) |
M0_INTERNAL int | m0_ctg_cursor_get (struct m0_ctg_op *ctg_op, const struct m0_buf *key, int next_phase) |
M0_INTERNAL int | m0_ctg_cursor_next (struct m0_ctg_op *ctg_op, int next_phase) |
M0_INTERNAL void | m0_ctg_cursor_kv_get (struct m0_ctg_op *ctg_op, struct m0_buf *key, struct m0_buf *val) |
M0_INTERNAL void | m0_ctg_cursor_put (struct m0_ctg_op *ctg_op) |
M0_INTERNAL void | m0_ctg_cursor_fini (struct m0_ctg_op *ctg_op) |
M0_INTERNAL void | m0_ctg_insert_credit (struct m0_cas_ctg *ctg, m0_bcount_t knob, m0_bcount_t vnob, struct m0_be_tx_credit *accum) |
M0_INTERNAL void | m0_ctg_delete_credit (struct m0_cas_ctg *ctg, m0_bcount_t knob, m0_bcount_t vnob, struct m0_be_tx_credit *accum) |
M0_INTERNAL void | m0_ctg_ctidx_insert_credits (struct m0_cas_id *cid, struct m0_be_tx_credit *accum) |
M0_INTERNAL void | m0_ctg_drop_credit (struct m0_fom *fom, struct m0_be_tx_credit *accum, struct m0_cas_ctg *ctg, m0_bcount_t *limit) |
M0_INTERNAL void | m0_ctg_try_init (struct m0_cas_ctg *ctg) |
M0_INTERNAL void | m0_ctg_fini (struct m0_fom *fom0, struct m0_cas_ctg *ctg) |
M0_INTERNAL void | m0_ctg_mark_deleted_credit (struct m0_be_tx_credit *accum) |
M0_INTERNAL void | m0_ctg_create_credit (struct m0_be_tx_credit *accum) |
M0_INTERNAL void | m0_ctg_dead_clean_credit (struct m0_be_tx_credit *accum) |
M0_INTERNAL void | m0_ctg_ctidx_delete_credits (struct m0_cas_id *cid, struct m0_be_tx_credit *accum) |
M0_INTERNAL int | m0_ctg_ctidx_insert_sync (const struct m0_cas_id *cid, struct m0_be_tx *tx) |
M0_INTERNAL int | m0_ctg_ctidx_delete_sync (const struct m0_cas_id *cid, struct m0_be_tx *tx) |
M0_INTERNAL int | m0_ctg_ctidx_lookup_sync (const struct m0_fid *fid, struct m0_dix_layout **layout) |
M0_INTERNAL int | m0_ctg_mem_place (struct m0_ctg_op *ctg_op, const struct m0_buf *buf, int next_phase) |
M0_INTERNAL void | m0_ctg_mem_place_get (struct m0_ctg_op *ctg_op, struct m0_buf *buf) |
M0_INTERNAL int | m0_ctg_mem_free (struct m0_ctg_op *ctg_op, void *area, int next_phase) |
M0_INTERNAL uint64_t | m0_ctg_rec_nr (void) |
M0_INTERNAL uint64_t | m0_ctg_rec_size (void) |
M0_INTERNAL struct m0_long_lock * | m0_ctg_del_lock (void) |
M0_INTERNAL struct m0_long_lock * | m0_ctg_lock (struct m0_cas_ctg *ctg) |
M0_INTERNAL int | m0_ctg_create (struct m0_be_seg *seg, struct m0_be_tx *tx, struct m0_cas_ctg **out, const struct m0_fid *cas_fid) |
M0_INTERNAL int | m0_ctg__meta_insert (struct m0_be_btree *meta, const struct m0_fid *fid, struct m0_cas_ctg *ctg, struct m0_be_tx *tx) |
M0_INTERNAL int | m0_ctg_meta_find_ctg (struct m0_cas_ctg *meta, const struct m0_fid *ctg_fid, struct m0_cas_ctg **ctg) |
M0_INTERNAL const struct m0_be_btree_kv_ops * | m0_ctg_btree_ops (void) |
M0_INTERNAL void | m0_ctg_state_inc_update (struct m0_be_tx *tx, uint64_t size) |
M0_INTERNAL int | ctgdump (struct m0_motr *motr_ctx, char *fidstr, char *dump_in_hex_str) |
Variables | |
enum m0_cas_ctg_format_version | M0_XCA_DOMAIN |
CAS catalogue store provides an interface to operate with catalogues. It's a thin layer that hides B-tree implementation details. Most of operations are asynchronous. For usability CAS catalogue store provides separate interfaces for operations over meta, catalogue-index and catalogues created by user.
For now CAS catalogue store has two users: CAS service and DIX repair/rebalance service.
Every user of CAS catalogue store must call m0_ctg_store_fini() if it does not need this store anymore. This call is thread-safe. When m0_ctg_store_fini() is called the inner reference counter is atomically decremented. If the last user of CAS catalogue store calls m0_ctg_store_fini() then release of CAS catalogue store inner structures is initiated.
* * +-----------------+ +------------------+ * | | | DIX | * | CAS Service | | repair/rebalance | * | | | service | * +-----------------+ +------------------+ * | | * +-----------+ +-----------+ * | | * | | * V V * +------------------+ * | CAS | * | catalogue | * | store | * +------------------+ * *
The interface of CAS catalogue store is FOM-oriented. For operations that may be done asynchronous the next phase of FOM should be provided. Corresponding functions return the result that shows whether the FOM should wait or can continue immediately. Every user should take care about locking of CAS catalogues.
#define CTG_OP_COMBINE | ( | opc, | |
ct | |||
) | (((uint64_t)(opc)) | ((ct) << 16)) |
Definition at line 241 of file ctg_store.h.
anonymous enum |
Enumerator | |
---|---|
M0_CAS_CTG_VAL_HDR_SIZE | Every value has a header that holds its size and the version of the key-value record. |
M0_CAS_CTG_KEY_HDR_SIZE | Every key has a header that holds the size of the key. |
Definition at line 141 of file ctg_store.h.
Enumerator | |
---|---|
M0_CAS_CTG_FORMAT_VERSION_1 | |
M0_CAS_CTG_FORMAT_VERSION_2 | |
M0_CAS_CTG_FORMAT_VERSION | Current version, should point to the latest version present |
Definition at line 115 of file ctg_store.h.
Enumerator | |
---|---|
M0_CAS_STATE_FORMAT_VERSION_1 | |
M0_CAS_STATE_FORMAT_VERSION | Current version, should point to the latest version present |
Definition at line 130 of file ctg_store.h.
M0_INTERNAL int ctgdump | ( | struct m0_motr * | motr_ctx, |
char * | fidstr, | ||
char * | dump_in_hex_str | ||
) |
Definition at line 2235 of file ctg_store.c.
M0_INTERNAL int m0_ctg__meta_insert | ( | struct m0_be_btree * | meta, |
const struct m0_fid * | fid, | ||
struct m0_cas_ctg * | ctg, | ||
struct m0_be_tx * | tx | ||
) |
Insert record into meta catalogue.
Definition at line 528 of file ctg_store.c.
M0_INTERNAL const struct m0_be_btree_kv_ops* m0_ctg_btree_ops | ( | void | ) |
Get btree ops for ctg tree.
Definition at line 2167 of file ctg_store.c.
M0_INTERNAL int m0_ctg_create | ( | struct m0_be_seg * | seg, |
struct m0_be_tx * | tx, | ||
struct m0_cas_ctg ** | out, | ||
const struct m0_fid * | cas_fid | ||
) |
Creates catalogue store on the segment.
Definition at line 441 of file ctg_store.c.
M0_INTERNAL void m0_ctg_create_credit | ( | struct m0_be_tx_credit * | accum | ) |
Calculates credits necessary to allocate new catalogue and add it to the meta catalogue.
Definition at line 1823 of file ctg_store.c.
M0_INTERNAL struct m0_cas_ctg* m0_ctg_ctidx | ( | void | ) |
Returns a pointer to catalogue-index catalogue context.
Definition at line 2135 of file ctg_store.c.
M0_INTERNAL void m0_ctg_ctidx_delete_credits | ( | struct m0_cas_id * | cid, |
struct m0_be_tx_credit * | accum | ||
) |
Calculates credits for deletion from catalogue-index catalogue.
accum | Accumulated credits. |
Definition at line 1971 of file ctg_store.c.
Synchronous record deletion from catalogue-index catalogue.
cid | CAS ID containing FID/layout to be deleted. |
tx | BE transaction. |
0 on success or negative error code.
Definition at line 2060 of file ctg_store.c.
M0_INTERNAL void m0_ctg_ctidx_insert_credits | ( | struct m0_cas_id * | cid, |
struct m0_be_tx_credit * | accum | ||
) |
Calculates credits for insertion into catalogue-index catalogue.
accum | Accumulated credits. |
Definition at line 1962 of file ctg_store.c.
Synchronous record insertion into catalogue-index catalogue.
cid | CAS ID containing FID/layout to be inserted. |
tx | BE transaction. |
0 on success or negative error code.
Definition at line 2010 of file ctg_store.c.
M0_INTERNAL int m0_ctg_ctidx_lookup_sync | ( | const struct m0_fid * | fid, |
struct m0_dix_layout ** | layout | ||
) |
Synchronous record lookup in catalogue-index catalogue.
[in] | fid | FID of component catalogue. |
[out] | layout | Layout of index which component catalogue with FID belongs to. |
0 on success or negative error code.
Definition at line 1980 of file ctg_store.c.
M0_INTERNAL void m0_ctg_cursor_fini | ( | struct m0_ctg_op * | ctg_op | ) |
Finalises catalogue cursor.
ctg_op | Catalogue operation context. |
Definition at line 1749 of file ctg_store.c.
M0_INTERNAL int m0_ctg_cursor_get | ( | struct m0_ctg_op * | ctg_op, |
const struct m0_buf * | key, | ||
int | next_phase | ||
) |
Positions cursor on record with key . Should be called after m0_ctg_cursor_init().
ctg_op | Catalogue operation context. |
key | Key for cursor positioning. |
next_phase | Next phase of caller FOM. |
Definition at line 1660 of file ctg_store.c.
M0_INTERNAL void m0_ctg_cursor_init | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg | ||
) |
Initialises cursor for catalogue .
ctg_op | Catalogue operation context. |
ctg | Catalogue context. |
Definition at line 1640 of file ctg_store.c.
M0_INTERNAL bool m0_ctg_cursor_is_initialised | ( | struct m0_ctg_op * | ctg_op | ) |
Checks whether catalogue cursor is initialised.
ctg_op | Catalogue operation context. |
Definition at line 1633 of file ctg_store.c.
M0_INTERNAL void m0_ctg_cursor_kv_get | ( | struct m0_ctg_op * | ctg_op, |
struct m0_buf * | key, | ||
struct m0_buf * | val | ||
) |
Gets current key/value under cursor.
[in] | ctg_op | Catalogue operation context. |
[out] | key | Key buffer. |
[out] | val | Value buffer. |
Definition at line 1708 of file ctg_store.c.
M0_INTERNAL int m0_ctg_cursor_next | ( | struct m0_ctg_op * | ctg_op, |
int | next_phase | ||
) |
Moves catalogue cursor to the next record.
ctg_op | Catalogue operation context. |
next_phase | Next phase of caller FOM. |
Definition at line 1680 of file ctg_store.c.
M0_INTERNAL void m0_ctg_cursor_put | ( | struct m0_ctg_op * | ctg_op | ) |
Releases catalogue cursor, should be called before m0_ctg_cursor_fini().
ctg_op | Catalogue operation context. |
Definition at line 1744 of file ctg_store.c.
M0_INTERNAL void m0_ctg_dead_clean_credit | ( | struct m0_be_tx_credit * | accum | ) |
Calculates credits necessary to delete catalogue from "dead index" catalogue and to deallocate it.
Definition at line 1887 of file ctg_store.c.
M0_INTERNAL struct m0_cas_ctg* m0_ctg_dead_index | ( | void | ) |
Returns a pointer to "dead index" catalogue context.
Definition at line 2140 of file ctg_store.c.
M0_INTERNAL int m0_ctg_dead_index_insert | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg, | ||
int | next_phase | ||
) |
Inserts 'ctg' into "dead index" catalogue, therefore scheduling 'ctg' for deletion by index garbage collector.
ctg_op | Catalogue operation context. |
ctg | Catalogue to be inserted in "dead index" catalogue. |
next_phase | Next phase of caller FOM. |
Definition at line 1405 of file ctg_store.c.
M0_INTERNAL struct m0_long_lock* m0_ctg_del_lock | ( | void | ) |
Returns a reference to the catalogue store "delete" long lock.
This lock is used to protect DIX CM iterator current record from concurrent deletion by the client. Iterator holds this lock when some record is in processing and releases it when this record is fully processed, i.e. when a reply from remote copy machine is received. See dix/client.h, "Operation in degraded mode" for more info.
Theoretically, catalogue lock m0_cas_ctg::cc_lock may be used for this purpose, but it leads to a deadlock during repair in the following case: Node 1 Node 2 Iterator gets the catalogue lock Iterator gets the catalogue lock Iterator sends the record to Node 2 Iterator sends the record to Node 1 Iterator waits for a reply Iterator waits for a reply Copy packet foms on both nodes have no chance to insert incoming record into local catalogue, because the catalogue lock is held by the iterator.
This lock is also used exactly the same way when client deletes the whole catalogue in degraded mode.
Definition at line 2157 of file ctg_store.c.
M0_INTERNAL int m0_ctg_delete | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg, | ||
const struct m0_buf * | key, | ||
int | next_phase | ||
) |
Deletes a key/value record from catalogue.
ctg_op | Catalogue operation context. |
ctg | Context of catalogue for record deletion. |
key | Key of record to be inserted. |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1540 of file ctg_store.c.
M0_INTERNAL void m0_ctg_delete_credit | ( | struct m0_cas_ctg * | ctg, |
m0_bcount_t | knob, | ||
m0_bcount_t | vnob, | ||
struct m0_be_tx_credit * | accum | ||
) |
Calculates credits for deletion of record from catalogue.
ctg | Catalogue context. |
knob | Key length. |
knob | Value length. |
accum | Accumulated credits. |
Definition at line 1913 of file ctg_store.c.
M0_INTERNAL int m0_ctg_drop | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg, | ||
int | next_phase | ||
) |
Destroys B-tree associated with a catalogue. B-tree should be empty.
Definition at line 1620 of file ctg_store.c.
M0_INTERNAL void m0_ctg_drop_credit | ( | struct m0_fom * | fom, |
struct m0_be_tx_credit * | accum, | ||
struct m0_cas_ctg * | ctg, | ||
m0_bcount_t * | limit | ||
) |
Calculates credits for destroying catalogue records.
If it's not possible to destroy the catalogue in one BE transaction, then 'accum' contains credits that are necessary to delete 'limit' number of records. 'limit' is a maximum number of records that can be deleted in one BE transaction.
Take only a half of maximum number of credits, and rely on the number of credits for nodes which has to be less than number of credits for the records to be deleted. So that we leave the room for the credits required for nodes deletion.
Credits for all nodes are being calculated inside m0_be_btree_clear_credit(). This is too much and can exceed allowed credits limit. Here, all nodes credits are being adjusted respectively to the number of records used during deletion (records_ok). Statistically the number of node credits after such adjustment has to be reasonable. In general, the following relation is fair: deleted_nodes_nr / all_nodes_nr == records_ok / records_nr.
Definition at line 1841 of file ctg_store.c.
M0_INTERNAL void m0_ctg_fini | ( | struct m0_fom * | fom0, |
struct m0_cas_ctg * | ctg | ||
) |
Finalises and deallocates the catalogue.
Should be called after m0_ctg_drop().
Definition at line 479 of file ctg_store.c.
M0_INTERNAL int m0_ctg_gc_wait | ( | struct m0_ctg_op * | ctg_op, |
int | next_phase | ||
) |
Forces FOM to wait until index garbage collector removes all catalogues pending for deletion in "dead index" catalogue. After garbage collector is done, FOM is waked up in the 'next_phase' phase.
ctg_op | Catalogue operation context. |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1349 of file ctg_store.c.
M0_INTERNAL int m0_ctg_insert | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg, | ||
const struct m0_buf * | key, | ||
const struct m0_buf * | val, | ||
int | next_phase | ||
) |
Inserts a key/value record into catalogue.
ctg_op | Catalogue operation context. |
ctg | Context of catalogue for record insertion. |
key | Key to be inserted. |
val | Value to be inserted. |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1448 of file ctg_store.c.
M0_INTERNAL void m0_ctg_insert_credit | ( | struct m0_cas_ctg * | ctg, |
m0_bcount_t | knob, | ||
m0_bcount_t | vnob, | ||
struct m0_be_tx_credit * | accum | ||
) |
Calculates credits for insertion of record into catalogue.
ctg | Catalogue context. |
knob | Key length. |
knob | Value length. |
accum | Accumulated credits. |
Definition at line 1905 of file ctg_store.c.
M0_INTERNAL struct m0_long_lock* m0_ctg_lock | ( | struct m0_cas_ctg * | ctg | ) |
Returns a reference to the catalogue long lock. This accessor hides internal representation of the long lock, because it needs to be padded.
Definition at line 2162 of file ctg_store.c.
M0_INTERNAL int m0_ctg_lookup | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg, | ||
const struct m0_buf * | key, | ||
int | next_phase | ||
) |
Looks up a key/value record in catalogue.
ctg_op | Catalogue operation context. |
ctg | Context of catalogue for record looking up. |
key | Key of record to be looked up. |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1555 of file ctg_store.c.
M0_INTERNAL int m0_ctg_lookup_delete | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg, | ||
const struct m0_buf * | key, | ||
struct m0_buf * | val, | ||
int | flags, | ||
int | next_phase | ||
) |
Performs lookup of value by key in the catalogue, saves it and then proceeds as normal delete.
ctg_op | Catalogue operation context. |
ctg | Context of catalogue for record deletion. |
key | Key of record to be deleted. |
val | Saved value of record to be deleted. |
flags | Cas op flags from cas_op(fom0)->cg_flags |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1465 of file ctg_store.c.
Gets lookup result.
[in] | ctg_op | Catalogue operation context. |
[out] | buf | Buffer for value. |
Definition at line 1570 of file ctg_store.c.
M0_INTERNAL void m0_ctg_mark_deleted_credit | ( | struct m0_be_tx_credit * | accum | ) |
Calculates credits necessary to move catalogue to "dead index" catalogue.
Definition at line 1805 of file ctg_store.c.
M0_INTERNAL int m0_ctg_mem_free | ( | struct m0_ctg_op * | ctg_op, |
void * | area, | ||
int | next_phase | ||
) |
Definition at line 2117 of file ctg_store.c.
M0_INTERNAL int m0_ctg_mem_place | ( | struct m0_ctg_op * | ctg_op, |
const struct m0_buf * | buf, | ||
int | next_phase | ||
) |
Definition at line 2090 of file ctg_store.c.
M0_INTERNAL struct m0_cas_ctg* m0_ctg_meta | ( | void | ) |
Returns a pointer to meta catalogue context.
Definition at line 2130 of file ctg_store.c.
M0_INTERNAL int m0_ctg_meta_cursor_get | ( | struct m0_ctg_op * | ctg_op, |
const struct m0_fid * | fid, | ||
int | next_phase | ||
) |
Positions cursor on catalogue with FID . Should be called after m0_ctg_meta_cursor_init().
ctg_op | Catalogue operation context. |
fid | FID of catalogue for cursor positioning. |
next_phase | Next phase of caller FOM. |
Definition at line 1729 of file ctg_store.c.
M0_INTERNAL void m0_ctg_meta_cursor_init | ( | struct m0_ctg_op * | ctg_op | ) |
Initialises cursor for meta catalogue.
ctg_op | Catalogue operation context. |
Definition at line 1722 of file ctg_store.c.
M0_INTERNAL int m0_ctg_meta_cursor_next | ( | struct m0_ctg_op * | ctg_op, |
int | next_phase | ||
) |
Moves meta catalogue cursor to the next record.
ctg_op | Catalogue operation context. |
next_phase | Next phase of caller FOM. |
Definition at line 1694 of file ctg_store.c.
M0_INTERNAL int m0_ctg_meta_delete | ( | struct m0_ctg_op * | ctg_op, |
const struct m0_fid * | fid, | ||
int | next_phase | ||
) |
Deletes a catalogue from meta catalogue.
ctg_op | Catalogue operation context. |
fid | FID of catalogue to be deleted. |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1392 of file ctg_store.c.
M0_INTERNAL int m0_ctg_meta_find_ctg | ( | struct m0_cas_ctg * | meta, |
const struct m0_fid * | ctg_fid, | ||
struct m0_cas_ctg ** | ctg | ||
) |
Find the catalogue store pointer from meta catalogue.
Lookup catalogue with provided fid in meta-catalogue synchronously.
Definition at line 503 of file ctg_store.c.
M0_INTERNAL int m0_ctg_meta_insert | ( | struct m0_ctg_op * | ctg_op, |
const struct m0_fid * | fid, | ||
int | next_phase | ||
) |
Creates a new catalogue context and inserts it into meta catalogue.
ctg_op | Catalogue operation context. |
fid | FID of catalogue to be created and inserted into meta catalogue. |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1336 of file ctg_store.c.
M0_INTERNAL int m0_ctg_meta_lookup | ( | struct m0_ctg_op * | ctg_op, |
const struct m0_fid * | fid, | ||
int | next_phase | ||
) |
Looks up a catalogue in meta catalogue.
ctg_op | Catalogue operation context. |
fid | FID of catalogue to be looked up. |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1362 of file ctg_store.c.
M0_INTERNAL struct m0_cas_ctg* m0_ctg_meta_lookup_result | ( | struct m0_ctg_op * | ctg_op | ) |
Gets a pointer to catalogue context that was looked up.
Definition at line 1377 of file ctg_store.c.
M0_INTERNAL int m0_ctg_minkey | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg, | ||
int | next_phase | ||
) |
Gets the minimal key in the tree (wrapper over m0_be_btree_minkey()).
After operation complete min key value is in ctg_op->co_out_key.
ctg_op | Catalogue operation context. ctg Catalogue descriptor. |
next_phase | Next phase of caller FOM. |
M0_FSO_AGAIN or M0_FSO_WAIT.
Definition at line 1593 of file ctg_store.c.
M0_INTERNAL void m0_ctg_op_fini | ( | struct m0_ctg_op * | ctg_op | ) |
Finalises catalogue operation.
ctg_op | Catalogue operation context. |
Definition at line 1788 of file ctg_store.c.
Returns the version of the record the operation ctg_op worked on.
Definition at line 1582 of file ctg_store.c.
Initialises catalogue operation.
ctg_op | Catalogue operation context. |
fom | FOM that needs to execute catalogue operation. |
flags | Catalogue operation flags. |
Definition at line 1759 of file ctg_store.c.
M0_INTERNAL int m0_ctg_op_rc | ( | struct m0_ctg_op * | ctg_op | ) |
Gets result code of executed catalogue operation.
ctg_op | Catalogue operation context. |
Result code of executed catalogue operation.
Definition at line 1779 of file ctg_store.c.
M0_INTERNAL uint64_t m0_ctg_rec_nr | ( | void | ) |
Total number of records in catalogue store in all user (non-meta) catalogues.
Definition at line 2145 of file ctg_store.c.
M0_INTERNAL uint64_t m0_ctg_rec_size | ( | void | ) |
Total size of records in catalogue store in all user (non-meta) catalogues.
Definition at line 2151 of file ctg_store.c.
M0_INTERNAL void m0_ctg_state_inc_update | ( | struct m0_be_tx * | tx, |
uint64_t | size | ||
) |
Update number of records and record size in cas state.
Definition at line 940 of file ctg_store.c.
M0_INTERNAL void m0_ctg_store_fini | ( | void | ) |
Releases one reference to catalogue store context. If the last reference is released then actual finalisation will be done.
Definition at line 870 of file ctg_store.c.
M0_INTERNAL int m0_ctg_store_init | ( | struct m0_be_domain * | dom | ) |
Initialises catalogue store.
Firstly the function looks up into BE segment dictionary for meta catalogue. There are three cases:
In the first case the function looks up into meta catalogue for catalogue-index catalogue. If it is not presented or some error occurred then an error returned.
0 on success or negative error code.
Definition at line 814 of file ctg_store.c.
M0_INTERNAL int m0_ctg_truncate | ( | struct m0_ctg_op * | ctg_op, |
struct m0_cas_ctg * | ctg, | ||
m0_bcount_t | limit, | ||
int | next_phase | ||
) |
Truncates catalogue: destroy all records, but not the B-tree root.
That routine may be called more than once to fit into transaction. 'Limit' is a maximum number of records to be deleted. 'Limit' may be calculated through m0_ctg_drop_credit() (as well as necessary credits).
After truncation is done, m0_ctg_drop() should be called to destroy associated B-tree completely.
Definition at line 1606 of file ctg_store.c.
M0_INTERNAL void m0_ctg_try_init | ( | struct m0_cas_ctg * | ctg | ) |
Initialise catalog meta-data volatile stuff: mutexes etc.
Definition at line 953 of file ctg_store.c.
struct m0_cas_ctg M0_XCA_DOMAIN | ( | be | ) |
struct m0_ctg_op M0_XCA_DOMAIN |