summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heald.c
diff options
context:
space:
mode:
authorarao <arao@redhat.com>2015-03-06 12:33:05 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-06-28 23:15:44 -0700
commit10dfc9b4d4d04314ccd0f6a4eb0ee0341fd91e0d (patch)
tree2564ca15673b2ea186fc707817439f1edd1316ce /xlators/cluster/afr/src/afr-self-heald.c
parentfedcdc8a1749ca5074576e2307fab669808d73bc (diff)
afr: Porting messages to new logging framework
updated Backport of http://review.gluster.org/9897 Cherry picked from 58a736111fa1db4f10c6646e81066434260f674f >Change-Id: I94ac7b2cb0d43a82cf0eeee21407cff9b575c458 >BUG: 1194640 >Signed-off-by: arao <arao@redhat.com> >Signed-off-by: Mohamed Ashiq <mliyazud@redhat.com> >Reviewed-on: http://review.gluster.org/9897 >Tested-by: Gluster Build System <jenkins@build.gluster.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Change-Id: I5fb464da38594579f31661b42a8a3e9d858a797e BUG: 1217722 Signed-off-by: arao <arao@redhat.com> Signed-off-by: Mohamed Ashiq <mliyazud@redhat.com> Reviewed-on: http://review.gluster.org/11351 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anuradha Talur <atalur@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heald.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c107
1 files changed, 63 insertions, 44 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index fe9367597a2..7bc39a1036b 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -19,6 +19,7 @@
#include "afr-self-heald.h"
#include "protocol-common.h"
#include "syncop-utils.h"
+#include "afr-messages.h"
#define SHD_INODE_LRU_LIMIT 2048
#define AFR_EH_SPLIT_BRAIN_LIMIT 1024
@@ -209,8 +210,8 @@ afr_shd_index_inode (xlator_t *this, xlator_t *subvol)
if (ret)
goto out;
- gf_log (this->name, GF_LOG_DEBUG, "index-dir gfid for %s: %s",
- subvol->name, uuid_utoa (index_gfid));
+ gf_msg_debug (this->name, 0, "index-dir gfid for %s: %s",
+ subvol->name, uuid_utoa (index_gfid));
inode = afr_shd_inode_find (this, subvol, index_gfid);
@@ -405,8 +406,8 @@ afr_shd_index_heal (xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
if (!priv->shd.enabled)
return -EBUSY;
- gf_log (healer->this->name, GF_LOG_DEBUG, "got entry: %s",
- entry->d_name);
+ gf_msg_debug (healer->this->name, 0, "got entry: %s",
+ entry->d_name);
ret = gf_uuid_parse (entry->d_name, gfid);
if (ret)
@@ -440,8 +441,9 @@ afr_shd_index_sweep (struct subvol_healer *healer)
loc.inode = afr_shd_index_inode (healer->this, subvol);
if (!loc.inode) {
- gf_log (healer->this->name, GF_LOG_WARNING,
- "unable to get index-dir on %s", subvol->name);
+ gf_msg (healer->this->name, GF_LOG_WARNING,
+ 0, AFR_MSG_INDEX_DIR_GET_FAILED,
+ "unable to get index-dir on %s", subvol->name);
return -errno;
}
@@ -507,9 +509,9 @@ afr_shd_index_healer (void *data)
ASSERT_LOCAL(this, healer);
do {
- gf_log (this->name, GF_LOG_DEBUG,
- "starting index sweep on subvol %s",
- afr_subvol_name (this, healer->subvol));
+ gf_msg_debug (this->name, 0,
+ "starting index sweep on subvol %s",
+ afr_subvol_name (this, healer->subvol));
afr_shd_sweep_prepare (healer);
@@ -524,9 +526,9 @@ afr_shd_index_healer (void *data)
could not be healed thus far.
*/
- gf_log (this->name, GF_LOG_DEBUG,
- "finished index sweep on subvol %s",
- afr_subvol_name (this, healer->subvol));
+ gf_msg_debug (this->name, 0,
+ "finished index sweep on subvol %s",
+ afr_subvol_name (this, healer->subvol));
/*
Give a pause before retrying to avoid a busy loop
in case the only entry in index is because of
@@ -564,9 +566,9 @@ afr_shd_full_healer (void *data)
ASSERT_LOCAL(this, healer);
- gf_log (this->name, GF_LOG_INFO,
- "starting full sweep on subvol %s",
- afr_subvol_name (this, healer->subvol));
+ gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_SELF_HEAL_INFO,
+ "starting full sweep on subvol %s",
+ afr_subvol_name (this, healer->subvol));
afr_shd_sweep_prepare (healer);
@@ -574,9 +576,9 @@ afr_shd_full_healer (void *data)
afr_shd_sweep_done (healer);
- gf_log (this->name, GF_LOG_INFO,
- "finished full sweep on subvol %s",
- afr_subvol_name (this, healer->subvol));
+ gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_SELF_HEAL_INFO,
+ "finished full sweep on subvol %s",
+ afr_subvol_name (this, healer->subvol));
}
return NULL;
@@ -681,7 +683,8 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
ret = dict_get_int32 (output, this->name, &xl_id);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "xl does not have id");
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ AFR_MSG_DICT_GET_FAILED, "xl does not have id");
goto out;
}
@@ -693,8 +696,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
xl_id, child, count);
ret = dict_set_uint64(output, key, healed_count);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not add statistics_healed_count to outout");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not add statistics_healed_count to outout");
goto out;
}
@@ -702,8 +706,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
xl_id, child, count);
ret = dict_set_uint64 (output, key, split_brain_count);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not add statistics_split_brain_count to outout");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not add statistics_split_brain_count to outout");
goto out;
}
@@ -711,8 +716,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
xl_id, child, count);
ret = dict_set_str (output, key, crawl_type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not add statistics_crawl_type to output");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not add statistics_crawl_type to output");
goto out;
}
@@ -720,8 +726,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
xl_id, child, count);
ret = dict_set_uint64 (output, key, heal_failed_count);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not add statistics_healed_failed_count to outout");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not add statistics_healed_failed_count to outout");
goto out;
}
@@ -729,8 +736,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
xl_id, child, count);
ret = dict_set_dynstr (output, key, start_time_str);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not add statistics_crawl_start_time to outout");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not add statistics_crawl_start_time to outout");
goto out;
} else {
start_time_str = NULL;
@@ -747,8 +755,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
end_time_str = gf_strdup ("Could not determine the end time");
ret = dict_set_dynstr (output, key, end_time_str);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not add statistics_crawl_end_time to outout");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not add statistics_crawl_end_time to outout");
goto out;
} else {
end_time_str = NULL;
@@ -759,16 +768,18 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
ret = dict_set_int32 (output, key, progress);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not add statistics_inprogress to outout");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not add statistics_inprogress to outout");
goto out;
}
snprintf (key, sizeof (key), "statistics-%d-%d-count", xl_id, child);
ret = dict_set_uint64 (output, key, count + 1);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not increment the counter.");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not increment the counter.");
goto out;
}
out:
@@ -789,7 +800,8 @@ afr_shd_dict_add_path (xlator_t *this, dict_t *output, int child, char *path,
ret = dict_get_int32 (output, this->name, &xl_id);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "xl does not have id");
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ AFR_MSG_DICT_GET_FAILED, "xl does not have id");
goto out;
}
@@ -800,7 +812,8 @@ afr_shd_dict_add_path (xlator_t *this, dict_t *output, int child, char *path,
ret = dict_set_dynstr (output, key, path);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s: Could not add to output",
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ AFR_MSG_DICT_SET_FAILED, "%s: Could not add to output",
path);
goto out;
}
@@ -810,8 +823,10 @@ afr_shd_dict_add_path (xlator_t *this, dict_t *output, int child, char *path,
child, count);
ret = dict_set_uint32 (output, key, tv->tv_sec);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s: Could not set time",
- path);
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "%s: Could not set time",
+ path);
goto out;
}
}
@@ -820,7 +835,9 @@ afr_shd_dict_add_path (xlator_t *this, dict_t *output, int child, char *path,
ret = dict_set_uint64 (output, key, count + 1);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Could not increment count");
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, AFR_MSG_DICT_SET_FAILED,
+ "Could not increment count");
goto out;
}
@@ -844,8 +861,8 @@ afr_shd_gather_entry (xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
this = THIS;
priv = this->private;
- gf_log (this->name, GF_LOG_DEBUG, "got entry: %s",
- entry->d_name);
+ gf_msg_debug (this->name, 0, "got entry: %s",
+ entry->d_name);
ret = gf_uuid_parse (entry->d_name, gfid);
if (ret)
@@ -882,7 +899,8 @@ afr_shd_gather_index_entries (xlator_t *this, int child, dict_t *output)
loc.inode = afr_shd_index_inode (this, subvol);
if (!loc.inode) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING,
+ 0, AFR_MSG_INDEX_DIR_GET_FAILED,
"unable to get index-dir on %s", subvol->name);
return -errno;
}
@@ -1187,7 +1205,8 @@ afr_xl_op (xlator_t *this, dict_t *input, dict_t *output)
break;
default:
- gf_log (this->name, GF_LOG_ERROR, "Unknown set op %d", op);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ AFR_MSG_INVALID_ARG, "Unknown set op %d", op);
break;
}
out: