Motr
M0
|
#include "lib/vec.h"
#include "lib/types.h"
#include "lib/memory.h"
#include "lib/errno.h"
#include "sm/sm.h"
#include "layout/layout.h"
#include "ioservice/fid_convert.h"
#include "motr/addb.h"
#include "motr/client.h"
#include "motr/client_internal.h"
#include "motr/layout.h"
#include "motr/sync.h"
#include "lib/trace.h"
#include "lib/finject.h"
Go to the source code of this file.
Macros | |
#define | M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT |
Enumerations | |
enum | { MAX_OPCODE = 256 } |
Functions | |
M0_BOB_DEFINE (M0_INTERNAL, &oc_bobtype, m0_op_common) | |
M0_BOB_DEFINE (M0_INTERNAL, &oo_bobtype, m0_op_obj) | |
M0_BOB_DEFINE (M0_INTERNAL, &op_bobtype, m0_op) | |
M0_BOB_DEFINE (M0_INTERNAL, &ar_bobtype, m0_ast_rc) | |
M0_INTERNAL struct m0_client * | m0__entity_instance (const struct m0_entity *entity) |
M0_INTERNAL struct m0_client * | m0__op_instance (const struct m0_op *op) |
M0_INTERNAL struct m0_op * | m0__ioo_to_op (struct m0_op_io *ioo) |
M0_INTERNAL bool | m0__is_oostore (struct m0_client *instance) |
M0_INTERNAL struct m0_client * | m0__obj_instance (const struct m0_obj *obj) |
M0_INTERNAL struct m0_client * | m0__idx_instance (const struct m0_idx *idx) |
M0_INTERNAL struct m0_locality * | m0__locality_pick (struct m0_client *cinst) |
M0_INTERNAL bool | m0_entity_type_is_valid (enum m0_entity_type type) |
M0_INTERNAL bool | entity_invariant_full (struct m0_entity *ent) |
M0_INTERNAL bool | entity_invariant_locked (const struct m0_entity *ent) |
M0_INTERNAL bool | m0_op_invariant (const struct m0_op *op) |
M0_INTERNAL bool | m0_op_entity_invariant (const struct m0_op *op) |
M0_INTERNAL bool | entity_id_is_valid (const struct m0_uint128 *id) |
M0_INTERNAL void | m0_entity_init (struct m0_entity *entity, struct m0_realm *parent, const struct m0_uint128 *id, const enum m0_entity_type type) |
void | m0_obj_init (struct m0_obj *obj, struct m0_realm *parent, const struct m0_uint128 *id, uint64_t layout_id) |
void | m0_entity_fini (struct m0_entity *entity) |
void | m0_obj_fini (struct m0_obj *obj) |
M0_INTERNAL int | m0_op_executed (struct m0_op *op) |
M0_INTERNAL int | m0_op_stable (struct m0_op *op) |
M0_INTERNAL int | m0_op_failed (struct m0_op *op) |
M0_INTERNAL int | m0_op_get (struct m0_op **op, size_t size) |
M0_INTERNAL void | m0_op_cancel_one (struct m0_op *op) |
void | m0_op_cancel (struct m0_op **op, uint32_t nr) |
static void | addb2_add_op_attrs (const struct m0_op *op) |
M0_INTERNAL void | m0_op_launch_one (struct m0_op *op) |
void | m0_op_launch (struct m0_op **op, uint32_t nr) |
int32_t | m0_op_wait (struct m0_op *op, uint64_t bits, m0_time_t to) |
M0_INTERNAL int | m0_op_alloc (struct m0_op **op, size_t op_size) |
M0_INTERNAL int | m0_op_init (struct m0_op *op, const struct m0_sm_conf *conf, struct m0_entity *entity) |
void | m0_op_fini (struct m0_op *op) |
void | m0_op_free (struct m0_op *op) |
void | m0_op_setup (struct m0_op *op, const struct m0_op_ops *cbs, m0_time_t linger) |
void | m0_op_kick (struct m0_op *op) |
int32_t | m0_rc (const struct m0_op *op) |
Variables | |
const struct m0_bob_type | oc_bobtype |
const struct m0_bob_type | oo_bobtype |
const struct m0_bob_type | op_bobtype |
const struct m0_bob_type | ar_bobtype |
const struct m0_uint128 | M0_UBER_REALM = {0UL, 1ULL} |
const struct m0_uint128 | M0_ID_APP = { 0ULL, 0x100000ULL } |
static uint64_t | opcount [MAX_OPCODE] |
struct m0_sm_state_descr | m0_op_phases [] |
struct m0_sm_trans_descr | m0_op_trans [] |
struct m0_sm_conf | m0_op_conf |
struct m0_sm_state_descr | entity_phases [] |
struct m0_sm_trans_descr | entity_trans [] |
struct m0_sm_conf | entity_conf |
|
static |
M0_INTERNAL bool entity_id_is_valid | ( | const struct m0_uint128 * | id | ) |
M0_INTERNAL bool entity_invariant_full | ( | struct m0_entity * | ent | ) |
M0_INTERNAL bool entity_invariant_locked | ( | const struct m0_entity * | ent | ) |
M0_INTERNAL bool m0__is_oostore | ( | struct m0_client * | instance | ) |
M0_INTERNAL struct m0_locality* m0__locality_pick | ( | struct m0_client * | cinst | ) |
Pick a locality: Motr and the new locality interface(chore) now uses TLS to store data and these data are set when a "motr" thread is created. An application thread (not the main thread calling m0_init, considering ST multi-threading framework), it doesn't have the same TLS by nature, which causes a problem when it calls motr functions like m0_locality_here/get directly as below.
Ensure to use m0_thread_adopt/shun to make a thread (non-)motrism when a thread starts/ends.
TODO: more intelligent locality selection policy based on fid and workload.
Definition at line 290 of file client.c.
M0_BOB_DEFINE | ( | M0_INTERNAL | , |
& | oc_bobtype, | ||
m0_op_common | |||
) |
M0_BOB_DEFINE | ( | M0_INTERNAL | , |
& | oo_bobtype, | ||
m0_op_obj | |||
) |
M0_BOB_DEFINE | ( | M0_INTERNAL | , |
& | op_bobtype, | ||
m0_op | |||
) |
M0_BOB_DEFINE | ( | M0_INTERNAL | , |
& | ar_bobtype, | ||
m0_ast_rc | |||
) |
M0_INTERNAL void m0_entity_init | ( | struct m0_entity * | entity, |
struct m0_realm * | parent, | ||
const struct m0_uint128 * | id, | ||
const enum m0_entity_type | type | ||
) |
M0_INTERNAL bool m0_entity_type_is_valid | ( | enum m0_entity_type | type | ) |
M0_INTERNAL int m0_op_alloc | ( | struct m0_op ** | op, |
size_t | op_size | ||
) |
Allocates memory for an operation.
[out] | op | Pointer to the allocated operation. |
op_size | Size of the operation to be allocated. Must be greater than sizeof(struct m0_op_common). |
Definition at line 779 of file client.c.
M0_INTERNAL void m0_op_cancel_one | ( | struct m0_op * | op | ) |
M0_INTERNAL bool m0_op_entity_invariant | ( | const struct m0_op * | op | ) |
M0_INTERNAL int m0_op_executed | ( | struct m0_op * | op | ) |
----------------------------------------------------------------------——*
This executes the optional user-provided callback. Called with the group lock held.
mach | The state machine which has changed to this state. |
Definition at line 500 of file client.c.
M0_INTERNAL int m0_op_failed | ( | struct m0_op * | op | ) |
Callback triggered by the state machine entering the 'FAILED' state. This in turn finds and executes the optional user-provided callback. Called with the group lock held.
mach | The state machine which has changed to this state. |
Definition at line 548 of file client.c.
M0_INTERNAL int m0_op_get | ( | struct m0_op ** | op, |
size_t | size | ||
) |
M0_INTERNAL int m0_op_init | ( | struct m0_op * | op, |
const struct m0_sm_conf * | conf, | ||
struct m0_entity * | entity | ||
) |
Initialises a client operation in its most generic form.
op | Operation being initialised. |
conf | Configuration for the operation state machine. |
entity | Entity the operation is targeted to. |
Definition at line 806 of file client.c.
M0_INTERNAL bool m0_op_invariant | ( | const struct m0_op * | op | ) |
M0_INTERNAL void m0_op_launch_one | ( | struct m0_op * | op | ) |
Launches a single operation, called from m0_op_launch.
* PRE(op != NULL); PRE(op->op_sm.sm_state == M0_OS_INITIALISED); PRE(ergo(op->op_entity != NULL, entity_invariant_full(op->op_entity)); PRE((op->op_size >= sizeof(*oc)));
op | The operation to be launch |
Definition at line 686 of file client.c.
M0_INTERNAL int m0_op_stable | ( | struct m0_op * | op | ) |
This in turn finds and executes the optional user-provided callback. Called with the group lock held.
mach | The state machine which has changed to this state. |
Definition at line 520 of file client.c.
const struct m0_bob_type ar_bobtype |
struct m0_sm_conf entity_conf |
Configuration structure for the client entity state machine.
struct m0_sm_state_descr entity_phases[] |
struct m0_sm_trans_descr entity_trans[] |
Textual descriptions for the valid state machine transitions.
struct m0_sm_state_descr m0_op_phases[] |
State machine phases for client operations. Note: sd_flags of OS_EXECUTED is set to M0_SDF_TERMINAL to allow an APP to wait on this state
struct m0_sm_trans_descr m0_op_trans[] |
Textual descriptions for the valid state machine transitions.
const struct m0_bob_type oc_bobtype |
Bob definitions
const struct m0_bob_type oo_bobtype |
const struct m0_bob_type op_bobtype |
|
static |