Motr
M0
|
#include "module/instance.h"
#include "motr/init.h"
#include "ioservice/io_fops.h"
#include "conf/schema.h"
#include "conf/confc.h"
#include "layout/pdclust.h"
#include "pool/pool.h"
#include "reqh/reqh.h"
#include "rm/rm.h"
#include "rm/rm_rwlock.h"
#include "lib/refs.h"
#include "lib/hash.h"
#include "file/file.h"
#include "motr/ha.h"
#include "addb2/identifier.h"
#include "be/ut/helper.h"
#include "motr/client.h"
#include "motr/idx.h"
#include "motr/pg.h"
#include "motr/sync.h"
#include "fop/fop.h"
#include "dtm0/domain.h"
Go to the source code of this file.
Data Structures | |
struct | m0_ast_rc |
struct | m0_op_common |
struct | m0_op_idx |
struct | m0_op_obj |
struct | m0_op_io |
struct | m0_io_args |
struct | m0_op_md |
union | m0_max_size_op |
struct | m0_op_sync |
struct | m0_ios_cob_req |
struct | m0_client_layout_ops |
struct | m0_client |
struct | m0_rm_lock_ctx |
struct | m0_rm_lock_req |
Macros | |
#define | __MOTR_CLIENT_INTERNAL_H__ |
#define | M0_CLIENT_THREAD_ENTER |
#define | OP_OBJ2CODE(op_obj) op_obj->oo_oc.oc_op.op_code |
#define | OP_IDX2CODE(op_idx) op_idx->oi_oc.oc_op.op_code |
#define | MOCK |
#define | CLIENT_FOR_M0T1FS |
#define | MOTR_MDCOB_LOOKUP_SKIP 3 |
Enumerations | |
enum | { M0_OBJ_NAME_MAX_LEN = 64 } |
enum | { M0_RM_HBUCKET_NR = 100 } |
enum | m0__entity_states { M0_ES_INIT = 1, M0_ES_CREATING, M0_ES_DELETING, M0_ES_OPENING, M0_ES_OPEN, M0_ES_CLOSING, M0_ES_FAILED } |
enum | m0_pbuf_type { M0_PBUF_DIR, M0_PBUF_IND, M0_PBUF_NONE } |
enum | m0_cob_req_states { COB_REQ_ACTIVE, COB_REQ_SENDING, COB_REQ_DONE } |
enum | { M0_MIN_BUF_SHIFT = 9, M0_RPC_TIMEOUT = 60, M0_RPC_MAX_RETRIES = 60, M0_RPC_RESEND_INTERVAL, M0_MAX_NR_RPC_IN_FLIGHT = 100, M0_AST_THREAD_TIMEOUT = 10, M0_MAX_NR_CONTAINERS = 1024, M0_MAX_NR_IOS = 128, M0_MD_REDUNDANCY = 3 } |
enum | initlift_direction { SHUTDOWN = -1, STARTUP = 1 } |
Functions | |
M0_INTERNAL bool | entity_invariant_full (struct m0_entity *ent) |
M0_INTERNAL bool | entity_invariant_locked (const struct m0_entity *ent) |
void | m0_op_fini (struct m0_op *op) |
bool | m0_op_md_invariant (const struct m0_op_md *mop) |
M0_HT_DECLARE (rm_ctx, M0_INTERNAL, struct m0_rm_lock_ctx, struct m0_fid) | |
M0_INTERNAL int | m0_obj_lock_get (struct m0_obj *obj, struct m0_rm_lock_req *req, struct m0_clink *clink, enum m0_rm_rwlock_req_type rw_type) |
M0_INTERNAL int | m0_obj_lock_get_sync (struct m0_obj *obj, struct m0_rm_lock_req *req, enum m0_rm_rwlock_req_type rw_type) |
M0_BOB_DECLARE (M0_INTERNAL, m0_op_common) | |
M0_BOB_DECLARE (M0_INTERNAL, m0_op_obj) | |
M0_BOB_DECLARE (M0_INTERNAL, m0_op) | |
M0_BOB_DECLARE (M0_INTERNAL, m0_ast_rc) | |
M0_INTERNAL int | m0_client_global_init (void) |
M0_INTERNAL void | m0_client_global_fini (void) |
M0_INTERNAL struct m0_confc * | m0_confc (struct m0_client *m0c) |
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 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 struct m0_client * | m0__obj_instance (const struct m0_obj *obj) |
M0_INTERNAL struct m0_client * | m0__oo_instance (struct m0_op_obj *oo) |
M0_INTERNAL bool | m0__is_oostore (struct m0_client *instance) |
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) |
M0_INTERNAL void | m0_client_init_io_op (void) |
M0_INTERNAL bool | m0_op_obj_ast_rc_invariant (struct m0_ast_rc *ar) |
M0_INTERNAL bool | m0_op_obj_invariant (struct m0_op_obj *oo) |
M0_INTERNAL bool | m0_op_io_invariant (const struct m0_op_io *iop) |
M0_INTERNAL struct m0_rpc_session * | m0_obj_container_id_to_session (struct m0_pool_version *pv, uint64_t container_id) |
M0_INTERNAL struct m0_locality * | m0__locality_pick (struct m0_client *cinst) |
M0_INTERNAL bool | m0__obj_poolversion_is_valid (const struct m0_obj *obj) |
M0_INTERNAL int | m0__obj_namei_send (struct m0_op_obj *oo) |
M0_INTERNAL int | m0__obj_namei_cancel (struct m0_op *op) |
M0_INTERNAL int | m0__idx_cancel (struct m0_op_idx *oi) |
M0_INTERNAL int | m0__obj_attr_get_sync (struct m0_obj *obj) |
M0_INTERNAL int | m0_layout_mds_lookup (struct m0_client *m0c, uint64_t lid, struct m0_client_layout **l_out) |
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 int | m0__obj_pool_version_get (struct m0_obj *obj, struct m0_pool_version **pv) |
M0_INTERNAL uint64_t | m0__obj_layout_id_get (struct m0_op_obj *oo) |
M0_INTERNAL int | m0__obj_layout_instance_build (struct m0_client *cinst, const uint64_t layout_id, const struct m0_fid *fid, struct m0_layout_instance **linst) |
M0_INTERNAL int | m0__cob_poolversion_get (struct m0_obj *obj) |
M0_INTERNAL int | obj_fid_make_name (char *name, size_t name_len, const struct m0_fid *fid) |
M0_INTERNAL struct m0_obj * | m0__obj_entity (struct m0_entity *entity) |
M0_INTERNAL uint64_t | m0__obj_lid (struct m0_obj *obj) |
M0_INTERNAL enum m0_client_layout_type | m0__obj_layout_type (struct m0_obj *obj) |
M0_INTERNAL struct m0_fid | m0__obj_pver (struct m0_obj *obj) |
M0_INTERNAL void | m0__obj_attr_set (struct m0_obj *obj, struct m0_fid pver, uint64_t lid) |
M0_INTERNAL bool | m0__obj_pool_version_is_valid (const struct m0_obj *obj) |
M0_INTERNAL bool | m0__obj_is_parity_verify_mode (struct m0_client *instance) |
M0_INTERNAL bool | m0__obj_is_di_enabled (struct m0_op_io *ioo) |
M0_INTERNAL bool | m0__obj_is_cksum_validation_allowed (struct m0_op_io *ioo) |
M0_INTERNAL int | m0__obj_io_build (struct m0_io_args *args, struct m0_op **op) |
M0_INTERNAL void | m0__obj_op_done (struct m0_op *op) |
M0_INTERNAL bool | m0__is_read_op (struct m0_op *op) |
M0_INTERNAL bool | m0__is_update_op (struct m0_op *op) |
M0_INTERNAL int | m0__io_ref_get (struct m0_client *m0c) |
M0_INTERNAL void | m0__io_ref_put (struct m0_client *m0c) |
M0_INTERNAL struct m0_file * | m0_client_fop_to_file (struct m0_fop *fop) |
M0_INTERNAL bool | entity_id_is_valid (const struct m0_uint128 *id) |
M0_INTERNAL struct m0_client * | m0__idx_instance (const struct m0_idx *idx) |
Variables | |
enum m0_cob_req_states | M0_XCA_ENUM |
struct m0_semaphore | cpus_sem |
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 |
struct m0_sm_conf | m0_op_conf |
struct m0_sm_conf | entity_conf |
#define __MOTR_CLIENT_INTERNAL_H__ |
Definition at line 26 of file client_internal.h.
#define CLIENT_FOR_M0T1FS |
Definition at line 39 of file client_internal.h.
#define M0_CLIENT_THREAD_ENTER |
Definition at line 31 of file client_internal.h.
#define MOCK |
Definition at line 38 of file client_internal.h.
#define MOTR_MDCOB_LOOKUP_SKIP 3 |
motr clients other than S3, may not store pver in meta-data, thus they have to use md-cob lookup to get pver attribute.
Definition at line 78 of file client_internal.h.
#define OP_IDX2CODE | ( | op_idx | ) | op_idx->oi_oc.oc_op.op_code |
Definition at line 36 of file client_internal.h.
#define OP_OBJ2CODE | ( | op_obj | ) | op_obj->oo_oc.oc_op.op_code |
Definition at line 34 of file client_internal.h.
anonymous enum |
Maximum length for an object's name.
Enumerator | |
---|---|
M0_OBJ_NAME_MAX_LEN |
Definition at line 83 of file client_internal.h.
anonymous enum |
Number of buckets for m0_::m0_rm_ctxs hash-table.
Enumerator | |
---|---|
M0_RM_HBUCKET_NR |
Definition at line 90 of file client_internal.h.
anonymous enum |
miscallaneous constants
Enumerator | |
---|---|
M0_MIN_BUF_SHIFT | |
M0_RPC_TIMEOUT | |
M0_RPC_MAX_RETRIES | |
M0_RPC_RESEND_INTERVAL | |
M0_MAX_NR_RPC_IN_FLIGHT | |
M0_AST_THREAD_TIMEOUT | |
M0_MAX_NR_CONTAINERS | |
M0_MAX_NR_IOS | |
M0_MD_REDUNDANCY |
Definition at line 468 of file client_internal.h.
enum initlift_direction |
The initlift state machine moves in one of these two directions.
Enumerator | |
---|---|
SHUTDOWN | |
STARTUP |
Definition at line 512 of file client_internal.h.
enum m0__entity_states |
Enumerator | |
---|---|
M0_ES_INIT | |
M0_ES_CREATING | |
M0_ES_DELETING | |
M0_ES_OPENING | |
M0_ES_OPEN | |
M0_ES_CLOSING | |
M0_ES_FAILED |
Definition at line 94 of file client_internal.h.
enum m0_cob_req_states |
SM states of component object (COB) request.
Enumerator | |
---|---|
COB_REQ_ACTIVE | |
COB_REQ_SENDING | |
COB_REQ_DONE |
Definition at line 443 of file client_internal.h.
enum m0_pbuf_type |
Parity buffers used for addressing an IO request.
Definition at line 107 of file client_internal.h.
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 int m0__cob_poolversion_get | ( | struct m0_obj * | obj | ) |
Fetches the pool version of supplied object and stores as an object attribute.
obj | object whose pool version needs to be found. |
Returns the m0_client client instance, found from the provided operation.
op | The Operation to find the instance for. |
-------------------------------------------------------------------------—*
Definition at line 226 of file client.c.
M0_INTERNAL int m0__io_ref_get | ( | struct m0_client * | m0c | ) |
Definition at line 868 of file client_init.c.
M0_INTERNAL void m0__io_ref_put | ( | struct m0_client * | m0c | ) |
Definition at line 897 of file client_init.c.
M0_INTERNAL bool m0__is_oostore | ( | struct m0_client * | instance | ) |
M0_INTERNAL bool m0__is_read_op | ( | struct m0_op * | op | ) |
M0_INTERNAL bool m0__is_update_op | ( | struct m0_op * | op | ) |
M0_INTERNAL struct m0_locality* m0__locality_pick | ( | struct m0_client * | cinst | ) |
Selects a locality for an operation.
m0c | The client instance we are working with. |
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_INTERNAL int m0__obj_attr_get_sync | ( | struct m0_obj * | obj | ) |
M0_INTERNAL int m0__obj_io_build | ( | struct m0_io_args * | args, |
struct m0_op ** | op | ||
) |
M0_INTERNAL bool m0__obj_is_cksum_validation_allowed | ( | struct m0_op_io * | ioo | ) |
M0_INTERNAL bool m0__obj_is_di_enabled | ( | struct m0_op_io * | ioo | ) |
M0_INTERNAL bool m0__obj_is_parity_verify_mode | ( | struct m0_client * | instance | ) |
M0_INTERNAL uint64_t m0__obj_layout_id_get | ( | struct m0_op_obj * | oo | ) |
M0_INTERNAL int m0__obj_layout_instance_build | ( | struct m0_client * | cinst, |
const uint64_t | layout_id, | ||
const struct m0_fid * | fid, | ||
struct m0_layout_instance ** | linst | ||
) |
Builds a layout instance using the supplied layout.
cinst | client instance. | |
layout_id | ID of the layout. | |
fid | (global) fid of the object this instance is associated to. | |
[out] | linst | new layout instance. |
Definition at line 403 of file obj.c.
M0_INTERNAL enum m0_client_layout_type m0__obj_layout_type | ( | struct m0_obj * | obj | ) |
M0_INTERNAL uint64_t m0__obj_lid | ( | struct m0_obj * | obj | ) |
M0_INTERNAL int m0__obj_namei_cancel | ( | struct m0_op * | op | ) |
M0_INTERNAL int m0__obj_namei_send | ( | struct m0_op_obj * | oo | ) |
Sends COB fops to mdservices or ioservices depending on COB operation's protocol.
oo | object operation being processed. |
save cr in op structure, will be used in op cancel operation priv_lock can be skipped because it is just initialized. set referenced flag in cob request required during free
Skip meta-data lookup if obj.ob_attr.oa_pver is not empty. pver is not empty that means calling application has capability to store meta-data(pver) and has sent pver to open/delete entity.
For DELETE entity we skipped md cob if M0_ENF_META is set, but we still wants to send data cob. This case is handled here by posting cob_ast_ios_io_send AST.
Definition at line 1804 of file cob.c.
M0_INTERNAL void m0__obj_op_done | ( | struct m0_op * | op | ) |
M0_INTERNAL int m0__obj_pool_version_get | ( | struct m0_obj * | obj, |
struct m0_pool_version ** | pv | ||
) |
Gets current valid pool version from client instance.
instance | The client instance containing information of pool and pool versions. |
pv | The returned pool version. |
Validate the cached pool version.
Definition at line 346 of file obj.c.
M0_INTERNAL bool m0__obj_pool_version_is_valid | ( | const struct m0_obj * | obj | ) |
M0_INTERNAL bool m0__obj_poolversion_is_valid | ( | const struct m0_obj * | obj | ) |
Checks object's cached pool version is valid.
obj | The object to be checked. |
Returns the client instance associated to an object operation.
oo | object operation pointing to the instance. |
Definition at line 43 of file obj.c.
M0_BOB_DECLARE | ( | M0_INTERNAL | , |
m0_op_common | |||
) |
M0_BOB_DECLARE | ( | M0_INTERNAL | , |
m0_op_obj | |||
) |
M0_BOB_DECLARE | ( | M0_INTERNAL | , |
m0_op | |||
) |
M0_BOB_DECLARE | ( | M0_INTERNAL | , |
m0_ast_rc | |||
) |
M0_INTERNAL void m0_client_global_fini | ( | void | ) |
M0_INTERNAL int m0_client_global_init | ( | void | ) |
global init/fini, used by motr/init.c
Definition at line 1495 of file client_init.c.
M0_INTERNAL void m0_client_init_io_op | ( | void | ) |
Initialisation for object io operations. This initialises certain list types. This is heavily based on m0t1fs/linux_kernel/file.cio_bob_tlists_init
Definition at line 815 of file io.c.
Gets the confc from client instance.
m0c | client instance. |
Definition at line 315 of file client_init.c.
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 | ||
) |
Initialises an entity.
entity | Entity to be initialised. |
parent | Parent realm of the entity. |
id | Identifier of the entity. |
type | Type of the entity. |
-------------------------------------------------------------------------—*
Definition at line 371 of file client.c.
M0_HT_DECLARE | ( | rm_ctx | , |
M0_INTERNAL | , | ||
struct m0_rm_lock_ctx | , | ||
struct m0_fid | |||
) |
Methods for hash-table holding rm_ctx for RM locks
M0_INTERNAL int m0_layout_mds_lookup | ( | struct m0_client * | m0c, |
uint64_t | lid, | ||
struct m0_client_layout ** | l_out | ||
) |
Reads the specified layout from the mds.
m0c | The client instance we are working with, contains the layout db. |
lid | The layout identifier to read. |
l_out | Where to store the resultant layout. |
M0_INTERNAL struct m0_rpc_session* m0_obj_container_id_to_session | ( | struct m0_pool_version * | pv, |
uint64_t | container_id | ||
) |
Retrieves the ios session corresponding to a container_id. The ioservice for an object is calculated from the container id.
cinst | client instance. |
container_id | container ID. |
Definition at line 925 of file cob.c.
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 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_io_invariant | ( | const struct m0_op_io * | iop | ) |
Checks an object's IO operation is not malformed or corrupted.
iop | object's IO operation to be checked. |
Definition at line 161 of file io.c.
bool m0_op_md_invariant | ( | const struct m0_op_md * | mop | ) |
M0_INTERNAL bool m0_op_obj_ast_rc_invariant | ( | struct m0_ast_rc * | ar | ) |
Checks the data struct holding the AST information is not malformed or corrupted.
ar | The pointer to AST information. |
Definition at line 73 of file obj.c.
M0_INTERNAL bool m0_op_obj_invariant | ( | struct m0_op_obj * | oo | ) |
Checks an object operation is not malformed or corrupted.
oo | object operation to be checked. |
Definition at line 79 of file obj.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.
M0_INTERNAL int obj_fid_make_name | ( | char * | name, |
size_t | name_len, | ||
const struct m0_fid * | fid | ||
) |
const struct m0_bob_type ar_bobtype |
struct m0_semaphore cpus_sem |
struct m0_sm_conf entity_conf |
enum m0_cob_req_states M0_XCA_ENUM |
const struct m0_bob_type oc_bobtype |
const struct m0_bob_type oo_bobtype |
const struct m0_bob_type op_bobtype |