diff options
author | Amar Tumballi <amarts@redhat.com> | 2017-12-22 13:12:42 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-01-19 22:48:39 +0530 |
commit | 303cc2b54797bc5371be742543ccb289010c92f2 (patch) | |
tree | cf383488d0edff81b012b5e908f8ebca7affaea3 /xlators/protocol/client/src/client.h | |
parent | 9eefff096fd9b54120e4347b6b00f10a6c502cf4 (diff) |
protocol: make on-wire-change of protocol using new XDR definition.
With this patchset, some major things are changed in XDR, mainly:
* Naming: Instead of gfs3/gfs4 settle for gfx_ for xdr structures
* add iattx as a separate structure, and add conversion methods
* the *_rsp structure is now changed, and is also reduced in number
(ie, no need for different strucutes if it is similar to other response).
* use proper XDR methods for sending dict on wire.
Also, with the change of xdr structure, there are changes needed
outside of xlator protocol layer to handle these properly. Mainly
because the abstraction was broken to support 0-copy RDMA with payload
for write and read FOP. This made transport layer know about the xdr
payload, hence with the change of xdr payload structure, transport layer
needed to know about the change.
Updates #384
Change-Id: I1448fbe9deab0a1b06cb8351f2f37488cefe461f
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client.h')
-rw-r--r-- | xlators/protocol/client/src/client.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index dd3ee4dd4f0..003a2bef397 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -134,6 +134,54 @@ typedef enum { client_local_wipe (__local); \ } while (0) +/* compound v2 */ +#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req) +#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp) + +#define CLIENT4_POST_FOP(fop, this_rsp_u, this_args_cbk, params ...) \ + do { \ + gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp_u, fop); \ + int _op_ret = 0; \ + int _op_errno = 0; \ + \ + _op_ret = _this_rsp->op_ret; \ + _op_errno = gf_error_to_errno (_this_rsp->op_errno); \ + args_##fop##_cbk_store (this_args_cbk, _op_ret, _op_errno, \ + params); \ + } while (0) + +#define CLIENT4_POST_FOP_TYPE(fop, rsp_type, this_rsp_u, this_args_cbk, params ...) \ + do { \ + gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp_u, fop); \ + int _op_ret = 0; \ + int _op_errno = 0; \ + \ + _op_ret = _this_rsp->op_ret; \ + _op_errno = gf_error_to_errno (_this_rsp->op_errno); \ + args_##fop##_cbk_store (this_args_cbk, _op_ret, _op_errno, \ + params); \ + } while (0) + +#define CLIENT4_PRE_FOP(fop, xl, compound_req, op_errno, label, params ...) \ + do { \ + gfx_##fop##_req *_req = (gfx_##fop##_req *)compound_req; \ + int _ret = 0; \ + \ + _ret = client_pre_##fop##_v2 (xl, _req, params); \ + if (_ret < 0) { \ + op_errno = -ret; \ + goto label; \ + } \ + } while (0) + +#define CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fop) \ + do { \ + gfx_##fop##_req *_req = &CPD4_REQ_FIELD(curr_req, fop); \ + \ + GF_FREE (_req->xdata.pairs.pairs_val); \ + } while (0) + + struct clnt_options { char *remote_subvolume; @@ -402,4 +450,47 @@ serialize_req_locklist (lock_migration_info_t *locklist, void client_compound_rsp_cleanup (gfs3_compound_rsp *rsp, int len); + +void +clnt_getactivelk_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp); + +void +clnt_setactivelk_req_cleanup_v2 (gfx_setactivelk_req *req); + +int +serialize_req_locklist_v2 (lock_migration_info_t *locklist, + gfx_setactivelk_req *req); + +int +clnt_unserialize_rsp_locklist_v2 (xlator_t *this, struct gfx_getactivelk_rsp *rsp, + lock_migration_info_t *lmi); + +int unserialize_rsp_dirent_v2 (xlator_t *this, struct gfx_readdir_rsp *rsp, + gf_dirent_t *entries); +int unserialize_rsp_direntp_v2 (xlator_t *this, fd_t *fd, + struct gfx_readdirp_rsp *rsp, gf_dirent_t *entries); + +int clnt_readdir_rsp_cleanup_v2 (gfx_readdir_rsp *rsp); +int clnt_readdirp_rsp_cleanup_v2 (gfx_readdirp_rsp *rsp); + +int +client_handle_fop_requirements_v2 (xlator_t *this, call_frame_t *frame, + gfx_compound_req *req, + clnt_local_t *local, + struct iobref **req_iobref, + struct iobref **rsp_iobref, + struct iovec *req_vector, + struct iovec *rsp_vector, int *req_count, + int *rsp_count, default_args_t *args, + int fop_enum, int index); +int +client_process_response_v2 (call_frame_t *frame, xlator_t *this, + struct rpc_req *req, + gfx_compound_rsp *rsp, compound_args_cbk_t *args_cbk, + int index); +void +compound_request_cleanup_v2 (gfx_compound_req *req); +void +client_compound_rsp_cleanup_v2 (gfx_compound_rsp *rsp, int len); + #endif /* !_CLIENT_H */ |