Motr
M0
|
#include "motr/client.h"
#include "motr/client_internal.h"
#include "motr/layout.h"
#include "motr/idx.h"
#include "motr/sync.h"
#include "lib/errno.h"
#include "lib/finject.h"
#include "fid/fid.h"
#include "fop/fom_generic.h"
#include "ioservice/fid_convert.h"
#include "mdservice/md_fops.h"
#include "rpc/rpclib.h"
#include "rpc/rpc_opcodes.h"
#include "motr/addb.h"
#include "lib/trace.h"
Go to the source code of this file.
Data Structures | |
struct | ios_cob_req |
struct | cob_req |
Macros | |
#define | M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT |
#define | OSYNC |
Enumerations | |
enum | cob_request_flags { COB_REQ_ASYNC = (1 << 1), COB_REQ_SYNC = (1 << 2) } |
enum | { IOS_COB_REQ_DEADLINE = 2000000 } |
Functions | |
M0_BOB_DEFINE (M0_INTERNAL, &cr_bobtype, cob_req) | |
M0_BOB_DEFINE (static, &icr_bobtype, ios_cob_req) | |
static void | cob_ios_fop_fini (struct m0_fop *ios_fop) |
static void | cob_ast_ios_io_send (struct m0_sm_group *grp, struct m0_sm_ast *ast) |
static int | cob_mds_send (struct cob_req *cr) |
static int | cob_ios_md_send (struct cob_req *cr) |
static void | to_cob_req_map (const struct m0_op *op, const struct cob_req *cr) |
static void | cob_req_to_rpc_map (const struct cob_req *cr, const struct m0_rpc_item *item) |
static bool | ios_cob_req_invariant (struct ios_cob_req *icr) |
static int | cob_name_mem2wire (struct m0_fop_str *tgt, const struct m0_buf *name) |
static void | cob_body_mem2wire (struct m0_fop_cob *body, struct m0_cob_attr *attr, int valid, struct cob_req *cr) |
static void | cob_body_wire2mem (struct m0_cob_attr *attr, const struct m0_fop_cob *body) |
static void | cob_attr_init (struct cob_req *cr, struct m0_cob_attr *attr, int *valid) |
static void | cob_req_release (struct cob_req *cr) |
static void | cob_req_ref_release (struct m0_ref *ref) |
M0_INTERNAL struct cob_req * | cob_req_ref_get (struct cob_req *cr) |
M0_INTERNAL void | cob_req_ref_put (struct cob_req *cr) |
static struct cob_req * | cob_req_alloc (struct m0_pool_version *pv) |
static void | cob_req_free (struct cob_req *cr) |
static int | cob_req_send (struct cob_req *cr) |
static int | cob_make_name (struct cob_req *cr) |
static void | cob_entity_sm_move (struct m0_op *op) |
static void | cob_complete_op (struct m0_op *op) |
static void | cob_fail_op (struct m0_op *op, int rc) |
M0_INTERNAL void | cob_rep_attr_copy (struct cob_req *cr) |
static void | cob_rep_process (struct cob_req *cr) |
static void | cob_ast_complete_cr (struct m0_sm_group *grp, struct m0_sm_ast *ast) |
static void | cob_fail_cr (struct cob_req *cr, int rc) |
static void | cob_ast_fail_cr (struct m0_sm_group *grp, struct m0_sm_ast *ast) |
static struct ios_cob_req * | rpc_item_to_icr (struct m0_rpc_item *item) |
static void | icrs_complete (struct cob_req *cr) |
static void | icrs_fail (struct cob_req *cr, int rc) |
static int | icrs_rc (struct cob_req *cr) |
static void | icr_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast) |
static void | cob_ios_rio_replied (struct m0_rpc_item *item) |
M0_INTERNAL struct m0_rpc_session * | m0_obj_container_id_to_session (struct m0_pool_version *pver, uint64_t container_id) |
static int | cob_ios_fop_populate (struct cob_req *cr, struct m0_fop *fop, struct m0_fid *cob_fid, uint32_t cob_idx) |
static void | cob_ios_fop_release (struct m0_ref *ref) |
static int | cob_ios_fop_get (struct cob_req *cr, uint32_t i, uint32_t cob_type, struct m0_rpc_session *session) |
static int | cob_ios_prepare (struct cob_req *cr, uint32_t idx) |
static int | cob_ios_send (struct cob_req *cr, uint32_t idx) |
static int | cob_ios_req_send_sync (struct cob_req *cr) |
static int | cob_ios_req_send_async (struct cob_req *cr) |
static struct cob_req * | rpc_item_to_cr (struct m0_rpc_item *item) |
static void | cob_mds_rio_replied (struct m0_rpc_item *item) |
static int | cob_mds_fop_populate (struct cob_req *cr, struct m0_fop *fop) |
static struct m0_rpc_session * | fid_to_mds_session (struct m0_client *cinst, const struct m0_fid *fid) |
M0_INTERNAL int | m0__obj_namei_send (struct m0_op_obj *oo) |
M0_INTERNAL int | m0__obj_namei_cancel (struct m0_op *op) |
static int | cob_getattr_rep_rc (struct cob_req *cr) |
M0_INTERNAL int | m0__obj_attr_get_sync (struct m0_obj *obj) |
M0_INTERNAL int | m0__obj_layout_send (struct m0_obj *obj, struct m0_op_layout *ol) |
Variables | |
const struct m0_bob_type | cr_bobtype |
static const struct m0_bob_type | icr_bobtype |
static const struct m0_rpc_item_ops | cob_ios_ri_ops |
static const struct m0_rpc_item_ops | cob_mds_ri_ops |
anonymous enum |
enum cob_request_flags |
|
static |
|
static |
|
static |
|
static |
|
static |
Fills a m0_fop_cob so it can be sent to a mdservice.
body | cob fop to be filled. |
oo | obj operation the information is retrieved from. |
Definition at line 178 of file cob.c.
|
static |
|
static |
|
static |
|
static |
|
static |
Fails a whole operation and moves the state of its state machine. Note that when failing an operation, an error code is stored in m0_op::op_rc and its state is set to STABLE if the op has already been launched (in LAUNCHED state).
oo | object operation to be failed. |
rc | error code that explains why the operation is being failed. |
Definition at line 489 of file cob.c.
|
static |
|
static |
|
static |
|
static |
Populates a fop with the information contained within an object operation. The fop will be sent to an ioservice to request the creation or deletion of a cob.
oo | object operation. |
fop | fop being populated. |
cob_fid | fid of the cob being created/deleted. |
cob_idx | index of the cob inside the object's layout. |
Definition at line 957 of file cob.c.
|
static |
|
static |
Sends entity namespace fops to a io services(oostore mode only), as part of the processing of a create/delete object operation.
cr | COB request being processed. |
Definition at line 1406 of file cob.c.
|
static |
Prepares a COB fop to be sent.
It is important to prepare all fops before sending them in ASYNC mode, because a race possible otherwise. If a reply is received before all values are set to cr->cr_ios_fop array, icr_ast() can finish cob request early and cause a panic. See MOTR-2887 for details.
This functions is intended to be used in pair with cob_ios_send().
Definition at line 1135 of file cob.c.
|
static |
|
static |
|
static |
|
static |
Sends a COB fop to an ioservice.
cr | COB request being processed. |
idx | index of the cob. |
Definition at line 1236 of file cob.c.
|
static |
Populates a COB fop for the namespace operation. This type of fop is sent to the mdservice to create/delete new objects.
oo | object operation whose processing triggers this call. Contains the info to populate the fop with. |
fop | fop being stuffed. |
Definition at line 1595 of file cob.c.
|
static |
rio_replied RPC callback to be executed whenever a reply to an object namespace request is received. The mdservice gets contacted as a first step when creating/deleting an object. This callback gets executed when a reply arrives from the mdservice. It also gets executed if the RPC component has detected any error.
item | RPC item used to communicate to the mdservice. |
Definition at line 1472 of file cob.c.
|
static |
|
static |
Copies a name into a m0_fop_str.
tgt | dest buffer. |
name | src buffer. |
Definition at line 154 of file cob.c.
M0_INTERNAL void cob_rep_attr_copy | ( | struct cob_req * | cr | ) |
|
static |
|
static |
|
static |
Put reference of cob_req. During cob request alloc, reference on cob request is taken, during cob request free, reference is released. when there are no references to cob request, cob_req_release is called which will free the cob request structure.
For index operations cr_op is not set.
Definition at line 342 of file cob.c.
M0_INTERNAL void cob_req_ref_put | ( | struct cob_req * | cr | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
Retrieves the rpc session for the mdservice to contact when creating/deleting an object. Client selects the mdservice to contact using the object's fid.
cinst | client instance. |
fid | fid of the object. |
Definition at line 1694 of file cob.c.
|
static |
|
static |
|
static |
|
static |
|
static |
Checks an IOS COB request is not malformed or corrupted.
icr | IOS COB request to be checked. |
Definition at line 141 of file cob.c.
M0_INTERNAL int m0__obj_attr_get_sync | ( | struct m0_obj * | obj | ) |
M0_INTERNAL int m0__obj_layout_send | ( | struct m0_obj * | obj, |
struct m0_op_layout * | ol | ||
) |
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_BOB_DEFINE | ( | M0_INTERNAL | , |
& | cr_bobtype, | ||
cob_req | |||
) |
M0_BOB_DEFINE | ( | static | , |
& | icr_bobtype, | ||
ios_cob_req | |||
) |
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.
|
static |
Returns the object operation associated to a given RPC item.Items are sent to services when processing an operation. This function provides a pointer to the original object operation that triggered the communication.
item | RPC item. |
Definition at line 1448 of file cob.c.
|
static |
----------------------------------------------------------------------——*
Retrieves the ios_cob_req an rpc item is associated to. This allows figuring out which slot inside the object operation corresponds to the communication with a specific ioservice.
item | RPC item used to communicate to a specific ioservice. It contains both the request sent from client and the reply received from the ioservice. |
Definition at line 697 of file cob.c.
|
static |
RPC callbacks for the posting of COB FOPs to ioservices.
|
static |
RPC callbacks for the posting of COB fops to mdservices.
const struct m0_bob_type cr_bobtype |
|
static |