From b02afc6d008f9959db28244eb2b9dd3b9ef92393 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 17 Jan 2012 05:28:51 +0530 Subject: core: change lk-owner as a 1k buffer so, NLM can send the lk-owner field directly to the locks translators, while doing the same effort, also enabled sending maximum of 500 aux gid over protocol. Change-Id: I87c2514392748416f7ffe21d5154faad2e413969 Signed-off-by: Amar Tumballi BUG: 767229 Reviewed-on: http://review.gluster.com/779 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/afr/src/afr-lk-common.c | 27 ++++++++++++++------------- xlators/cluster/afr/src/afr-self-heal-data.c | 28 ++++++++++++++++------------ xlators/cluster/afr/src/pump.c | 6 +++--- 3 files changed, 33 insertions(+), 28 deletions(-) (limited to 'xlators/cluster/afr/src') diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c index 41fa8a30bab..2fe1349902c 100644 --- a/xlators/cluster/afr/src/afr-lk-common.c +++ b/xlators/cluster/afr/src/afr-lk-common.c @@ -62,7 +62,8 @@ afr_set_lk_owner (call_frame_t *frame, xlator_t *this) gf_log (this->name, GF_LOG_TRACE, "Setting lk-owner=%llu", (unsigned long long) (unsigned long)frame->root); - frame->root->lk_owner = (uint64_t) (unsigned long)frame->root; + + set_lk_owner_from_ptr (&frame->root->lk_owner, frame->root); } static int @@ -115,7 +116,7 @@ internal_lock_count (call_frame_t *frame, xlator_t *this) static void afr_print_inodelk (char *str, int size, int cmd, - struct gf_flock *flock, uint64_t owner) + struct gf_flock *flock, gf_lkowner_t *owner) { char *cmd_str = NULL; char *type_str = NULL; @@ -163,11 +164,11 @@ afr_print_inodelk (char *str, int size, int cmd, } snprintf (str, size, "lock=INODELK, cmd=%s, type=%s, " - "start=%llu, len=%llu, pid=%llu, lk-owner=%llu", + "start=%llu, len=%llu, pid=%llu, lk-owner=%s", cmd_str, type_str, (unsigned long long) flock->l_start, (unsigned long long) flock->l_len, (unsigned long long) flock->l_pid, - (unsigned long long) owner); + lkowner_utoa (owner)); } @@ -183,11 +184,11 @@ afr_print_lockee (char *str, int size, loc_t *loc, fd_t *fd, void afr_print_entrylk (char *str, int size, const char *basename, - uint64_t owner) + gf_lkowner_t *owner) { - snprintf (str, size, "Basename=%s, lk-owner=%llu", + snprintf (str, size, "Basename=%s, lk-owner=%s", basename ? basename : "", - (unsigned long long)owner); + lkowner_utoa (owner)); } static void @@ -302,7 +303,7 @@ afr_trace_inodelk_in (call_frame_t *frame, afr_lock_call_type_t lock_call_type, return; } - afr_print_inodelk (lock, 256, cmd, flock, frame->root->lk_owner); + afr_print_inodelk (lock, 256, cmd, flock, &frame->root->lk_owner); afr_print_lockee (lockee, 256, &local->loc, local->fd, child_index); afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock); @@ -339,7 +340,7 @@ afr_trace_entrylk_in (call_frame_t *frame, afr_lock_call_type_t lock_call_type, return; } - afr_print_entrylk (lock, 256, basename, frame->root->lk_owner); + afr_print_entrylk (lock, 256, basename, &frame->root->lk_owner); afr_print_lockee (lockee, 256, &local->loc, local->fd, child_index); afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock); @@ -602,8 +603,8 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this) flock.l_type = F_UNLCK; gf_log (this->name, GF_LOG_DEBUG, "attempting data unlock range %"PRIu64 - " %"PRIu64" by %"PRIu64, flock.l_start, flock.l_len, - frame->root->lk_owner); + " %"PRIu64" by %s", flock.l_start, flock.l_len, + lkowner_utoa (&frame->root->lk_owner)); call_count = afr_locked_nodes_count (int_lock->inode_locked_nodes, priv->child_count); @@ -1422,8 +1423,8 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this) flock.l_type = int_lock->lk_flock.l_type; gf_log (this->name, GF_LOG_DEBUG, "attempting data lock range %"PRIu64 - " %"PRIu64" by %"PRIu64, flock.l_start, flock.l_len, - frame->root->lk_owner); + " %"PRIu64" by %s", flock.l_start, flock.l_len, + lkowner_utoa (&frame->root->lk_owner)); full_flock.l_type = int_lock->lk_flock.l_type; diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 83920c081b7..c1c1d483e54 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -395,8 +395,8 @@ afr_sh_data_erase_pending (call_frame_t *frame, xlator_t *this) afr_sh_pending_to_delta (priv, sh->xattr, sh->delta_matrix, sh->success, priv->child_count, AFR_DATA_TRANSACTION); - gf_log (this->name, GF_LOG_DEBUG, "Delta matrix for: %"PRIu64, - frame->root->lk_owner); + gf_log (this->name, GF_LOG_DEBUG, "Delta matrix for: %s", + lkowner_utoa (&frame->root->lk_owner)); afr_sh_print_pending_matrix (sh->delta_matrix, this); erase_xattr = GF_CALLOC (sizeof (*erase_xattr), priv->child_count, @@ -658,8 +658,9 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) sh = &local->self_heal; priv = this->private; - gf_log (this->name, GF_LOG_DEBUG, "Pending matrix for: %"PRIu64, - frame->root->lk_owner); + gf_log (this->name, GF_LOG_DEBUG, "Pending matrix for: %s", + lkowner_utoa (&frame->root->lk_owner)); + nsources = afr_build_sources (this, sh->xattr, sh->buf, sh->pending_matrix, sh->sources, sh->success_children, AFR_DATA_TRANSACTION, NULL, _gf_false); @@ -1131,14 +1132,16 @@ afr_sh_data_post_blocking_inodelk_cbk (call_frame_t *frame, xlator_t *this) if (int_lock->lock_op_ret < 0) { gf_log (this->name, GF_LOG_ERROR, "Blocking data inodelks " - "failed for %s. by %"PRIu64, - local->loc.path, frame->root->lk_owner); + "failed for %s. by %s", + local->loc.path, lkowner_utoa (&frame->root->lk_owner)); + sh->data_lock_failure_handler (frame, this); } else { gf_log (this->name, GF_LOG_DEBUG, "Blocking data inodelks " - "done for %s by %"PRIu64". Proceding to self-heal", - local->loc.path, frame->root->lk_owner); + "done for %s by %s. Proceding to self-heal", + local->loc.path, lkowner_utoa (&frame->root->lk_owner)); + sh->data_lock_success_handler (frame, this); } @@ -1158,15 +1161,16 @@ afr_sh_data_post_nonblocking_inodelk_cbk (call_frame_t *frame, xlator_t *this) if (int_lock->lock_op_ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "Non Blocking data inodelks " - "failed for %s. by %"PRIu64, - local->loc.path, frame->root->lk_owner); + "failed for %s. by %s", + local->loc.path, lkowner_utoa (&frame->root->lk_owner)); + int_lock->lock_cbk = afr_sh_data_post_blocking_inodelk_cbk; afr_blocking_lock (frame, this); } else { gf_log (this->name, GF_LOG_DEBUG, "Non Blocking data inodelks " - "done for %s by %"PRIu64". Proceeding to self-heal", - local->loc.path, frame->root->lk_owner); + "done for %s by %s. Proceeding to self-heal", + local->loc.path, lkowner_utoa (&frame->root->lk_owner)); sh->data_lock_success_handler (frame, this); } diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c index b92c50e851d..73389009d68 100644 --- a/xlators/cluster/afr/src/pump.c +++ b/xlators/cluster/afr/src/pump.c @@ -694,7 +694,7 @@ pump_start (call_frame_t *pump_frame, xlator_t *this) priv = this->private; pump_priv = priv->pump_private; - pump_frame->root->lk_owner = (uint64_t) (unsigned long)pump_frame->root; + afr_set_lk_owner (pump_frame, this); pump_pid = (uint64_t) (unsigned long)pump_frame->root; ret = synctask_new (pump_priv->env, pump_task, @@ -708,8 +708,8 @@ pump_start (call_frame_t *pump_frame, xlator_t *this) } gf_log (this->name, GF_LOG_DEBUG, - "setting pump as started lk_owner: %"PRIu64" %"PRIu64, - pump_frame->root->lk_owner, pump_pid); + "setting pump as started lk_owner: %s %"PRIu64, + lkowner_utoa (&pump_frame->root->lk_owner), pump_pid); priv->use_afr_in_pump = 1; out: -- cgit