summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2014-09-04 14:12:39 -0400
committerVijay Bellur <vbellur@redhat.com>2014-09-12 01:10:43 -0700
commitb0dfe8da3fdda31b57177a08de8acec31ac749bf (patch)
tree5d8191278e07b25c8c2fc55ab57474b87d4e6631
parent3c6a334b524742837555ad1a903ba9647eca62ea (diff)
libglusterfs/syncop: implement inodelk
Change-Id: Iea489157490b70cb2bb03576b0d4943c6d8f052d BUG: 1138395 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on-master: http://review.gluster.org/8522 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/8610
-rw-r--r--libglusterfs/src/syncop.c40
-rw-r--r--libglusterfs/src/syncop.h4
2 files changed, 44 insertions, 0 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 3dd622c8e99..c0a85b2830c 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -2329,3 +2329,43 @@ syncop_lk (xlator_t *subvol, fd_t *fd, int cmd, struct gf_flock *flock)
return -args.op_errno;
return args.op_ret;
}
+
+int32_t
+syncop_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
+{
+ struct syncargs *args = NULL;
+
+ args = cookie;
+
+ args->op_ret = op_ret;
+ args->op_errno = op_errno;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ __wake (args);
+
+ return 0;
+
+}
+
+int
+syncop_inodelk (xlator_t *subvol, const char *volume, loc_t *loc, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata_req, dict_t **xdata_rsp)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_inodelk_cbk, subvol->fops->inodelk,
+ volume, loc, cmd, lock, xdata_req);
+
+ if (xdata_rsp)
+ *xdata_rsp = args.xdata;
+ else
+ dict_unref (args.xdata);
+
+ if (args.op_ret < 0)
+ return -args.op_errno;
+
+ return args.op_ret;
+}
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index e3a4e6ac921..41b2ef44942 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -418,4 +418,8 @@ int syncop_rename (xlator_t *subvol, loc_t *oldloc, loc_t *newloc);
int syncop_lk (xlator_t *subvol, fd_t *fd, int cmd, struct gf_flock *flock);
+int
+syncop_inodelk (xlator_t *subvol, const char *volume, loc_t *loc, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata_req, dict_t **xdata_rsp);
+
#endif /* _SYNCOP_H */