From efad78260379f0ca836e8a2327b97dd620acd098 Mon Sep 17 00:00:00 2001 From: Susant Palai Date: Tue, 22 Aug 2017 13:44:52 +0530 Subject: rio/everywhere: add icreate/namelink fop icreate creates inode, while namelink links the basename to it's parent gfid. For now mkdir is the primary user of these fops. Better distribution is acheived by creating the inode on ,(say) mds1 and linking the basename to it's parent gfid on mds2. The inode serves readdirp, stat etc. More details about the fops are present at: https://review.gluster.org/#/c/13395/3/design/DHT2/DHT2_Icreate_Namelink_Notes.md This backport of three patches from experimental branch. 1- https://review.gluster.org/#/c/18085/ 2- https://review.gluster.org/#/c/18086/ 3- https://review.gluster.org/#/c/18094/ Updates gluster/glusterfs#243 Change-Id: I1bd3d5a441a3cfab1acfeb52f15c6c867d362592 Signed-off-by: Susant Palai --- xlators/protocol/client/src/client.c | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'xlators/protocol/client/src/client.c') diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index b8b0ddbbfe9..8df697ed883 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2181,6 +2181,60 @@ out: return 0; } +int32_t +client_namelink (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) +{ + int32_t ret = -1; + clnt_conf_t *conf = NULL; + clnt_args_t args = {0,}; + rpc_clnt_procedure_t *proc = NULL; + + conf = this->private; + if (!conf || !conf->fops || !conf->handshake) + goto out; + + args.loc = loc; + args.xdata = xdata; + + proc = &conf->fops->proctable[GF_FOP_NAMELINK]; + if (proc->fn) + ret = proc->fn (frame, this, &args); + + out: + if (ret) + STACK_UNWIND_STRICT (namelink, frame, + -1, EINVAL, NULL, NULL, NULL); + return 0; +} + +int32_t +client_icreate (call_frame_t *frame, + xlator_t *this, loc_t *loc, mode_t mode, dict_t *xdata) +{ + int32_t ret = -1; + clnt_conf_t *conf = NULL; + clnt_args_t args = {0,}; + rpc_clnt_procedure_t *proc = NULL; + + conf = this->private; + if (!conf || !conf->fops || !conf->handshake) + goto out; + + args.loc = loc; + args.mode = mode; + args.xdata = xdata; + + proc = &conf->fops->proctable[GF_FOP_ICREATE]; + if (proc->fn) + ret = proc->fn (frame, this, &args); + + out: + if (ret) + STACK_UNWIND_STRICT (icreate, frame, + -1, EINVAL, NULL, NULL, NULL); + return 0; +} + int client_mark_fd_bad (xlator_t *this) { @@ -2960,6 +3014,8 @@ struct xlator_fops fops = { .compound = client_compound, .getactivelk = client_getactivelk, .setactivelk = client_setactivelk, + .icreate = client_icreate, + .namelink = client_namelink, }; -- cgit