From 581e8f64292ec179532a00889fc49ba4f6ac9380 Mon Sep 17 00:00:00 2001
From: arao <arao@redhat.com>
Date: Fri, 12 Jun 2015 16:35:53 +0530
Subject: [PATCH 150/190] dht: Adding log messages to the new logging framework
Change-Id: Ib3bb61c5223f409c23c68100f3fe884918d2dc3f
BUG: 1194640
Signed-off-by: arao <arao@redhat.com>
Reviewed-on: http://review.gluster.org/10021
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Joseph Fernandes <josferna@redhat.com>
Tested-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Signed-off-by: Anusha <arao@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51674
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
---
xlators/cluster/dht/src/dht-common.c | 306 ++++++++-------
xlators/cluster/dht/src/dht-diskusage.c | 6 +-
xlators/cluster/dht/src/dht-helper.c | 73 +++--
xlators/cluster/dht/src/dht-inode-read.c | 24 +-
xlators/cluster/dht/src/dht-inode-write.c | 36 +-
xlators/cluster/dht/src/dht-layout.c | 50 ++-
xlators/cluster/dht/src/dht-linkfile.c | 3 +-
xlators/cluster/dht/src/dht-messages.h | 604 +++++++++++++++++++++++++++--
xlators/cluster/dht/src/dht-rebalance.c | 44 ++-
xlators/cluster/dht/src/dht-rename.c | 22 +-
xlators/cluster/dht/src/dht-selfheal.c | 47 ++-
xlators/cluster/dht/src/dht-shared.c | 36 +-
xlators/cluster/dht/src/nufa.c | 31 +-
xlators/cluster/dht/src/switch.c | 21 +-
xlators/cluster/dht/src/tier.c | 33 +-
15 files changed, 995 insertions(+), 341 deletions(-)
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 868cd79..8b2715f 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -51,7 +51,8 @@ dht_aggregate_quota_xattr (dict_t *dst, char *key, data_t *value)
int64_t src_dir_count = 0;
if (value == NULL) {
- gf_log ("dht", GF_LOG_WARNING, "data value is NULL");
+ gf_msg ("dht", GF_LOG_WARNING, 0,
+ DHT_MSG_DATA_NULL, "data value is NULL");
ret = -1;
goto out;
}
@@ -61,7 +62,8 @@ dht_aggregate_quota_xattr (dict_t *dst, char *key, data_t *value)
meta_dst = GF_CALLOC (1, sizeof (quota_meta_t),
gf_common_quota_meta_t);
if (meta_dst == NULL) {
- gf_msg ("dht", GF_LOG_WARNING, 0, DHT_MSG_NO_MEMORY,
+ gf_msg ("dht", GF_LOG_WARNING, ENOMEM,
+ DHT_MSG_NO_MEMORY,
"Memory allocation failed");
ret = -1;
goto out;
@@ -69,7 +71,8 @@ dht_aggregate_quota_xattr (dict_t *dst, char *key, data_t *value)
ret = dict_set_bin (dst, key, meta_dst,
sizeof (quota_meta_t));
if (ret < 0) {
- gf_log ("dht", GF_LOG_WARNING,
+ gf_msg ("dht", GF_LOG_WARNING, EINVAL,
+ DHT_MSG_DICT_SET_FAILED,
"dht aggregate dict set failed");
GF_FREE (meta_dst);
ret = -1;
@@ -119,8 +122,9 @@ dht_aggregate (dict_t *this, char *key, data_t *value, void *data)
if (strcmp (key, QUOTA_SIZE_KEY) == 0) {
ret = dht_aggregate_quota_xattr (dst, key, value);
if (ret) {
- gf_log ("dht", GF_LOG_WARNING, "Failed to "
- "aggregate qutoa xattr");
+ gf_msg ("dht", GF_LOG_WARNING, 0,
+ DHT_MSG_AGGREGATE_QUOTA_XATTR_FAILED,
+ "Failed to aggregate quota xattr");
goto out;
}
} else if (fnmatch (GF_XATTR_STIME_PATTERN, key, FNM_NOESCAPE) == 0) {
@@ -386,10 +390,9 @@ dht_discover_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;
}
@@ -581,10 +584,9 @@ dht_lookup_dir_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;
}
@@ -708,10 +710,10 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
LOCK (&frame->lock);
{
- gf_msg_debug (this->name, 0,
+ gf_msg_debug (this->name, op_errno,
"revalidate lookup of %s "
- "returned with op_ret %d and op_errno %d",
- local->loc.path, op_ret, op_errno);
+ "returned with op_ret %d",
+ local->loc.path, op_ret);
if (op_ret == -1) {
local->op_errno = op_errno;
@@ -719,11 +721,12 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if ((op_errno != ENOTCONN)
&& (op_errno != ENOENT)
&& (op_errno != ESTALE)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ DHT_MSG_REVALIDATE_CBK_INFO,
"Revalidate: subvolume %s for %s "
- "(gfid = %s) returned -1 (%s)",
+ "(gfid = %s) returned -1",
prev->this->name, local->loc.path,
- gfid, strerror (op_errno));
+ gfid);
}
if (op_errno == ESTALE) {
/* propagate the ESTALE to parent.
@@ -774,7 +777,8 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
conf->link_xattr_name);
if (is_linkfile) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_REVALIDATE_CBK_INFO,
"Revalidate: linkfile found %s, (gfid = %s)",
local->loc.path, gfid);
local->return_estale = 1;
@@ -930,7 +934,7 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
ret = dht_layout_preset (this, local->cached_subvol, local->loc.inode);
if (ret < 0) {
- gf_msg_debug (this->name, 0,
+ gf_msg_debug (this->name, EINVAL,
"Failed to set layout for subvolume %s, "
"(gfid = %s)",
cached_subvol ? cached_subvol->name : "<nil>",
@@ -983,7 +987,8 @@ dht_lookup_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local = (dht_local_t*)frame->local;
path = local->loc.path;
- gf_log (this->name, GF_LOG_INFO, "lookup_unlink returned with "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_UNLINK_LOOKUP_INFO, "lookup_unlink returned with "
"op_ret -> %d and op-errno -> %d for %s", op_ret, op_errno,
((path == NULL)? "null" : path ));
@@ -1008,7 +1013,8 @@ dht_lookup_unlink_of_false_linkto_cbk (call_frame_t *frame, void *cookie,
local = (dht_local_t*)frame->local;
path = local->loc.path;
- gf_log (this->name, GF_LOG_INFO, "lookup_unlink returned with "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_UNLINK_LOOKUP_INFO, "lookup_unlink returned with "
"op_ret -> %d and op-errno -> %d for %s", op_ret, op_errno,
((path == NULL)? "null" : path ));
@@ -1032,7 +1038,8 @@ dht_lookup_unlink_of_false_linkto_cbk (call_frame_t *frame, void *cookie,
if (op_errno == EBUSY) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ DHT_MSG_UNLINK_FAILED,
"Could not unlink the linkto file as "
"either fd is open and/or linkto xattr "
"is set for %s",
@@ -1069,7 +1076,9 @@ dht_lookup_unlink_stale_linkto_cbk (call_frame_t *frame, void *cookie,
if (local && local->loc.path)
path = local->loc.path;
- gf_log (this->name, GF_LOG_INFO, "Returned with op_ret %d and "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_UNLINK_LOOKUP_INFO,
+ "Returned with op_ret %d and "
"op_errno %d for %s", op_ret, op_errno,
((path==NULL)?"null":path));
@@ -1296,7 +1305,8 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
ret = dht_layout_preset (this, cached_subvol,
local->loc.inode);
if (ret) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LAYOUT_PRESET_FAILED,
"Could not set pre-set layout "
"for subvolume %s",
cached_subvol->name);
@@ -1385,7 +1395,8 @@ preset_layout:
local->op_errno = 0;
layout = dht_layout_for_subvol (this, cached_subvol);
if (!layout) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO,
"%s: no pre-set layout for subvolume %s,"
" gfid = %s",
local->loc.path, (cached_subvol ?
@@ -1395,7 +1406,8 @@ preset_layout:
ret = dht_layout_set (this, local->inode, layout);
if (ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO,
"%s: failed to set layout for subvol %s, "
"gfid = %s",
local->loc.path, (cached_subvol ?
@@ -1429,7 +1441,8 @@ preset_layout:
ret = dht_layout_preset (frame->this, cached_subvol,
local->inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LAYOUT_PRESET_FAILED,
"Failed to set layout for subvol %s"
", gfid = %s",
cached_subvol ? cached_subvol->name :
@@ -1646,7 +1659,8 @@ unlock:
dict_unref (dict_req);
} else {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO,
"attempting deletion of stale linkfile "
"%s on %s (hashed subvol is %s)",
loc->path, subvol->name,
@@ -1744,10 +1758,10 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
gf_uuid_unparse(loc->gfid, gfid);
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_INFO,
- "Lookup of %s on %s (following linkfile) failed (%s)"
- ",gfid = %s", local->loc.path, subvol->name,
- strerror (op_errno), gfid);
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ DHT_MSG_LINK_FILE_LOOKUP_INFO,
+ "Lookup of %s on %s (following linkfile) failed "
+ ",gfid = %s", local->loc.path, subvol->name, gfid);
/* If cached subvol returned ENOTCONN, do not do
lookup_everywhere. We need to make sure linkfile does not get
@@ -1761,14 +1775,16 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
}
if (check_is_dir (inode, stbuf, xattr)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LINK_FILE_LOOKUP_INFO,
"Lookup of %s on %s (following linkfile) reached dir,"
" gfid = %s", local->loc.path, subvol->name, gfid);
goto err;
}
if (check_is_linkfile (inode, stbuf, xattr, conf->link_xattr_name)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LINK_FILE_LOOKUP_INFO,
"lookup of %s on %s (following linkfile) reached link,"
"gfid = %s", local->loc.path, subvol->name, gfid);
goto err;
@@ -1791,7 +1807,8 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LAYOUT_PRESET_FAILED,
"Failed to set layout for subvolume %s,"
"gfid = %s", prev->this->name, gfid);
op_ret = -1;
@@ -1908,9 +1925,9 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!op_ret && gf_uuid_is_null (local->gfid))
memcpy (local->gfid, stbuf->ia_gfid, 16);
- gf_msg_debug (this->name, 0,
- "fresh_lookup returned for %s with op_ret %d and "
- "op_errno %d", loc->path, op_ret, op_errno);
+ gf_msg_debug (this->name, op_errno,
+ "fresh_lookup returned for %s with op_ret %d",
+ loc->path, op_ret);
if (!conf->vch_forced) {
ret = dict_get_uint32 (xattr, conf->commithash_xattr_name,
@@ -1936,13 +1953,13 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
(parent_layout->commit_hash !=
conf->vol_commit_hash)) {
gf_msg_debug (this->name, 0,
- "hashes don't match (ret - %d,"
- " parent_layout - %p, parent_hash - %x,"
- " vol_hash - %x), do global lookup",
- ret, parent_layout,
- (parent_layout ?
- parent_layout->commit_hash : -1),
- conf->vol_commit_hash);
+ "hashes don't match (ret - %d,"
+ " parent_layout - %p, parent_hash - %x,"
+ " vol_hash - %x), do global lookup",
+ ret, parent_layout,
+ (parent_layout ?
+ parent_layout->commit_hash : -1),
+ conf->vol_commit_hash);
local->op_errno = ENOENT;
dht_lookup_everywhere (frame, this, loc);
return 0;
@@ -1987,9 +2004,10 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
if (op_ret == -1) {
- gf_msg_debug (this->name, 0, "Lookup of %s for subvolume"
- " %s failed with error %s", loc->path,
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "Lookup of %s for subvolume"
+ " %s failed", loc->path,
+ prev->this->name);
goto out;
}
@@ -2001,7 +2019,8 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LAYOUT_PRESET_FAILED,
"could not set pre-set layout for subvolume %s",
prev->this->name);
op_ret = -1;
@@ -2014,7 +2033,8 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
subvol = dht_linkfile_subvol (this, inode, stbuf, xattr);
if (!subvol) {
- gf_log (this->name, GF_LOG_INFO, "linkfile not having link "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO, "linkfile not having link "
"subvol for %s", loc->path);
gf_msg_debug (this->name, 0,
@@ -2072,7 +2092,7 @@ dht_check_and_set_acl_xattr_req (inode_t *inode, dict_t *xattr_req)
if (!dict_get (xattr_req, POSIX_ACL_ACCESS_XATTR)) {
ret = dict_set_int8 (xattr_req, POSIX_ACL_ACCESS_XATTR, 0);
if (ret)
- gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ gf_msg (THIS->name, GF_LOG_WARNING, -ret,
DHT_MSG_DICT_SET_FAILED,
"Failed to set dictionary value:key = %s",
POSIX_ACL_ACCESS_XATTR);
@@ -2081,7 +2101,7 @@ dht_check_and_set_acl_xattr_req (inode_t *inode, dict_t *xattr_req)
if (!dict_get (xattr_req, POSIX_ACL_DEFAULT_XATTR)) {
ret = dict_set_int8 (xattr_req, POSIX_ACL_DEFAULT_XATTR, 0);
if (ret)
- gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ gf_msg (THIS->name, GF_LOG_WARNING, -ret,
DHT_MSG_DICT_SET_FAILED,
"Failed to set dictionary value:key = %s",
POSIX_ACL_DEFAULT_XATTR);
@@ -2132,7 +2152,7 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
/* check if loc_dup() is successful */
if (ret == -1) {
op_errno = errno;
- gf_msg_debug (this->name, 0,
+ gf_msg_debug (this->name, errno,
"copying location failed for path=%s",
loc->path);
goto err;
@@ -2352,9 +2372,9 @@ dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
local->op_ret = -1;
local->op_errno = op_errno;
- gf_msg_debug (this->name, 0,
- "Unlink: subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "Unlink: subvolume %s returned -1",
+ prev->this->name);
goto unlock;
}
@@ -2398,10 +2418,10 @@ dht_unlink_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if ((op_ret == -1) && !((op_errno == ENOENT) ||
(op_errno == ENOTCONN))) {
local->op_errno = op_errno;
- gf_msg_debug (this->name, 0,
+ gf_msg_debug (this->name, op_errno,
"Unlink link: subvolume %s"
- " returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ " returned -1",
+ prev->this->name);
goto unlock;
}
@@ -2449,9 +2469,9 @@ dht_err_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,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto unlock;
}
@@ -2515,9 +2535,9 @@ dht_vgetxattr_alloc_and_fill (dht_local_t *local, dict_t *xattr, xlator_t *this,
ret = dict_get_str (xattr, local->xsel, &value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Subvolume %s returned -1 (%s)", this->name,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ DHT_MSG_GET_XATTR_FAILED,
+ "Subvolume %s returned -1", this->name);
local->op_ret = -1;
local->op_errno = op_errno;
goto out;
@@ -2602,7 +2622,8 @@ dht_vgetxattr_fill_and_set (dht_local_t *local, dict_t **dict, xlator_t *this,
(void) snprintf (xattr_buf, local->alloc_len, "%s",
local->xattr_val);
} else {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_GET_XATTR_FAILED,
"Unknown local->xsel (%s)", local->xsel);
GF_FREE (xattr_buf);
goto out;
@@ -2644,9 +2665,9 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
this_call_cnt = --local->call_cnt;
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "getxattr err (%s) for dir",
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ DHT_MSG_GET_XATTR_FAILED,
+ "getxattr err for dir");
local->op_ret = -1;
local->op_errno = op_errno;
goto unlock;
@@ -2655,8 +2676,9 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dict_get_str (xattr, local->xsel, &uuid_list);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
- "get %s", local->xsel);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_GET_FAILED,
+ "Failed to get %s", local->xsel);
local->op_ret = -1;
local->op_errno = EINVAL;
goto unlock;
@@ -2668,7 +2690,9 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
next_uuid_str = strtok_r (NULL, " ", &saveptr);
if (gf_uuid_parse (uuid_str, node_uuid)) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to parse uuid"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_UUID_PARSE_ERROR,
+ "Failed to parse uuid"
" failed for %s", prev->this->name);
local->op_ret = -1;
local->op_errno = EINVAL;
@@ -2676,13 +2700,14 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
if (gf_uuid_compare (node_uuid, conf->defrag->node_uuid)) {
- gf_log (this->name, GF_LOG_DEBUG, "subvol %s does not"
- "belong to this node", prev->this->name);
+ gf_msg_debug (this->name, 0, "subvol %s does not"
+ "belong to this node",
+ prev->this->name);
} else {
conf->local_subvols[(conf->local_subvols_cnt)++]
= prev->this;
- gf_log (this->name, GF_LOG_DEBUG, "subvol %s belongs to"
- " this node", prev->this->name);
+ gf_msg_debug (this->name, 0, "subvol %s belongs to"
+ " this node", prev->this->name);
break;
}
}
@@ -2727,9 +2752,9 @@ dht_vgetxattr_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
this_call_cnt = --local->call_cnt;
if (op_ret < 0) {
if (op_errno != ENOTCONN) {
- gf_log (this->name, GF_LOG_ERROR,
- "getxattr err (%s) for dir",
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ DHT_MSG_GET_XATTR_FAILED,
+ "getxattr err for dir");
local->op_ret = -1;
local->op_errno = op_errno;
}
@@ -2740,7 +2765,8 @@ dht_vgetxattr_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dht_vgetxattr_alloc_and_fill (local, xattr, this,
op_errno);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ DHT_MSG_DICT_SET_FAILED,
"alloc or fill failure");
}
unlock:
@@ -2787,9 +2813,10 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
local->op_ret = -1;
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_ERROR,
- "vgetxattr: Subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ DHT_MSG_GET_XATTR_FAILED,
+ "vgetxattr: Subvolume %s returned -1",
+ prev->this->name);
goto unwind;
}
@@ -2948,7 +2975,8 @@ dht_getxattr_get_real_filename_cbk (call_frame_t *frame, void *cookie,
local->op_ret = op_ret;
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_WARNING, "At least "
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ DHT_MSG_UPGRADE_BRICKS, "At least "
"one of the bricks does not support "
"this operation. Please upgrade all "
"bricks.");
@@ -2967,9 +2995,9 @@ dht_getxattr_get_real_filename_cbk (call_frame_t *frame, void *cookie,
* down subvol and return a good result(if any)
* from other subvol.
*/
- gf_log (this->name, GF_LOG_WARNING,
- "Failed to get real filename. "
- "error:%s", strerror (op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ DHT_MSG_GET_XATTR_FAILED,
+ "Failed to get real filename.");
goto unlock;
}
@@ -2993,8 +3021,8 @@ dht_getxattr_get_real_filename_cbk (call_frame_t *frame, void *cookie,
local->op_ret = op_ret;
local->op_errno = 0;
- gf_log (this->name, GF_LOG_DEBUG, "Found a matching "
- "file.");
+ gf_msg_debug (this->name, 0, "Found a matching "
+ "file.");
}
unlock:
UNLOCK (&frame->lock);
@@ -3119,7 +3147,9 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
ret = gf_asprintf
(&node_uuid_key, "%s", GF_XATTR_NODE_UUID_KEY);
if (ret == -1 || !node_uuid_key) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to copy key");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_NO_MEMORY,
+ "Failed to copy key");
op_errno = ENOMEM;
goto err;
}
@@ -3455,8 +3485,8 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
DHT_IATT_IN_XDATA_KEY, "yes");
if (ret) {
gf_msg_debug (this->name, 0,
- "Failed to set dictionary key %s for fd=%p",
- DHT_IATT_IN_XDATA_KEY, fd);
+ "Failed to set dictionary key %s for fd=%p",
+ DHT_IATT_IN_XDATA_KEY, fd);
}
STACK_WIND (frame, dht_file_setxattr_cbk, subvol,
@@ -3732,13 +3762,12 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
tmp = dict_get (xattr, GF_XATTR_FIX_LAYOUT_KEY);
if (tmp) {
-
ret = dict_get_uint32(xattr, "new-commit-hash", &new_hash);
if (ret == 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "updating commit hash for %s from %u to %u",
- uuid_utoa(loc->gfid),
- layout->commit_hash, new_hash);
+ gf_msg_debug (this->name, 0,
+ "updating commit hash for %s from %u to %u",
+ uuid_utoa(loc->gfid),
+ layout->commit_hash, new_hash);
layout->commit_hash = new_hash;
ret = dht_update_commit_hash_for_layout (frame);
@@ -3749,7 +3778,8 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
return ret;
}
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_FIX_LAYOUT_INFO,
"fixing the layout of %s", loc->path);
ret = dht_fix_directory_layout (frame, dht_common_setxattr_cbk,
@@ -3779,7 +3809,8 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
}
return ret;
}
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_OPERATION_NOT_SUP,
"wrong 'directory-spread-count' value (%s)", value);
op_errno = ENOTSUP;
goto err;
@@ -3940,9 +3971,9 @@ dht_removexattr_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,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto unlock;
}
@@ -4028,7 +4059,8 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
ret = dict_set_dynstr_with_alloc (xdata,
DHT_IATT_IN_XDATA_KEY, "yes");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ DHT_MSG_DICT_SET_FAILED, "Failed to "
"set dictionary key %s for %s",
DHT_IATT_IN_XDATA_KEY, loc->path);
}
@@ -4116,7 +4148,8 @@ dht_fremovexattr (call_frame_t *frame, xlator_t *this,
ret = dict_set_dynstr_with_alloc (xdata,
DHT_IATT_IN_XDATA_KEY, "yes");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ DHT_MSG_DICT_SET_FAILED, "Failed to "
"set dictionary key %s for fd=%p",
DHT_IATT_IN_XDATA_KEY, fd);
}
@@ -4154,9 +4187,9 @@ dht_fd_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,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto unlock;
}
@@ -4248,7 +4281,9 @@ dht_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
break;
default:
- gf_log (this->name, GF_LOG_ERROR, "Encountered third "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_VALUE,
+ "Encountered third "
"value for boolean variable %d",
local->quota_deem_statfs);
break;
@@ -4661,7 +4696,7 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!subvol || (subvol == prev->this)) {
entry = gf_dirent_for_name (orig_entry->d_name);
if (!entry) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
DHT_MSG_NO_MEMORY,
"Memory allocation failed ");
goto unwind;
@@ -4944,7 +4979,7 @@ dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dht_layout_preset (this, prev, inode);
if (ret < 0) {
- gf_msg_debug (this->name, 0,
+ gf_msg_debug (this->name, EINVAL,
"could not set pre-set layout for subvolume %s",
prev? prev->name: NULL);
op_ret = -1;
@@ -5521,7 +5556,8 @@ dht_create (call_frame_t *frame, xlator_t *this,
if (dht_filter_loc_subvol_key (this, loc, &local->loc,
&subvol)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO,
"creating %s on %s (got create on %s)",
local->loc.path, subvol->name, loc->path);
STACK_WIND (frame, dht_create_cbk,
@@ -5873,11 +5909,11 @@ dht_rmdir_hashed_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
- gf_msg_debug (this->name, 0,
+ gf_msg_debug (this->name, op_errno,
"rmdir on %s for %s failed "
- "(gfid = %s) (%s)",
+ "(gfid = %s)",
prev->this->name, local->loc.path,
- gfid, strerror (op_errno));
+ gfid);
goto unlock;
}
@@ -5953,11 +5989,11 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_uuid_unparse(local->loc.gfid, gfid);
- gf_msg_debug (this->name, 0,
+ gf_msg_debug (this->name, op_errno,
"rmdir on %s for %s failed."
- "(gfid = %s) (%s)",
+ "(gfid = %s)",
prev->this->name, local->loc.path,
- gfid, strerror (op_errno));
+ gfid);
goto unlock;
}
@@ -6120,10 +6156,9 @@ dht_rmdir_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this
} else {
main_local->op_ret = -1;
main_local->op_errno = op_errno;
- gf_msg_debug (this->name, 0,
- "Unlink of %s on %s failed. (gfid = %s) (%s)",
- local->loc.path, src->name, gfid,
- strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "Unlink of %s on %s failed. (gfid = %s)",
+ local->loc.path, src->name, gfid);
}
this_call_cnt = dht_frame_return (main_frame);
@@ -6165,7 +6200,8 @@ dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_uuid_unparse(local->loc.gfid, gfid);
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_NOT_LINK_FILE_ERROR,
"%s on %s is not a linkfile (type=0%o, gfid = %s)",
local->loc.path, src->name, stbuf->ia_type, gfid);
goto err;
@@ -6210,7 +6246,8 @@ dht_rmdir_cached_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
main_local->op_ret = -1;
main_local->op_errno = ENOTEMPTY;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_SUBVOL_ERROR,
"%s found on cached subvol %s",
local->loc.path, src->name);
goto err;
@@ -6222,7 +6259,8 @@ dht_rmdir_cached_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
xattrs = dict_new ();
if (!xattrs) {
- gf_log (this->name, GF_LOG_ERROR, "dict_new failed");
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ DHT_MSG_NO_MEMORY, "dict_new failed");
goto err;
}
@@ -6291,7 +6329,8 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,
xattrs = dict_new ();
if (!xattrs) {
- gf_log (this->name, GF_LOG_ERROR, "dict_new failed");
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ DHT_MSG_NO_MEMORY, "dict_new failed");
return -1;
}
@@ -6354,7 +6393,8 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,
subvol = dht_linkfile_subvol (this, NULL, &trav->d_stat,
trav->dict);
if (!subvol) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_INVALID_LINKFILE,
"Linkfile does not have link subvolume. "
"path = %s, gfid = %s",
lookup_local->loc.path, gfid);
@@ -6450,11 +6490,10 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
gf_uuid_unparse(local->loc.gfid, gfid);
- gf_msg_debug (this->name, 0,
+ gf_msg_debug (this->name, op_errno,
"opendir on %s for %s failed, "
- "gfid = %s, (%s)",
- prev->this->name, local->loc.path, gfid,
- strerror (op_errno));
+ "gfid = %s,",
+ prev->this->name, local->loc.path, gfid);
if ((op_errno != ENOENT) && (op_errno != ESTALE)) {
local->op_ret = -1;
local->op_errno = op_errno;
@@ -6771,7 +6810,8 @@ dht_notify (xlator_t *this, int event, void *data, ...)
subvol = data;
if (conf->assert_no_child_down) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_CHILD_DOWN,
"Received CHILD_DOWN. Exiting");
if (conf->defrag) {
gf_defrag_stop (conf->defrag,
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c
index 621c613..000494c 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -44,7 +44,8 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev = cookie;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ DHT_MSG_GET_DISK_INFO_ERROR,
"failed to get disk info from %s", prev->this->name);
goto out;
}
@@ -189,7 +190,8 @@ dht_get_du_info (call_frame_t *frame, xlator_t *this, loc_t *loc)
ret = dict_set_int8 (statfs_local->params,
GF_INTERNAL_IGNORE_DEEM_STATFS, 1);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
"Failed to set "
GF_INTERNAL_IGNORE_DEEM_STATFS" in dict");
goto err;
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index f24c62c..6742f29 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -255,7 +255,8 @@ dht_log_lk_array (char *name, gf_loglevel_t log_level, dht_lock_t **lk_array,
for (i = 0; i < count; i++) {
lk_buf = dht_lock_asprintf (lk_array[i]);
- gf_log (name, log_level, "%d. %s", i, lk_buf);
+ gf_msg (name, log_level, 0, DHT_MSG_LK_ARRAY_INFO,
+ "%d. %s", i, lk_buf);
GF_FREE (lk_buf);
}
@@ -966,19 +967,30 @@ dht_migration_complete_check_task (void *data)
ret = syncop_lookup (this, &tmp_loc, &stbuf, 0, 0, 0);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s: failed to lookup the file on %s (%s)",
- tmp_loc.path, this->name, strerror (-ret));
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ DHT_MSG_FILE_LOOKUP_FAILED,
+ "%s: failed to lookup the file on %s",
+ tmp_loc.path, this->name);
local->op_errno = -ret;
ret = -1;
goto out;
}
+ dst_node = dht_subvol_get_cached (this, tmp_loc.inode);
+ if (linkto_target && dst_node != linkto_target) {
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_INVALID_LINKFILE,
+ "linkto target (%s) is "
+ "different from cached-subvol (%s). Treating %s as "
+ "destination subvol", linkto_target->name,
+ dst_node->name, dst_node->name);
+ }
+
if (gf_uuid_compare (stbuf.ia_gfid, tmp_loc.inode->gfid)) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- DHT_MSG_GFID_MISMATCH,
- "%s: gfid different on the target file on %s",
- tmp_loc.path, dst_node->name);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_GFID_MISMATCH,
+ "%s: gfid different on the target file on %s",
+ tmp_loc.path, dst_node->name);
ret = -1;
local->op_errno = EIO;
goto out;
@@ -1035,7 +1047,8 @@ dht_migration_complete_check_task (void *data)
~(O_CREAT | O_EXCL | O_TRUNC)), iter_fd,
NULL, NULL);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "failed to open "
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ DHT_MSG_OPEN_FD_ON_DST_FAILED, "failed to open "
"the fd (%p, flags=0%o) on file %s @ %s",
iter_fd, iter_fd->flags, path, dst_node->name);
open_failed = 1;
@@ -1143,16 +1156,18 @@ dht_rebalance_inprogress_task (void *data)
}
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s: failed to get the 'linkto' xattr %s",
- local->loc.path, strerror (-ret));
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ DHT_MSG_GET_XATTR_FAILED,
+ "%s: failed to get the 'linkto' xattr",
+ local->loc.path);
ret = -1;
goto out;
}
dst_node = dht_linkfile_subvol (this, NULL, NULL, dict);
if (!dst_node) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_SUBVOL_NOT_FOUND,
"%s: failed to get the 'linkto' xattr from dict",
local->loc.path);
ret = -1;
@@ -1166,7 +1181,8 @@ dht_rebalance_inprogress_task (void *data)
ret = syncop_lookup (dst_node, &local->loc, &stbuf, NULL,
NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ DHT_MSG_FILE_LOOKUP_ON_DST_FAILED,
"%s: failed to lookup the file on %s",
local->loc.path, dst_node->name);
ret = -1;
@@ -1210,7 +1226,9 @@ dht_rebalance_inprogress_task (void *data)
~(O_CREAT | O_EXCL | O_TRUNC)), iter_fd,
NULL, NULL);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "failed to send open "
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ DHT_MSG_OPEN_FD_ON_DST_FAILED,
+ "failed to send open "
"the fd (%p, flags=0%o) on file %s @ %s",
iter_fd, iter_fd->flags, path, dst_node->name);
ret = -1;
@@ -1229,7 +1247,8 @@ dht_rebalance_inprogress_task (void *data)
done:
ret = dht_inode_ctx_set_mig_info (this, inode, src_node, dst_node);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_SET_INODE_CTX_FAILED,
"%s: failed to set inode-ctx target file at %s",
local->loc.path, dst_node->name);
goto out;
@@ -1485,10 +1504,11 @@ dht_unlock_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uuid_utoa_r (local->lock.locks[lk_index]->loc.gfid,
gfid);
- gf_log (this->name, GF_LOG_WARNING,
- "unlocking failed on %s:%s (%s)",
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ DHT_MSG_UNLOCKING_FAILED,
+ "unlocking failed on %s:%s",
local->lock.locks[lk_index]->xl->name,
- gfid, strerror (op_errno));
+ gfid);
} else {
local->lock.locks[lk_index]->locked = 0;
}
@@ -1538,7 +1558,8 @@ dht_unlock_inodelk (call_frame_t *frame, dht_lock_t **lk_array, int lk_count,
lock_frame = dht_lock_frame (frame);
if (lock_frame == NULL) {
- gf_log (frame->this->name, GF_LOG_WARNING,
+ gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_UNLOCKING_FAILED,
"cannot allocate a frame, not unlocking following "
"locks:");
@@ -1549,7 +1570,8 @@ dht_unlock_inodelk (call_frame_t *frame, dht_lock_t **lk_array, int lk_count,
ret = dht_local_lock_init (lock_frame, lk_array, lk_count, inodelk_cbk);
if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_WARNING,
+ gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_UNLOCKING_FAILED,
"storing locks in local failed, not unlocking "
"following locks:");
@@ -1613,11 +1635,10 @@ dht_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uuid_utoa_r (local->lock.locks[lk_index]->loc.inode->gfid,
gfid);
- gf_log (this->name, GF_LOG_DEBUG,
- "inodelk failed on gfid: %s "
- "subvolume: %s (%s)", gfid,
- local->lock.locks[lk_index]->xl->name,
- strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "inodelk failed on gfid: %s "
+ "subvolume: %s", gfid,
+ local->lock.locks[lk_index]->xl->name);
}
goto out;
diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c
index 5dd055a..257a2ea 100644
--- a/xlators/cluster/dht/src/dht-inode-read.c
+++ b/xlators/cluster/dht/src/dht-inode-read.c
@@ -36,9 +36,9 @@ dht_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->op_errno = op_errno;
if ((op_ret == -1) && !dht_inode_missing(op_errno)) {
- gf_msg_debug (this->name, 0,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto out;
}
@@ -145,9 +145,9 @@ dht_file_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if ((op_ret == -1) && !dht_inode_missing(op_errno)) {
local->op_errno = op_errno;
- gf_msg_debug (this->name, 0,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto out;
}
@@ -231,9 +231,9 @@ dht_attr_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,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto unlock;
}
@@ -725,9 +725,9 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
local->op_errno = op_errno;
if (op_ret == -1 && !dht_inode_missing(op_errno)) {
- gf_msg_debug (this->name, 0,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto out;
}
diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c
index 1846ece..b48fd79 100644
--- a/xlators/cluster/dht/src/dht-inode-write.c
+++ b/xlators/cluster/dht/src/dht-inode-write.c
@@ -203,9 +203,9 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if ((op_ret == -1) && !dht_inode_missing(op_errno)) {
local->op_errno = op_errno;
local->op_ret = -1;
- gf_msg_debug (this->name, 0,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto out;
}
@@ -397,9 +397,9 @@ dht_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if ((op_ret == -1) && !dht_inode_missing(op_errno)) {
local->op_errno = op_errno;
local->op_ret = -1;
- gf_msg_debug (this->name, 0,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto out;
}
@@ -541,9 +541,9 @@ dht_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if ((op_ret == -1) && !dht_inode_missing(op_errno)) {
local->op_errno = op_errno;
local->op_ret = -1;
- gf_msg_debug (this->name, 0,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto out;
}
@@ -681,9 +681,9 @@ dht_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if ((op_ret == -1) && !dht_inode_missing(op_errno)) {
local->op_errno = op_errno;
local->op_ret = -1;
- gf_msg_debug (this->name, 0,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto out;
}
@@ -817,9 +817,9 @@ dht_file_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->op_errno = op_errno;
if ((op_ret == -1) && !dht_inode_missing(op_errno)) {
- gf_msg_debug (this->name, 0,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto out;
}
@@ -903,9 +903,9 @@ dht_setattr_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,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, op_errno,
+ "subvolume %s returned -1",
+ prev->this->name);
goto unlock;
}
diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c
index f88c786..1163068 100644
--- a/xlators/cluster/dht/src/dht-layout.c
+++ b/xlators/cluster/dht/src/dht-layout.c
@@ -170,7 +170,8 @@ dht_layout_search (xlator_t *this, dht_layout_t *layout, const char *name)
ret = dht_hash_compute (this, layout->type, name, &hash);
if (ret != 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_COMPUTE_HASH_FAILED,
"hash computation failed for type=%d name=%s",
layout->type, name);
goto out;
@@ -185,7 +186,8 @@ dht_layout_search (xlator_t *this, dht_layout_t *layout, const char *name)
}
if (!subvol) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_HASHED_SUBVOL_GET_FAILED,
"no subvolume for hash (value) = %u", hash);
}
@@ -668,7 +670,8 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)
ret = dht_layout_sort (layout);
if (ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_LAYOUT_SORT_FAILED,
"sort failed?! how the ....");
goto out;
}
@@ -679,7 +682,8 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)
&holes, &overlaps,
&missing, &down, &misc, NULL);
if (ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_FIND_LAYOUT_ANOMALIES_ERROR,
"Error finding anomalies in %s, gfid = %s",
loc->path, gfid);
goto out;
@@ -691,7 +695,8 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)
"Directory %s looked up first time"
" gfid = %s", loc->path, gfid);
} else {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_ANOMALIES_INFO,
"Found anomalies in %s (gfid = %s). "
"Holes=%d overlaps=%d",
loc->path, gfid, holes, overlaps );
@@ -760,9 +765,17 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
if (!xattr) {
if (err == 0) {
- gf_log (this->name, GF_LOG_INFO,
- "%s: xattr dictionary is NULL",
- loc->path);
+ if (loc) {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_DICT_GET_FAILED,
+ "%s: xattr dictionary is NULL",
+ loc->path);
+ } else {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_DICT_GET_FAILED,
+ "path not found: "
+ "xattr dictionary is NULL");
+ }
ret = -1;
}
goto out;
@@ -773,9 +786,18 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
if (dict_ret < 0) {
if (err == 0 && layout->list[pos].stop) {
- gf_log (this->name, GF_LOG_INFO,
- "%s: Disk layout missing, gfid = %s",
- loc->path, gfid);
+ if (loc) {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_DISK_LAYOUT_MISSING,
+ "%s: Disk layout missing, gfid = %s",
+ loc->path, gfid);
+ } else {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_DISK_LAYOUT_MISSING,
+ "path not found: "
+ "Disk layout missing, gfid = %s",
+ gfid);
+ }
ret = -1;
}
goto out;
@@ -790,7 +812,8 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
if ((layout->list[pos].start != start_off)
|| (layout->list[pos].stop != stop_off)
|| (layout->list[pos].commit_hash != commit_hash)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LAYOUT_INFO,
"subvol: %s; inode layout - %"PRIu32" - %"PRIu32
" - %"PRIu32"; "
"disk layout - %"PRIu32" - %"PRIu32" - %"PRIu32,
@@ -820,7 +843,8 @@ dht_layout_preset (xlator_t *this, xlator_t *subvol, inode_t *inode)
layout = dht_layout_for_subvol (this, subvol);
if (!layout) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_NO_LAYOUT_INFO,
"no pre-set layout for subvolume %s",
subvol ? subvol->name : "<nil>");
ret = -1;
diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
index 923dde0..a247170 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -44,7 +44,8 @@ dht_linkfile_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
is_linkfile = check_is_linkfile (inode, stbuf, xattr,
conf->link_xattr_name);
if (!is_linkfile)
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_NOT_LINK_FILE_ERROR,
"got non-linkfile %s:%s, gfid = %s",
prev->this->name, local->loc.path, gfid);
out:
diff --git a/xlators/cluster/dht/src/dht-messages.h b/xlators/cluster/dht/src/dht-messages.h
index eb4c356..e0f0510 100644
--- a/xlators/cluster/dht/src/dht-messages.h
+++ b/xlators/cluster/dht/src/dht-messages.h
@@ -1,4 +1,4 @@
-/*Copyright (c) 2013 Red Hat, Inc. <http://www.redhat.com>
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
This file is licensed to you under your choice of the GNU Lesser
@@ -45,7 +45,7 @@
*/
#define GLFS_DHT_BASE GLFS_MSGID_COMP_DHT
-#define GLFS_DHT_NUM_MESSAGES 36
+#define GLFS_DHT_NUM_MESSAGES 104
#define GLFS_MSGID_END (GLFS_DHT_BASE + GLFS_DHT_NUM_MESSAGES + 1)
/* Messages with message IDs */
@@ -71,7 +71,7 @@
*
*/
-#define DHT_MSG_CREATE_LINK_FAILED (GLFS_DHT_BASE + 2)
+#define DHT_MSG_CREATE_LINK_FAILED (GLFS_DHT_BASE + 2)
/*!
* @messageid 109003
@@ -82,7 +82,7 @@
*
*/
-#define DHT_MSG_DICT_SET_FAILED (GLFS_DHT_BASE + 3)
+#define DHT_MSG_DICT_SET_FAILED (GLFS_DHT_BASE + 3)
/*!
* @messageid 109004
@@ -91,7 +91,7 @@
*
*/
-#define DHT_MSG_DIR_ATTR_HEAL_FAILED (GLFS_DHT_BASE + 4)
+#define DHT_MSG_DIR_ATTR_HEAL_FAILED (GLFS_DHT_BASE + 4)
/*!
* @messageid 109005
@@ -102,7 +102,7 @@
*
*/
-#define DHT_MSG_DIR_SELFHEAL_FAILED (GLFS_DHT_BASE + 5)
+#define DHT_MSG_DIR_SELFHEAL_FAILED (GLFS_DHT_BASE + 5)
/*!
* @messageid 109006
@@ -113,7 +113,7 @@
*
*/
-#define DHT_MSG_DIR_SELFHEAL_XATTR_FAILED (GLFS_DHT_BASE + 6)
+#define DHT_MSG_DIR_SELFHEAL_XATTR_FAILED (GLFS_DHT_BASE + 6)
/*!
* @messageid 109007
@@ -126,7 +126,7 @@
*
*/
-#define DHT_MSG_FILE_ON_MULT_SUBVOL (GLFS_DHT_BASE + 7)
+#define DHT_MSG_FILE_ON_MULT_SUBVOL (GLFS_DHT_BASE + 7)
/*!
* @messageid 109008
@@ -144,7 +144,7 @@
*
*/
-#define DHT_MSG_FILE_TYPE_MISMATCH (GLFS_DHT_BASE + 8)
+#define DHT_MSG_FILE_TYPE_MISMATCH (GLFS_DHT_BASE + 8)
/*!
* @messageid 109009
@@ -153,7 +153,7 @@
*
*/
-#define DHT_MSG_GFID_MISMATCH (GLFS_DHT_BASE + 9)
+#define DHT_MSG_GFID_MISMATCH (GLFS_DHT_BASE + 9)
/*!
* @messageid 109010
@@ -162,17 +162,15 @@
*
*/
-#define DHT_MSG_GFID_NULL (GLFS_DHT_BASE + 10)
+#define DHT_MSG_GFID_NULL (GLFS_DHT_BASE + 10)
-/*!
+/*
* @messageid 109011
- * @diagnosis The hashed subvolume could not be found for the specified
- * file/directory
- * @recommendedaction None
- *
+ * @diagnosis
+ * @recommendedaction None
*/
-#define DHT_MSG_HASHED_SUBVOL_GET_FAILED (GLFS_DHT_BASE + 11)
+#define DHT_MSG_HASHED_SUBVOL_GET_FAILED (GLFS_DHT_BASE + 11)
/*!
* @messageid 109012
@@ -182,7 +180,7 @@
*
*/
-#define DHT_MSG_INIT_FAILED (GLFS_DHT_BASE + 12)
+#define DHT_MSG_INIT_FAILED (GLFS_DHT_BASE + 12)
/*!
* @messageid 109013
@@ -191,7 +189,7 @@
*
*/
-#define DHT_MSG_INVALID_CONFIGURATION (GLFS_DHT_BASE + 13)
+#define DHT_MSG_INVALID_CONFIGURATION (GLFS_DHT_BASE + 13)
/*!
* @messageid 109014
@@ -200,7 +198,7 @@
*
*/
-#define DHT_MSG_INVALID_DISK_LAYOUT (GLFS_DHT_BASE + 14)
+#define DHT_MSG_INVALID_DISK_LAYOUT (GLFS_DHT_BASE + 14)
/*!
* @messageid 109015
@@ -213,7 +211,7 @@
*
*/
-#define DHT_MSG_INVALID_OPTION (GLFS_DHT_BASE + 15)
+#define DHT_MSG_INVALID_OPTION (GLFS_DHT_BASE + 15)
/*!
* @messageid 109016
@@ -231,7 +229,7 @@
*
*/
-#define DHT_MSG_LAYOUT_MERGE_FAILED (GLFS_DHT_BASE + 17)
+#define DHT_MSG_LAYOUT_MERGE_FAILED (GLFS_DHT_BASE + 17)
/*!
* @messageid 109018
@@ -241,7 +239,7 @@
*
*/
-#define DHT_MSG_LAYOUT_MISMATCH (GLFS_DHT_BASE + 18)
+#define DHT_MSG_LAYOUT_MISMATCH (GLFS_DHT_BASE + 18)
/*!
* @messageid 109019
@@ -250,7 +248,7 @@
*
*/
-#define DHT_MSG_LAYOUT_NULL (GLFS_DHT_BASE + 19)
+#define DHT_MSG_LAYOUT_NULL (GLFS_DHT_BASE + 19)
/*!
* @messageid 109020
@@ -260,7 +258,7 @@
*
*/
-#define DHT_MSG_MIGRATE_DATA_COMPLETE (GLFS_DHT_BASE + 20)
+#define DHT_MSG_MIGRATE_DATA_COMPLETE (GLFS_DHT_BASE + 20)
/*!
* @messageid 109021
@@ -284,7 +282,7 @@
*
*/
-#define DHT_MSG_MIGRATE_FILE_COMPLETE (GLFS_DHT_BASE + 22)
+#define DHT_MSG_MIGRATE_FILE_COMPLETE (GLFS_DHT_BASE + 22)
/*!
* @messageid 109023
@@ -309,7 +307,7 @@
*
*/
-#define DHT_MSG_NO_MEMORY (GLFS_DHT_BASE + 24)
+#define DHT_MSG_NO_MEMORY (GLFS_DHT_BASE + 24)
/*!
* @messageid 109025
@@ -325,7 +323,7 @@
*
*/
-#define DHT_MSG_OPENDIR_FAILED (GLFS_DHT_BASE + 25)
+#define DHT_MSG_OPENDIR_FAILED (GLFS_DHT_BASE + 25)
/*!
* @messageid 109026
@@ -337,7 +335,7 @@
*
*/
-#define DHT_MSG_REBALANCE_FAILED (GLFS_DHT_BASE + 26)
+#define DHT_MSG_REBALANCE_FAILED (GLFS_DHT_BASE + 26)
/*!
* @messageid 109027
@@ -346,7 +344,7 @@
*
*/
-#define DHT_MSG_REBALANCE_START_FAILED (GLFS_DHT_BASE + 27)
+#define DHT_MSG_REBALANCE_START_FAILED (GLFS_DHT_BASE + 27)
/*!
* @messageid 109028
@@ -357,7 +355,7 @@
*
*/
-#define DHT_MSG_REBALANCE_STATUS (GLFS_DHT_BASE + 28)
+#define DHT_MSG_REBALANCE_STATUS (GLFS_DHT_BASE + 28)
/*!
* @messageid 109029
@@ -366,7 +364,7 @@
*
*/
-#define DHT_MSG_REBALANCE_STOPPED (GLFS_DHT_BASE + 29)
+#define DHT_MSG_REBALANCE_STOPPED (GLFS_DHT_BASE + 29)
/*!
* @messageid 109030
@@ -377,7 +375,7 @@
*
*/
-#define DHT_MSG_RENAME_FAILED (GLFS_DHT_BASE + 30)
+#define DHT_MSG_RENAME_FAILED (GLFS_DHT_BASE + 30)
/*!
* @messageid 109031
@@ -387,7 +385,7 @@
*
*/
-#define DHT_MSG_SETATTR_FAILED (GLFS_DHT_BASE + 31)
+#define DHT_MSG_SETATTR_FAILED (GLFS_DHT_BASE + 31)
/*!
* @messageid 109032
@@ -419,7 +417,7 @@
the specific error that is encountered.
*/
-#define DHT_MSG_UNLINK_FAILED (GLFS_DHT_BASE + 34)
+#define DHT_MSG_UNLINK_FAILED (GLFS_DHT_BASE + 34)
@@ -430,7 +428,7 @@
*
*/
-#define DHT_MSG_LAYOUT_SET_FAILED (GLFS_DHT_BASE + 35)
+#define DHT_MSG_LAYOUT_SET_FAILED (GLFS_DHT_BASE + 35)
/*!
* @messageid 109036
@@ -439,7 +437,7 @@
* @recommendedaction None
*/
-#define DHT_MSG_LOG_FIXED_LAYOUT (GLFS_DHT_BASE + 36)
+#define DHT_MSG_LOG_FIXED_LAYOUT (GLFS_DHT_BASE + 36)
/*
* @messageid 109037
@@ -447,7 +445,7 @@
* @recommendedaction None
*/
-#define DHT_MSG_LOG_TIER_ERROR (GLFS_DHT_BASE + 37)
+#define DHT_MSG_LOG_TIER_ERROR (GLFS_DHT_BASE + 37)
/*
* @messageid 109038
@@ -455,11 +453,535 @@
* @recommendedaction None
*/
-#define DHT_MSG_LOG_TIER_STATUS (GLFS_DHT_BASE + 38)
+#define DHT_MSG_LOG_TIER_STATUS (GLFS_DHT_BASE + 38)
+/*
+ * @messageid 109039
+ * @diagnosis
+ * @recommendedaction None
+ */
-/*------------*/
-#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+#define DHT_MSG_GET_XATTR_FAILED (GLFS_DHT_BASE + 39)
+
+/*
+ * @messageid 109040
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_FILE_LOOKUP_FAILED (GLFS_DHT_BASE + 40)
+
+/*
+ * @messageid 109041
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_OPEN_FD_FAILED (GLFS_DHT_BASE + 41)
+
+/*
+ * @messageid 109042
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SET_INODE_CTX_FAILED (GLFS_DHT_BASE + 42)
+
+/*
+ * @messageid 109043
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_UNLOCKING_FAILED (GLFS_DHT_BASE + 43)
+
+/*
+ * @messageid 109044
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_DISK_LAYOUT_NULL (GLFS_DHT_BASE + 44)
+
+/*
+ * @messageid 109045
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SUBVOL_INFO (GLFS_DHT_BASE + 45)
+
+/*
+ * @messageid 109046
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_CHUNK_SIZE_INFO (GLFS_DHT_BASE + 46)
+
+/*
+ * @messageid 109047
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_LAYOUT_FORM_FAILED (GLFS_DHT_BASE + 47)
+
+/*
+ * @messageid 109048
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SUBVOL_ERROR (GLFS_DHT_BASE + 48)
+
+/*
+ * @messageid 109049
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_LAYOUT_SORT_FAILED (GLFS_DHT_BASE + 49)
+
+/*
+ * @messageid 109050
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_REGEX_INFO (GLFS_DHT_BASE + 50)
+
+/*
+ * @messageid 109051
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_FOPEN_FAILED (GLFS_DHT_BASE + 51)
+
+/*
+ * @messageid 109052
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SET_HOSTNAME_FAILED (GLFS_DHT_BASE + 52)
+
+/*
+ * @messageid 109053
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_BRICK_ERROR (GLFS_DHT_BASE + 53)
+
+/*
+ * @messageid 109054
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SYNCOP_FAILED (GLFS_DHT_BASE + 54)
+
+/*
+ * @messageid 109055
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_MIGRATE_INFO (GLFS_DHT_BASE + 55)
+
+/*
+ * @messageid 109056
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SOCKET_ERROR (GLFS_DHT_BASE + 56)
+
+/*
+ * @messageid 109057
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_CREATE_FD_FAILED (GLFS_DHT_BASE + 57)
+
+/*
+ * @messageid 109058
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_READDIR_ERROR (GLFS_DHT_BASE + 58)
+
+/*
+ * @messageid 109059
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_CHILD_LOC_BUILD_FAILED (GLFS_DHT_BASE + 59)
+
+/*
+ * @messageid 109060
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SET_SWITCH_PATTERN_ERROR (GLFS_DHT_BASE + 60)
+
+/*
+ * @messageid 109061
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_COMPUTE_HASH_FAILED (GLFS_DHT_BASE + 61)
+
+/*
+ * @messageid 109062
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_FIND_LAYOUT_ANOMALIES_ERROR (GLFS_DHT_BASE + 62)
+
+/*
+ * @messageid 109063
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_ANOMALIES_INFO (GLFS_DHT_BASE + 63)
+
+/*
+ * @messageid 109064
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_LAYOUT_INFO (GLFS_DHT_BASE + 64)
+
+/*
+ * @messageid 109065
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_INODE_LK_ERROR (GLFS_DHT_BASE + 65)
+
+/*
+ * @messageid 109066
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_RENAME_INFO (GLFS_DHT_BASE + 66)
+
+/*
+ * @messageid 109067
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_DATA_NULL (GLFS_DHT_BASE + 67)
+
+/*
+ * @messageid 109068
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_AGGREGATE_QUOTA_XATTR_FAILED (GLFS_DHT_BASE + 68)
+
+/*
+ * @messageid 109069
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_UNLINK_LOOKUP_INFO (GLFS_DHT_BASE + 69)
+
+/*
+ * @messageid 109070
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_LINK_FILE_LOOKUP_INFO (GLFS_DHT_BASE + 70)
+
+/*
+ * @messageid 109071
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_OPERATION_NOT_SUP (GLFS_DHT_BASE + 71)
+
+/*
+ * @messageid 109072
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_NOT_LINK_FILE_ERROR (GLFS_DHT_BASE + 72)
+
+/*
+ * @messageid 109073
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_CHILD_DOWN (GLFS_DHT_BASE + 73)
+
+/*
+ * @messageid 109074
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_UUID_PARSE_ERROR (GLFS_DHT_BASE + 74)
+
+/*
+ * @messageid 109075
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_GET_DISK_INFO_ERROR (GLFS_DHT_BASE + 75)
+
+/*
+ * @messageid 109076
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_INVALID_VALUE (GLFS_DHT_BASE + 76)
+
+/*
+ * @messageid 109077
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SWITCH_PATTERN_INFO (GLFS_DHT_BASE + 77)
+
+/*
+ * @messageid 109078
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SUBVOL_OP_FAILED (GLFS_DHT_BASE + 78)
+
+/*
+ * @messageid 109079
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_LAYOUT_PRESET_FAILED (GLFS_DHT_BASE + 79)
+/*
+ * @messageid 109080
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_INVALID_LINKFILE (GLFS_DHT_BASE + 80)
+
+/*
+ * @messageid 109081
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_FIX_LAYOUT_INFO (GLFS_DHT_BASE + 81)
+
+/*
+ * @messageid 109082
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_GET_HOSTNAME_FAILED (GLFS_DHT_BASE + 82)
+
+/*
+ * @messageid 109083
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_WRITE_FAILED (GLFS_DHT_BASE + 83)
+
+/*
+ * @messageid 109084
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_MIGRATE_HARDLINK_FILE_FAILED (GLFS_DHT_BASE + 84)
+/*
+ * @messageid 109085
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_FSYNC_FAILED (GLFS_DHT_BASE + 85)
+
+/*
+ * @messageid 109086
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SUBVOL_DECOMMISSION_INFO (GLFS_DHT_BASE + 86)
+
+/*
+ * @messageid 109087
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_BRICK_QUERY_FAILED (GLFS_DHT_BASE + 87)
+
+/*
+ * @messageid 109088
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SUBVOL_NO_LAYOUT_INFO (GLFS_DHT_BASE + 88)
+
+/*
+ * @messageid 109089
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_OPEN_FD_ON_DST_FAILED (GLFS_DHT_BASE + 89)
+
+/*
+ * @messageid 109090
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SUBVOL_NOT_FOUND (GLFS_DHT_BASE + 90)
+
+/*
+ * @messageid 109190
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_FILE_LOOKUP_ON_DST_FAILED (GLFS_DHT_BASE + 91)
+
+/*
+ * @messageid 109092
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_DISK_LAYOUT_MISSING (GLFS_DHT_BASE + 92)
+
+/*
+ * @messageid 109093
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_DICT_GET_FAILED (GLFS_DHT_BASE + 93)
+
+/*
+ * @messageid 109094
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_REVALIDATE_CBK_INFO (GLFS_DHT_BASE + 94)
+
+/*
+ * @messageid 109095
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_UPGRADE_BRICKS (GLFS_DHT_BASE + 95)
+
+/*
+ * @messageid 109096
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_LK_ARRAY_INFO (GLFS_DHT_BASE + 96)
+
+/*
+ * @messageid 109097
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_RENAME_NOT_LOCAL (GLFS_DHT_BASE + 97)
+
+/*
+ * @messageid 109098
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_RECONFIGURE_INFO (GLFS_DHT_BASE + 98)
+
+/*
+ * @messageid 109099
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_INIT_LOCAL_SUBVOL_FAILED (GLFS_DHT_BASE + 99)
+
+/*
+ * @messageid 109100
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SYS_CALL_GET_TIME_FAILED (GLFS_DHT_BASE + 100)
+
+/*
+ * @messageid 109101
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_NO_DISK_USAGE_STATUS (GLFS_DHT_BASE + 101)
+
+/*
+ * @messageid 109102
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_SUBVOL_DOWN_ERROR (GLFS_DHT_BASE + 102)
+
+/*
+ * @messageid 109103
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_REBAL_THROTTLE_INFO (GLFS_DHT_BASE + 103)
+
+/*
+ * @messageid 109104
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_COMMIT_HASH_INFO (GLFS_DHT_BASE + 104)
+
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
#endif /* _DHT_MESSAGES_H_ */
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 38db3a1..012d86b 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -313,7 +313,9 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs,
} else {
linkto_subvol = dht_linkfile_subvol (this, NULL, NULL, xattrs);
if (!linkto_subvol) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_SUBVOL_ERROR,
+ "Failed to get "
"linkto subvol for %s", loc->name);
} else {
hashed_subvol = linkto_subvol;
@@ -326,10 +328,12 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs,
loglevel = (op_errno == EEXIST) ? GF_LOG_DEBUG : \
GF_LOG_ERROR;
- gf_log (this->name, loglevel, "link of %s -> %s"
- " failed on subvol %s (%s)", loc->name,
+ gf_msg (this->name, loglevel, op_errno,
+ DHT_MSG_MIGRATE_HARDLINK_FILE_FAILED,
+ "link of %s -> %s"
+ " failed on subvol %s", loc->name,
uuid_utoa(loc->gfid),
- hashed_subvol->name, strerror (op_errno));
+ hashed_subvol->name);
if (op_errno != EEXIST)
goto out;
}
@@ -585,7 +589,8 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc,
xdata = dict_new ();
if (!xdata) {
errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ DHT_MSG_NO_MEMORY,
"failed to allocate dictionary");
goto out;
}
@@ -1407,9 +1412,10 @@ gf_listener_stop (xlator_t *this)
}
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to unlink listener "
- "socket %s, error: %s", cmd_args->sock_file,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ DHT_MSG_SOCKET_ERROR,
+ "Failed to unlink listener "
+ "socket %s", cmd_args->sock_file);
}
return ret;
}
@@ -1762,8 +1768,8 @@ gf_defrag_task (void *opaque)
iterator = list_entry (q_head->next,
typeof(*iterator), list);
- gf_log ("DHT", GF_LOG_DEBUG, "picking entry "
- "%s", iterator->df_entry->d_name);
+ gf_msg_debug ("DHT", 0, "picking entry "
+ "%s", iterator->df_entry->d_name);
list_del_init (&(iterator->list));
@@ -1965,9 +1971,9 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container,
migration. Only the actual data file need to
be checked for migration criteria.
*/
- gf_log (this->name, GF_LOG_DEBUG, "Skipping linkfile"
- " %s on subvol: %s", entry_loc.path,
- conf->local_subvols[i]->name);
+ gf_msg_debug (this->name, 0, "Skipping linkfile"
+ " %s on subvol: %s", entry_loc.path,
+ conf->local_subvols[i]->name);
continue;
}
@@ -2301,10 +2307,10 @@ gf_defrag_process_dir (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
defrag->q_entry_count++;
ldfq_count = defrag->q_entry_count;
- gf_log (this->name, GF_LOG_DEBUG, "added "
- "file:%s parent:%s to the queue ",
- container->df_entry->d_name,
- container->parent_loc->path);
+ gf_msg_debug (this->name, 0, "added "
+ "file:%s parent:%s to the queue ",
+ container->df_entry->d_name,
+ container->parent_loc->path);
pthread_cond_signal (
&defrag->parallel_migration_cond);
@@ -2738,8 +2744,8 @@ gf_defrag_start_crawl (void *data)
thread_spawn_count = MAX ((sysconf(_SC_NPROCESSORS_ONLN) - 4), 4);
- gf_log (this->name, GF_LOG_DEBUG, "thread_spawn_count: %d",
- thread_spawn_count);
+ gf_msg_debug (this->name, 0, "thread_spawn_count: %d",
+ thread_spawn_count);
defrag->current_thread_count = thread_spawn_count;
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index 097ae9a..320f875 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -450,7 +450,8 @@ dht_rename_unlock (call_frame_t *frame, xlator_t *this)
if (local->loc2.inode)
uuid_utoa_r (local->loc2.inode->gfid, dst_gfid);
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_UNLOCKING_FAILED,
"winding unlock inodelk failed "
"rename (%s:%s:%s %s:%s:%s), "
"stale locks left on bricks",
@@ -493,7 +494,8 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev = cookie;
if (!local) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_VALUE,
"!local, should not happen");
goto out;
}
@@ -638,9 +640,10 @@ dht_rename_links_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local = frame->local;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
- "link/file %s on %s failed (%s)",
- local->loc.path, prev->this->name, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ DHT_MSG_CREATE_LINK_FAILED,
+ "link/file %s on %s failed",
+ local->loc.path, prev->this->name);
}
if (local->linked == _gf_true) {
@@ -1218,10 +1221,10 @@ dht_rename_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->loc2.inode)
uuid_utoa_r (local->loc2.inode->gfid, dst_gfid);
- gf_log (this->name, GF_LOG_WARNING,
- "acquiring inodelk failed (%s) "
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ DHT_MSG_INODE_LK_ERROR,
+ "acquiring inodelk failed "
"rename (%s:%s:%s %s:%s:%s), returning EBUSY",
- strerror (op_errno),
local->loc.path, src_gfid, local->src_cached->name,
local->loc2.path, dst_gfid,
local->dst_cached ? local->dst_cached->name : NULL);
@@ -1399,7 +1402,8 @@ dht_rename (call_frame_t *frame, xlator_t *this,
local->dst_hashed = dst_hashed;
local->dst_cached = dst_cached;
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_RENAME_INFO,
"renaming %s (hash=%s/cache=%s) => %s (hash=%s/cache=%s)",
oldloc->path, src_hashed->name, src_cached->name,
newloc->path, dst_hashed->name,
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index c881a36..cfe7e5a 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;
}
diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c
index 456d831..ce0fd00 100644
--- a/xlators/cluster/dht/src/dht-shared.c
+++ b/xlators/cluster/dht/src/dht-shared.c
@@ -264,8 +264,9 @@ mem_acct_init (xlator_t *this)
ret = xlator_mem_acct_init (this, gf_dht_mt_end + 1);
if (ret != 0) {
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
- "failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_NO_MEMORY,
+ "Memory accounting init failed");
return ret;
}
out:
@@ -294,7 +295,8 @@ dht_parse_decommissioned_bricks (xlator_t *this, dht_conf_t *conf,
conf->decommissioned_bricks[i] =
conf->subvolumes[i];
conf->decommission_subvols_cnt++;
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_DECOMMISSION_INFO,
"decommissioning subvolume %s",
conf->subvolumes[i]->name);
break;
@@ -359,12 +361,13 @@ dht_init_regex (xlator_t *this, dict_t *odict, char *name,
}
if (regcomp(re,temp_str,REG_EXTENDED) == 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "using regex %s = %s", name, temp_str);
+ gf_msg_debug (this->name, 0,
+ "using regex %s = %s", name, temp_str);
*re_valid = _gf_true;
}
else {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_REGEX_INFO,
"compiling regex %s failed", temp_str);
}
}
@@ -458,7 +461,9 @@ dht_reconfigure (xlator_t *this, dict_t *options)
if (conf->defrag) {
GF_DECIDE_DEFRAG_THROTTLE_COUNT (throttle_count, conf);
- gf_log ("DHT", GF_LOG_INFO, "conf->dthrottle: %s, "
+ gf_msg ("DHT", GF_LOG_INFO, 0,
+ DHT_MSG_REBAL_THROTTLE_INFO,
+ "conf->dthrottle: %s, "
"conf->defrag->recon_thread_count: %d",
conf->dthrottle, conf->defrag->recon_thread_count);
}
@@ -597,7 +602,8 @@ dht_init (xlator_t *this)
/* We get the commit-hash to set only for rebalance process */
if (dict_get_uint32 (this->options,
"commit-hash", &commit_hash) == 0) {
- gf_log (this->name, GF_LOG_INFO, "%s using commit hash %u",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_COMMIT_HASH_INFO, "%s using commit hash %u",
__func__, commit_hash);
conf->vol_commit_hash = commit_hash;
conf->vch_forced = _gf_true;
@@ -722,7 +728,8 @@ dht_init (xlator_t *this)
if (cmd) {
ret = dht_init_local_subvolumes (this, conf);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INIT_LOCAL_SUBVOL_FAILED,
"dht_init_local_subvolumes failed");
goto err;
}
@@ -751,8 +758,8 @@ dht_init (xlator_t *this)
this->local_pool = mem_pool_new (dht_local_t, 512);
if (!this->local_pool) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- DHT_MSG_INIT_FAILED,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ DHT_MSG_NO_MEMORY,
" DHT initialisation failed. "
"failed to create local_t's memory pool");
goto err;
@@ -767,9 +774,10 @@ dht_init (xlator_t *this)
GF_DECIDE_DEFRAG_THROTTLE_COUNT(throttle_count, conf);
- gf_log ("DHT", GF_LOG_DEBUG, "conf->dthrottle: %s, "
- "conf->defrag->recon_thread_count: %d",
- conf->dthrottle, conf->defrag->recon_thread_count);
+ gf_msg_debug ("DHT", 0, "conf->dthrottle: %s, "
+ "conf->defrag->recon_thread_count: %d",
+ conf->dthrottle,
+ conf->defrag->recon_thread_count);
}
GF_OPTION_INIT ("xattr-name", conf->xattr_name, str, err);
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index 72d6d9c..a7d259b 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -206,7 +206,8 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
ret = dict_set_uint32 (local->xattr_req,
conf->xattr_name, 4 * 4);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
"Failed to set dict value.");
op_errno = -1;
goto err;
@@ -227,7 +228,8 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
ret = dict_set_uint32 (local->xattr_req,
conf->xattr_name, 4 * 4);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
"Failed to set dict value.");
op_errno = -1;
goto err;
@@ -236,7 +238,8 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
ret = dict_set_uint32 (local->xattr_req,
conf->link_xattr_name, 256);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
"Failed to set dict value.");
op_errno = -1;
goto err;
@@ -508,7 +511,9 @@ nufa_find_local_brick (xlator_t *xl, void *data)
if (strcmp (xl->name, local_volname) == 0) {
conf->private = xl;
- gf_log (this->name, GF_LOG_INFO, "Using specified subvol %s",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO,
+ "Using specified subvol %s",
local_volname);
return;
}
@@ -521,7 +526,8 @@ nufa_find_local_brick (xlator_t *xl, void *data)
(gf_is_same_address (local_volname, brick_host) ||
gf_is_local_addr (brick_host))) {
conf->private = xl;
- gf_log (this->name, GF_LOG_INFO, "Using the first local "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO, "Using the first local "
"subvol %s", xl->name);
return;
}
@@ -551,7 +557,8 @@ nufa_find_local_subvol (xlator_t *this,
xlator_foreach_depth_first (this, fn, data);
if (!conf->private) {
- gf_log (this->name, GF_LOG_ERROR, "Couldn't find a local "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_BRICK_ERROR, "Couldn't find a local "
"brick");
return -1;
}
@@ -562,7 +569,8 @@ nufa_find_local_subvol (xlator_t *this,
parent = trav->xlator;
if (strcmp (parent->type, "cluster/nufa") == 0) {
- gf_log (this->name, GF_LOG_INFO, "Found local subvol, "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO, "Found local subvol, "
"%s", candidate->name);
ret = 0;
conf->private = candidate;
@@ -602,9 +610,9 @@ nufa_init (xlator_t *this)
local_volname = my_hostname;
else
- gf_log (this->name, GF_LOG_WARNING,
- "could not find hostname (%s)",
- strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ DHT_MSG_GET_HOSTNAME_FAILED,
+ "could not find hostname");
}
@@ -613,7 +621,8 @@ nufa_init (xlator_t *this)
args.addr_match = addr_match;
ret = nufa_find_local_subvol (this, nufa_find_local_brick, &args);
if (ret) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_SUBVOL_INFO,
"Unable to find local subvolume, switching "
"to dht mode");
nufa_to_dht (this);
diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c
index 0071dfa..9922a91 100644
--- a/xlators/cluster/dht/src/switch.c
+++ b/xlators/cluster/dht/src/switch.c
@@ -295,7 +295,8 @@ switch_lookup (call_frame_t *frame, xlator_t *this,
ret = dict_set_uint32 (local->xattr_req,
conf->xattr_name, 4 * 4);
if (ret < 0)
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
"failed to set dict value for %s",
conf->xattr_name);
@@ -314,14 +315,16 @@ switch_lookup (call_frame_t *frame, xlator_t *this,
ret = dict_set_uint32 (local->xattr_req,
conf->xattr_name, 4 * 4);
if (ret < 0)
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
"failed to set dict value for %s",
conf->xattr_name);
ret = dict_set_uint32 (local->xattr_req,
conf->link_xattr_name, 256);
if (ret < 0)
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+ DHT_MSG_DICT_SET_FAILED,
"failed to set dict value for %s",
conf->link_xattr_name);
@@ -662,7 +665,8 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf,
pattern = strtok_r (dup_str, ":", &tmp_str1);
childs = strtok_r (NULL, ":", &tmp_str1);
if (strncmp (pattern, "*", 2) == 0) {
- gf_log ("switch", GF_LOG_INFO,
+ gf_msg ("switch", GF_LOG_INFO, 0,
+ DHT_MSG_SWITCH_PATTERN_INFO,
"'*' pattern will be taken by default "
"for all the unconfigured child nodes,"
" hence neglecting current option");
@@ -681,7 +685,8 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf,
idx++;
child = strtok_r (NULL, ",", &tmp);
} else {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_SUBVOL_ERROR,
"%s is not a subvolume of %s. "
"pattern can only be scheduled "
"only to a subvolume of %s",
@@ -723,7 +728,8 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf,
}
} else {
/* error */
- gf_log ("switch", GF_LOG_ERROR,
+ gf_msg ("switch", GF_LOG_ERROR, 0,
+ DHT_MSG_SET_SWITCH_PATTERN_ERROR,
"Check \"scheduler.switch.case\" "
"option in unify volume. Exiting");
goto err;
@@ -755,7 +761,8 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf,
flag++;
}
if (!flag) {
- gf_log ("switch", GF_LOG_ERROR,
+ gf_msg ("switch", GF_LOG_ERROR, 0,
+ DHT_MSG_SET_SWITCH_PATTERN_ERROR,
"No nodes left for pattern '*'. Exiting");
goto err;
}
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index 7b4890c..8616233 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -485,11 +485,11 @@ tier_process_brick_cbk (dict_t *brick_dict, char *key, data_t *value,
query_cbk_args->queryFILE = fopen(GET_QFILE_PATH
(gfdb_brick_dict_info->_gfdb_promote), "a+");
if (!query_cbk_args->queryFILE) {
- gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_LOG_TIER_ERROR,
- "Failed to open query file %s:%s",
- GET_QFILE_PATH
- (gfdb_brick_dict_info->_gfdb_promote),
- strerror(errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ DHT_MSG_LOG_TIER_ERROR,
+ "Failed to open query file %s",
+ GET_QFILE_PATH
+ (gfdb_brick_dict_info->_gfdb_promote));
goto out;
}
if (!gfdb_brick_dict_info->_gfdb_promote) {
@@ -577,8 +577,9 @@ tier_build_migration_qfile (demotion_args_t *args,
ret = gettimeofday (¤t_time, NULL);
if (ret == -1) {
- gf_log (args->this->name, GF_LOG_ERROR,
- "Failed to get current timen");
+ gf_msg (args->this->name, GF_LOG_ERROR, errno,
+ DHT_MSG_SYS_CALL_GET_TIME_FAILED,
+ "Failed to get current time\n");
goto out;
}
time_in_past.tv_sec = current_time.tv_sec - time_in_past.tv_sec;
@@ -589,8 +590,9 @@ tier_build_migration_qfile (demotion_args_t *args,
ret = dict_foreach (args->brick_list, tier_process_brick_cbk,
&gfdb_brick_dict_info);
if (ret) {
- gf_log (args->this->name, GF_LOG_ERROR,
- "Brick query failedn");
+ gf_msg (args->this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_BRICK_QUERY_FAILED,
+ "Brick query failed\n");
goto out;
}
out:
@@ -607,7 +609,8 @@ tier_migrate_files_using_qfile (demotion_args_t *comp,
query_cbk_args->queryFILE = fopen (qfile, "r");
if (!query_cbk_args->queryFILE) {
- gf_log ("tier", GF_LOG_ERROR,
+ gf_msg ("tier", GF_LOG_ERROR, 0,
+ DHT_MSG_FOPEN_FAILED,
"Failed opening %s for migration", qfile);
goto out;
}
@@ -812,10 +815,9 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
ret = 0;
defrag->defrag_status =
GF_DEFRAG_STATUS_COMPLETE;
- gf_msg (this->name, GF_LOG_DEBUG, 0,
- DHT_MSG_LOG_TIER_ERROR,
- "defrag->defrag_cmd == "
- "GF_DEFRAG_CMD_START_DETACH_TIER");
+ gf_msg_debug (this->name, 0,
+ "defrag->defrag_cmd == "
+ "GF_DEFRAG_CMD_START_DETACH_TIER");
goto out;
}
@@ -830,7 +832,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
* using a NTP server*/
ret = gettimeofday (¤t_time, NULL);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ DHT_MSG_SYS_CALL_GET_TIME_FAILED,
"Failed to get current time");
goto out;
}
--
1.7.1