summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/rpc-lib')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c18
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.h2
2 files changed, 3 insertions, 17 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index d7a06c33d32..ef8f764b62f 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -24,21 +24,6 @@
void
rpc_clnt_reply_deinit (struct rpc_req *req, struct mem_pool *pool);
-uint64_t
-rpc_clnt_new_callid (struct rpc_clnt *clnt)
-{
- uint64_t callid = 0;
-
- pthread_mutex_lock (&clnt->lock);
- {
- callid = ++clnt->xid;
- }
- pthread_mutex_unlock (&clnt->lock);
-
- return callid;
-}
-
-
struct saved_frame *
__saved_frames_get_timedout (struct saved_frames *frames, uint32_t timeout,
struct timeval *current)
@@ -1144,6 +1129,7 @@ rpc_clnt_new (dict_t *options, xlator_t *owner, char *name,
pthread_mutex_init (&rpc->lock, NULL);
rpc->ctx = ctx;
rpc->owner = owner;
+ GF_ATOMIC_INIT (rpc->xid, 1);
if (!reqpool_size)
reqpool_size = RPC_CLNT_DEFAULT_REQUEST_COUNT;
@@ -1636,7 +1622,7 @@ rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog,
new_iobref = 1;
}
- callid = rpc_clnt_new_callid (rpc);
+ callid = GF_ATOMIC_INC (rpc->xid);
rpcreq->prog = prog;
rpcreq->procnum = procnum;
diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h
index e5e493cd79e..952ecbce1a1 100644
--- a/rpc/rpc-lib/src/rpc-clnt.h
+++ b/rpc/rpc-lib/src/rpc-clnt.h
@@ -176,7 +176,7 @@ typedef struct rpc_clnt {
rpc_clnt_notify_t notifyfn;
rpc_clnt_connection_t conn;
void *mydata;
- uint64_t xid;
+ gf_atomic_t xid;
/* list of cb programs registered with rpc-clnt */
struct list_head programs;