From 73517fedf7840363b9f688183e604a617d934652 Mon Sep 17 00:00:00 2001 From: arao Date: Fri, 12 Jun 2015 16:35:53 +0530 Subject: dht: Adding log messages to the new logging framework Backported from: http://review.gluster.org/10021 > Change-Id: Ib3bb61c5223f409c23c68100f3fe884918d2dc3f > BUG: 1194640 > Reviewed-on: http://review.gluster.org/10021 > Reviewed-by: N Balachandran > Reviewed-by: Joseph Fernandes > Tested-by: Joseph Fernandes > Reviewed-by: Dan Lambright > Reviewed-by: Raghavendra G > Tested-by: Raghavendra G > Signed-off-by: arao BUG: 1217722 Change-Id: Ide79c6c1e6a466fb52f955c90a2b22711bec794a Signed-off-by: arao Signed-off-by: Anusha Rao Reviewed-on: http://review.gluster.org/11350 Tested-by: NetBSD Build System Reviewed-by: Raghavendra G Tested-by: Gluster Build System --- xlators/cluster/dht/src/dht-selfheal.c | 47 +++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'xlators/cluster/dht/src/dht-selfheal.c') diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index c881a361804..cfe7e5a63ce 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -145,7 +145,8 @@ dht_refresh_layout_done (call_frame_t *frame) ret = dht_layout_sort (refreshed); if (ret == -1) { - gf_log (frame->this->name, GF_LOG_WARNING, + gf_msg (frame->this->name, GF_LOG_WARNING, 0, + DHT_MSG_LAYOUT_SORT_FAILED, "sorting the layout failed"); goto err; } @@ -197,10 +198,9 @@ dht_refresh_layout_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { local->op_errno = op_errno; - gf_msg_debug (this->name, 0, - "lookup of %s on %s returned error (%s)", - local->loc.path, prev->this->name, - strerror (op_errno)); + gf_msg_debug (this->name, op_errno, + "lookup of %s on %s returned error", + local->loc.path, prev->this->name); goto unlock; } @@ -941,9 +941,9 @@ dht_selfheal_dir_xattr_for_nameless_lookup (call_frame_t *frame, loc_t *loc, } - gf_log (this->name, GF_LOG_TRACE, - "%d subvolumes missing xattr for %s", - missing_xattr, loc->path); + gf_msg_trace (this->name, 0, + "%d subvolumes missing xattr for %s", + missing_xattr, loc->path); if (missing_xattr == 0) { dht_selfheal_dir_finish (frame, this, 0); @@ -1218,7 +1218,8 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, dht_selfheal_dir_mkdir_setacl (local->xattr, dict); if (!dict) - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + DHT_MSG_DICT_SET_FAILED, "dict is NULL, need to make sure gfids are same"); for (i = 0; i < layout->cnt; i++) { @@ -1488,14 +1489,16 @@ dht_fix_layout_of_directory (call_frame_t *frame, loc_t *loc, if (priv->du_stats) { for (i = 0; i < priv->subvolume_cnt; ++i) { - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, + DHT_MSG_SUBVOL_INFO, "subvolume %d (%s): %u chunks", i, priv->subvolumes[i]->name, priv->du_stats[i].chunks); } } else { - gf_log (this->name, GF_LOG_WARNING, "no du stats ?!?"); + gf_msg (this->name, GF_LOG_WARNING, 0, + DHT_MSG_NO_DISK_USAGE_STATUS, "no du stats ?!?"); } /* First give it a layout as though it is a new directory. This @@ -1594,9 +1597,9 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc, if (weight_by_size && total_size) { /* We know total_size is not zero. */ chunk = ((unsigned long) 0xffffffff) / total_size; - gf_log (this->name, GF_LOG_DEBUG, - "chunk size = 0xffffffff / %u = 0x%x", - total_size, chunk); + gf_msg_debug (this->name, 0, + "chunk size = 0xffffffff / %u = 0x%x", + total_size, chunk); } else { weight_by_size = _gf_false; @@ -1633,9 +1636,10 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc, else { curr_size = 1; } - gf_log (this->name, GF_LOG_DEBUG, - "assigning range size 0x%x to %s", chunk * curr_size, - layout->list[i].xlator->name); + gf_msg_debug (this->name, 0, + "assigning range size 0x%x to %s", + chunk * curr_size, + layout->list[i].xlator->name); DHT_SET_LAYOUT_RANGE(layout, i, start, chunk * curr_size, loc->path); if (++bricks_used >= bricks_to_use) { @@ -1840,14 +1844,16 @@ dht_selfheal_directory_for_nameless_lookup (call_frame_t *frame, local->selfheal.layout = dht_layout_ref (this, layout); if (down) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + DHT_MSG_SUBVOL_DOWN_ERROR, "%d subvolumes down -- not fixing", down); ret = 0; goto sorry_no_fix; } if (misc) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + DHT_MSG_SUBVOL_ERROR, "%d subvolumes have unrecoverable errors", misc); ret = 0; goto sorry_no_fix; @@ -1857,7 +1863,8 @@ dht_selfheal_directory_for_nameless_lookup (call_frame_t *frame, ret = dht_selfheal_dir_getafix (frame, loc, layout); if (ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + DHT_MSG_LAYOUT_FORM_FAILED, "not able to form layout for the directory"); goto sorry_no_fix; } -- cgit