summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client-rpc-fops.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2017-12-22 13:12:42 +0530
committerAmar Tumballi <amarts@redhat.com>2018-01-19 22:48:39 +0530
commit303cc2b54797bc5371be742543ccb289010c92f2 (patch)
treecf383488d0edff81b012b5e908f8ebca7affaea3 /xlators/protocol/client/src/client-rpc-fops.c
parent9eefff096fd9b54120e4347b6b00f10a6c502cf4 (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-rpc-fops.c')
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c295
1 files changed, 2 insertions, 293 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index c8d1cc14f77..ead439eab7e 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -3150,102 +3150,6 @@ out:
return 0;
}
-int32_t
-client3_3_namelink_cbk (struct rpc_req *req,
- struct iovec *iov, int count, void *myframe)
-{
- int32_t ret = 0;
- xlator_t *this = NULL;
- struct iatt prebuf = {0,};
- struct iatt postbuf = {0,};
- dict_t *xdata = NULL;
- call_frame_t *frame = NULL;
- gfs4_namelink_rsp rsp = {0,};
-
- this = THIS;
- frame = myframe;
-
- if (req->rpc_status == -1) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs4_namelink_rsp);
- if (ret < 0) {
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret != -1) {
- gf_stat_to_iatt (&rsp.preparent, &prebuf);
- gf_stat_to_iatt (&rsp.postparent, &postbuf);
- }
-
- GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), ret,
- rsp.op_errno, out);
-
- out:
- CLIENT_STACK_UNWIND (namelink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno),
- &prebuf, &postbuf, xdata);
- free (rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
- return 0;
-}
-
-int32_t
-client3_3_icreate_cbk (struct rpc_req *req,
- struct iovec *iov, int count, void *myframe)
-{
- int32_t ret = 0;
- inode_t *inode = NULL;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- struct iatt stbuf = {0,};
- dict_t *xdata = NULL;
- call_frame_t *frame = NULL;
- gfs4_icreate_rsp rsp = {0,};
-
- this = THIS;
- frame = myframe;
- local = frame->local;
-
- inode = local->loc.inode;
-
- if (req->rpc_status == -1) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs4_icreate_rsp);
- if (ret < 0) {
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret != -1)
- gf_stat_to_iatt (&rsp.stat, &stbuf);
-
- GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), ret,
- rsp.op_errno, out);
-
- out:
- CLIENT_STACK_UNWIND (icreate, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno),
- inode, &stbuf, xdata);
- free (rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
- return 0;
-}
-
int
client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx)
{
@@ -6345,197 +6249,6 @@ unwind:
return 0;
}
-int32_t
-client3_3_namelink (call_frame_t *frame, xlator_t *this, void *data)
-{
- int32_t ret = 0;
- int32_t op_errno = EINVAL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs4_namelink_req req = {{0,},};
-
- GF_ASSERT (frame);
-
- args = data;
- conf = this->private;
-
- if (!(args->loc && args->loc->parent))
- goto unwind;
-
- if (!gf_uuid_is_null (args->loc->parent->gfid))
- memcpy (req.pargfid, args->loc->parent->gfid, sizeof (uuid_t));
- else
- memcpy (req.pargfid, args->loc->pargfid, sizeof (uuid_t));
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req.pargfid)),
- unwind, op_errno, EINVAL);
-
- req.bname = (char *)args->loc->name;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
- req.xdata.xdata_len, op_errno, unwind);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_NAMELINK, client3_3_namelink_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs4_namelink_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
- return 0;
-
- unwind:
- CLIENT_STACK_UNWIND (namelink, frame, -1, op_errno, NULL, NULL, NULL);
- return 0;
-}
-
-int32_t
-client3_3_icreate (call_frame_t *frame, xlator_t *this, void *data)
-{
- int32_t ret = 0;
- int32_t op_errno = EINVAL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- clnt_local_t *local = NULL;
- gfs4_icreate_req req = {{0,},};
-
- GF_ASSERT (frame);
-
- args = data;
- conf = this->private;
-
- if (!(args->loc && args->loc->inode))
- goto unwind;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- loc_copy (&local->loc, args->loc);
-
- req.mode = args->mode;
- memcpy (req.gfid, args->loc->gfid, sizeof (uuid_t));
-
- op_errno = ESTALE;
- GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
- req.xdata.xdata_len, op_errno, unwind);
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_ICREATE, client3_3_icreate_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs4_icreate_req);
- if (ret)
- goto free_reqdata;
- GF_FREE (req.xdata.xdata_val);
- return 0;
-
- free_reqdata:
- GF_FREE (req.xdata.xdata_val);
- unwind:
- CLIENT_STACK_UNWIND (icreate, frame,
- -1, op_errno, NULL, NULL, NULL);
- return 0;
-}
-
-int32_t
-client4_0_fsetattr (call_frame_t *frame, xlator_t *this, void *data)
-{
- clnt_args_t *args = NULL;
- int64_t remote_fd = -1;
- clnt_conf_t *conf = NULL;
- gfs3_fsetattr_req_v2 req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, unwind);
-
- req.fd = remote_fd;
- req.valid = args->valid;
- gf_stat_from_iatt (&req.stbuf, args->stbuf);
- memcpy (req.gfid, args->fd->inode->gfid, 16);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
- req.xdata.xdata_len, op_errno, unwind);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSETATTR,
- client3_3_fsetattr_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fsetattr_req_v2);
- if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
-unwind:
- CLIENT_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
-}
-
-int32_t
-client4_0_rchecksum (call_frame_t *frame, xlator_t *this,
- void *data)
-{
- clnt_args_t *args = NULL;
- int64_t remote_fd = -1;
- clnt_conf_t *conf = NULL;
- gfs3_rchecksum_req_v2 req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, unwind);
-
- req.len = args->len;
- req.offset = args->offset;
- req.fd = remote_fd;
- memcpy (req.gfid, args->fd->inode->gfid, 16);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
- req.xdata.xdata_len, op_errno, unwind);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RCHECKSUM,
- client3_3_rchecksum_cbk, NULL,
- NULL, 0, NULL,
- 0, NULL,
- (xdrproc_t)xdr_gfs3_rchecksum_req_v2);
- if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
-unwind:
- CLIENT_STACK_UNWIND (rchecksum, frame, -1, op_errno, 0, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
-}
/* Table Specific to FOPS */
rpc_clnt_procedure_t clnt3_3_fop_actors[GF_FOP_MAXVALUE] = {
@@ -6650,8 +6363,6 @@ char *clnt3_3_fop_names[GFS3_OP_MAXVALUE] = {
[GFS3_OP_GETACTIVELK] = "GETACTIVELK",
[GFS3_OP_SETACTIVELK] = "SETACTIVELK",
[GFS3_OP_COMPOUND] = "COMPOUND",
- [GFS3_OP_ICREATE] = "ICREATE",
- [GFS3_OP_NAMELINK] = "NAMELINK",
};
rpc_clnt_prog_t clnt3_3_fop_prog = {
@@ -6701,9 +6412,9 @@ rpc_clnt_procedure_t clnt4_0_fop_actors[GF_FOP_MAXVALUE] = {
[GF_FOP_FXATTROP] = { "FXATTROP", client3_3_fxattrop },
[GF_FOP_FGETXATTR] = { "FGETXATTR", client3_3_fgetxattr },
[GF_FOP_FSETXATTR] = { "FSETXATTR", client3_3_fsetxattr },
- [GF_FOP_RCHECKSUM] = { "RCHECKSUM", client4_0_rchecksum },
+ [GF_FOP_RCHECKSUM] = { "RCHECKSUM", client3_3_rchecksum },
[GF_FOP_SETATTR] = { "SETATTR", client3_3_setattr },
- [GF_FOP_FSETATTR] = { "FSETATTR", client4_0_fsetattr },
+ [GF_FOP_FSETATTR] = { "FSETATTR", client3_3_fsetattr },
[GF_FOP_READDIRP] = { "READDIRP", client3_3_readdirp },
[GF_FOP_FALLOCATE] = { "FALLOCATE", client3_3_fallocate },
[GF_FOP_DISCARD] = { "DISCARD", client3_3_discard },
@@ -6718,8 +6429,6 @@ rpc_clnt_procedure_t clnt4_0_fop_actors[GF_FOP_MAXVALUE] = {
[GF_FOP_GETACTIVELK] = { "GETACTIVELK", client3_3_getactivelk},
[GF_FOP_SETACTIVELK] = { "SETACTIVELK", client3_3_setactivelk},
[GF_FOP_COMPOUND] = { "COMPOUND", client3_3_compound },
- [GF_FOP_ICREATE] = { "ICREATE", client3_3_icreate},
- [GF_FOP_NAMELINK] = { "NAMELINK", client3_3_namelink},
};