From fd2e7d007e5362f0738cd9a825349abcf5d27d8f Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Fri, 1 Oct 2010 05:45:12 +0000 Subject: Changes to replace flock with gf_flock across GlusterFS. Signed-off-by: Pavan Vilas Sondur Signed-off-by: Vijay Bellur BUG: 865 (Add locks recovery support in GlusterFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=865 --- xlators/protocol/client/src/client-lk.c | 24 ++++++++++++------------ xlators/protocol/client/src/client.c | 6 +++--- xlators/protocol/client/src/client.h | 6 +++--- xlators/protocol/client/src/client3_1-fops.c | 10 +++++----- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'xlators/protocol/client') diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c index 37cae88b7d2..c5696500c5e 100644 --- a/xlators/protocol/client/src/client-lk.c +++ b/xlators/protocol/client/src/client-lk.c @@ -479,7 +479,7 @@ client_cmd_to_gf_cmd (int32_t cmd, int32_t *gf_cmd) } static client_posix_lock_t * -new_client_lock (struct flock *flock, uint64_t owner, +new_client_lock (struct gf_flock *flock, uint64_t owner, int32_t cmd, fd_t *fd) { client_posix_lock_t *new_lock = NULL; @@ -497,7 +497,7 @@ new_client_lock (struct flock *flock, uint64_t owner, INIT_LIST_HEAD (&new_lock->list); new_lock->fd = fd; - memcpy (&new_lock->user_flock, flock, sizeof (struct flock)); + memcpy (&new_lock->user_flock, flock, sizeof (struct gf_flock)); new_lock->fl_type = flock->l_type; new_lock->fl_start = flock->l_start; @@ -526,7 +526,7 @@ client_save_number_fds (clnt_conf_t *conf, int count) } int -client_add_lock_for_recovery (fd_t *fd, struct flock *flock, uint64_t owner, +client_add_lock_for_recovery (fd_t *fd, struct gf_flock *flock, uint64_t owner, int32_t cmd) { clnt_fd_ctx_t *fdctx = NULL; @@ -568,7 +568,7 @@ out: } static int -construct_reserve_unlock (struct flock *lock, call_frame_t *frame, +construct_reserve_unlock (struct gf_flock *lock, call_frame_t *frame, client_posix_lock_t *client_lock) { GF_ASSERT (lock); @@ -588,11 +588,11 @@ construct_reserve_unlock (struct flock *lock, call_frame_t *frame, static int construct_reserve_lock (client_posix_lock_t *client_lock, call_frame_t *frame, - struct flock *lock) + struct gf_flock *lock) { GF_ASSERT (client_lock); - memcpy (lock, &(client_lock->user_flock), sizeof (struct flock)); + memcpy (lock, &(client_lock->user_flock), sizeof (struct gf_flock)); frame->root->lk_owner = client_lock->owner; @@ -625,7 +625,7 @@ client_remove_reserve_lock_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct flock *lock) + struct gf_flock *lock) { clnt_local_t *local = NULL; clnt_conf_t *conf = NULL; @@ -665,7 +665,7 @@ static void client_remove_reserve_lock (xlator_t *this, call_frame_t *frame, client_posix_lock_t *lock) { - struct flock unlock; + struct gf_flock unlock; clnt_local_t *local = NULL; local = frame->local; @@ -705,7 +705,7 @@ client_reserve_lock_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct flock *lock) + struct gf_flock *lock) { clnt_local_t *local = NULL; @@ -761,14 +761,14 @@ client_recovery_lock_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct flock *lock) + struct gf_flock *lock) { clnt_local_t *local = NULL; clnt_fd_ctx_t *fdctx = NULL; clnt_conf_t *conf = NULL; client_posix_lock_t *next_lock = NULL; - struct flock reserve_flock; + struct gf_flock reserve_flock; uint64_t fd_count = 0; local = frame->local; @@ -864,7 +864,7 @@ client_attempt_lock_recovery (xlator_t *this, clnt_fd_ctx_t *fdctx) clnt_local_t *local = NULL; client_posix_lock_t *lock = NULL; - struct flock reserve_flock; + struct gf_flock reserve_flock; int ret = 0; local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 84f3778393f..4297c628dc0 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -1184,7 +1184,7 @@ out: int32_t client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, - struct flock *lock) + struct gf_flock *lock) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1212,7 +1212,7 @@ out: int32_t client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, - loc_t *loc, int32_t cmd, struct flock *lock) + loc_t *loc, int32_t cmd, struct gf_flock *lock) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1242,7 +1242,7 @@ out: int32_t client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, - fd_t *fd, int32_t cmd, struct flock *lock) + fd_t *fd, int32_t cmd, struct gf_flock *lock) { int ret = -1; clnt_conf_t *conf = NULL; diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index a31873a027b..1e90c5935cf 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -80,7 +80,7 @@ typedef struct _client_fd_ctx { typedef struct _client_posix_lock { fd_t *fd; /* The fd on which the lk operation was made */ - struct flock user_flock; /* the flock supplied by the user */ + struct gf_flock user_flock; /* the flock supplied by the user */ off_t fl_start; off_t fl_end; short fl_type; @@ -120,7 +120,7 @@ typedef struct client_args { loc_t *oldloc; loc_t *newloc; const char *name; - struct flock *flock; + struct gf_flock *flock; const char *volume; const char *basename; off_t offset; @@ -166,7 +166,7 @@ int clnt_readdir_rsp_cleanup (gfs3_readdir_rsp *rsp); int clnt_readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp); int client_attempt_lock_recovery (xlator_t *this, clnt_fd_ctx_t *fdctx); int32_t delete_granted_locks_owner (fd_t *fd, uint64_t owner); -int client_add_lock_for_recovery (fd_t *fd, struct flock *flock, uint64_t owner, +int client_add_lock_for_recovery (fd_t *fd, struct gf_flock *flock, uint64_t owner, int32_t cmd); uint64_t decrement_reopen_fd_count (xlator_t *this, clnt_conf_t *conf); int32_t delete_granted_locks_fd (clnt_fd_ctx_t *fdctx); diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index 31cf9301526..786db4c7903 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -1526,7 +1526,7 @@ client3_1_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, { call_frame_t *frame = NULL; clnt_local_t *local = NULL; - struct flock lock = {0,}; + struct gf_flock lock = {0,}; gfs3_lk_rsp rsp = {0,}; int ret = 0; @@ -1548,7 +1548,7 @@ client3_1_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, } if (rsp.op_ret >= 0) { - gf_flock_to_flock (&rsp.flock, &lock); + gf_proto_flock_to_flock (&rsp.flock, &lock); } /* Save the lock to the client lock cache to be able @@ -4377,7 +4377,7 @@ client3_1_lk (call_frame_t *frame, xlator_t *this, req.fd = fdctx->remote_fd; req.cmd = gf_cmd; req.type = gf_type; - gf_flock_from_flock (&req.flock, args->flock); + gf_proto_flock_from_flock (&req.flock, args->flock); ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LK, client3_1_lk_cbk, NULL, xdr_from_lk_req, @@ -4443,7 +4443,7 @@ client3_1_inodelk (call_frame_t *frame, xlator_t *this, req.volume = (char *)args->volume; req.cmd = gf_cmd; req.type = gf_type; - gf_flock_from_flock (&req.flock, args->flock); + gf_proto_flock_from_flock (&req.flock, args->flock); conf = this->private; @@ -4533,7 +4533,7 @@ client3_1_finodelk (call_frame_t *frame, xlator_t *this, req.fd = fdctx->remote_fd; req.cmd = gf_cmd; req.type = gf_type; - gf_flock_from_flock (&req.flock, args->flock); + gf_proto_flock_from_flock (&req.flock, args->flock); ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FINODELK, -- cgit