summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarao <arao@redhat.com>2015-06-12 16:35:53 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-06-23 22:15:10 -0700
commit2b645af1d077957829c8ff6b8ab56353ba3913d6 (patch)
treefe399a98df744440783a1eec00d6ff9c77ab533f
parent653d3c1406e372aabcf694bfead2d695f84ee0f8 (diff)
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 Tested-by: Joseph Fernandes Reviewed-by: Dan Lambright <dlambrig@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
-rw-r--r--xlators/cluster/dht/src/dht-common.c306
-rw-r--r--xlators/cluster/dht/src/dht-diskusage.c6
-rw-r--r--xlators/cluster/dht/src/dht-helper.c67
-rw-r--r--xlators/cluster/dht/src/dht-inode-read.c24
-rw-r--r--xlators/cluster/dht/src/dht-inode-write.c36
-rw-r--r--xlators/cluster/dht/src/dht-layout.c37
-rw-r--r--xlators/cluster/dht/src/dht-linkfile.c3
-rw-r--r--xlators/cluster/dht/src/dht-messages.h604
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c44
-rw-r--r--xlators/cluster/dht/src/dht-rename.c22
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c47
-rw-r--r--xlators/cluster/dht/src/dht-shared.c36
-rw-r--r--xlators/cluster/dht/src/nufa.c31
-rw-r--r--xlators/cluster/dht/src/switch.c21
-rw-r--r--xlators/cluster/dht/src/tier.c33
15 files changed, 975 insertions, 342 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 0e020213470..c634689dd64 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -46,7 +46,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;
}
@@ -56,7 +57,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;
@@ -64,7 +66,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;
@@ -114,8 +117,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) {
@@ -381,10 +385,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;
}
@@ -576,10 +579,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;
}
@@ -703,10 +705,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;
@@ -714,11 +716,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.
@@ -769,7 +772,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;
@@ -925,7 +929,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>",
@@ -978,7 +982,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 ));
@@ -1003,7 +1008,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 ));
@@ -1027,7 +1033,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",
@@ -1064,7 +1071,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));
@@ -1291,7 +1300,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);
@@ -1380,7 +1390,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 ?
@@ -1390,7 +1401,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 ?
@@ -1424,7 +1436,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 :
@@ -1641,7 +1654,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,
@@ -1739,10 +1753,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
@@ -1756,14 +1770,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;
@@ -1786,7 +1802,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;
@@ -1903,9 +1920,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,
@@ -1931,13 +1948,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;
@@ -1982,9 +1999,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;
}
@@ -1996,7 +2014,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;
@@ -2009,7 +2028,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,
@@ -2067,7 +2087,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);
@@ -2076,7 +2096,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);
@@ -2127,7 +2147,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;
@@ -2347,9 +2367,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;
}
@@ -2393,10 +2413,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;
}
@@ -2444,9 +2464,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;
}
@@ -2510,9 +2530,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;
@@ -2597,7 +2617,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;
@@ -2639,9 +2660,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;
@@ -2650,8 +2671,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;
@@ -2663,7 +2685,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;
@@ -2671,13 +2695,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;
}
}
@@ -2722,9 +2747,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;
}
@@ -2735,7 +2760,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:
@@ -2782,9 +2808,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;
}
@@ -2943,7 +2970,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.");
@@ -2962,9 +2990,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;
}
@@ -2988,8 +3016,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);
@@ -3114,7 +3142,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;
}
@@ -3450,8 +3480,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,
@@ -3727,13 +3757,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);
@@ -3744,7 +3773,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,
@@ -3774,7 +3804,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;
@@ -3936,9 +3967,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;
}
@@ -4024,7 +4055,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);
}
@@ -4112,7 +4144,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);
}
@@ -4150,9 +4183,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;
}
@@ -4244,7 +4277,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;
@@ -4657,7 +4692,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;
@@ -4940,7 +4975,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;
@@ -5518,7 +5553,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,
@@ -5870,11 +5906,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;
}
@@ -5950,11 +5986,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;
}
@@ -6117,10 +6153,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);
@@ -6162,7 +6197,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;
@@ -6207,7 +6243,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;
@@ -6219,7 +6256,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;
}
@@ -6288,7 +6326,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;
}
@@ -6351,7 +6390,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);
@@ -6448,11 +6488,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;
@@ -6769,7 +6808,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 83efdf1f0a8..9ebf6bf8732 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -39,7 +39,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;
}
@@ -184,7 +185,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 dfc219b6654..afcf2f6592c 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -250,7 +250,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);
}
@@ -961,9 +962,10 @@ 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;
@@ -971,17 +973,19 @@ dht_migration_complete_check_task (void *data)
dst_node = dht_subvol_get_cached (this, tmp_loc.inode);
if (linkto_target && dst_node != linkto_target) {
- gf_log (this->name, GF_LOG_WARNING, "linkto target (%s) is "
+ 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;
@@ -1030,7 +1034,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;
@@ -1138,16 +1143,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;
@@ -1161,7 +1168,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;
@@ -1205,7 +1213,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;
@@ -1224,7 +1234,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;
@@ -1480,10 +1491,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;
}
@@ -1533,7 +1545,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:");
@@ -1544,7 +1557,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:");
@@ -1608,11 +1622,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 17d76acda58..d86e4288e1c 100644
--- a/xlators/cluster/dht/src/dht-inode-read.c
+++ b/xlators/cluster/dht/src/dht-inode-read.c
@@ -31,9 +31,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;
}
@@ -140,9 +140,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;
}
@@ -226,9 +226,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;
}
@@ -720,9 +720,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 985fdeb5458..ce5006a80df 100644
--- a/xlators/cluster/dht/src/dht-inode-write.c
+++ b/xlators/cluster/dht/src/dht-inode-write.c
@@ -198,9 +198,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;
}
@@ -392,9 +392,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;
}
@@ -536,9 +536,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;
}
@@ -676,9 +676,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;
}
@@ -812,9 +812,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;
}
@@ -898,9 +898,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 103a7f8d637..1bdad65b70f 100644
--- a/xlators/cluster/dht/src/dht-layout.c
+++ b/xlators/cluster/dht/src/dht-layout.c
@@ -165,7 +165,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;
@@ -180,7 +181,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);
}
@@ -663,7 +665,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;
}
@@ -674,7 +677,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;
@@ -686,7 +690,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 );
@@ -759,11 +764,13 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
if (!xattr) {
if (err == 0) {
if (loc) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_DICT_GET_FAILED,
"%s: xattr dictionary is NULL",
loc->path);
} else {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_DICT_GET_FAILED,
"path not found: "
"xattr dictionary is NULL");
}
@@ -778,11 +785,13 @@ 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) {
if (loc) {
- gf_log (this->name, GF_LOG_INFO,
- "%s: Disk layout missing, gfid = %s",
- loc->path, gfid);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_DISK_LAYOUT_MISSING,
+ "%s: Disk layout missing, gfid = %s",
+ loc->path, gfid);
} else {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_DISK_LAYOUT_MISSING,
"path not found: "
"Disk layout missing, gfid = %s",
gfid);
@@ -801,7 +810,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,
@@ -831,7 +841,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 ebfb1c42f6c..894743621ba 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -39,7 +39,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 28cfe77d916..60030832d9f 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
@@ -40,7 +40,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 */
@@ -66,7 +66,7 @@
*
*/
-#define DHT_MSG_CREATE_LINK_FAILED (GLFS_DHT_BASE + 2)
+#define DHT_MSG_CREATE_LINK_FAILED (GLFS_DHT_BASE + 2)
/*!
* @messageid 109003
@@ -77,7 +77,7 @@
*
*/
-#define DHT_MSG_DICT_SET_FAILED (GLFS_DHT_BASE + 3)
+#define DHT_MSG_DICT_SET_FAILED (GLFS_DHT_BASE + 3)
/*!
* @messageid 109004
@@ -86,7 +86,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
@@ -97,7 +97,7 @@
*
*/
-#define DHT_MSG_DIR_SELFHEAL_FAILED (GLFS_DHT_BASE + 5)
+#define DHT_MSG_DIR_SELFHEAL_FAILED (GLFS_DHT_BASE + 5)
/*!
* @messageid 109006
@@ -108,7 +108,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
@@ -121,7 +121,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
@@ -139,7 +139,7 @@
*
*/
-#define DHT_MSG_FILE_TYPE_MISMATCH (GLFS_DHT_BASE + 8)
+#define DHT_MSG_FILE_TYPE_MISMATCH (GLFS_DHT_BASE + 8)
/*!
* @messageid 109009
@@ -148,7 +148,7 @@
*
*/
-#define DHT_MSG_GFID_MISMATCH (GLFS_DHT_BASE + 9)
+#define DHT_MSG_GFID_MISMATCH (GLFS_DHT_BASE + 9)
/*!
* @messageid 109010
@@ -157,17 +157,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
@@ -177,7 +175,7 @@
*
*/
-#define DHT_MSG_INIT_FAILED (GLFS_DHT_BASE + 12)
+#define DHT_MSG_INIT_FAILED (GLFS_DHT_BASE + 12)
/*!
* @messageid 109013
@@ -186,7 +184,7 @@
*
*/
-#define DHT_MSG_INVALID_CONFIGURATION (GLFS_DHT_BASE + 13)
+#define DHT_MSG_INVALID_CONFIGURATION (GLFS_DHT_BASE + 13)
/*!
* @messageid 109014
@@ -195,7 +193,7 @@
*
*/
-#define DHT_MSG_INVALID_DISK_LAYOUT (GLFS_DHT_BASE + 14)
+#define DHT_MSG_INVALID_DISK_LAYOUT (GLFS_DHT_BASE + 14)
/*!
* @messageid 109015
@@ -208,7 +206,7 @@
*
*/
-#define DHT_MSG_INVALID_OPTION (GLFS_DHT_BASE + 15)
+#define DHT_MSG_INVALID_OPTION (GLFS_DHT_BASE + 15)
/*!
* @messageid 109016
@@ -226,7 +224,7 @@
*
*/
-#define DHT_MSG_LAYOUT_MERGE_FAILED (GLFS_DHT_BASE + 17)
+#define DHT_MSG_LAYOUT_MERGE_FAILED (GLFS_DHT_BASE + 17)
/*!
* @messageid 109018
@@ -236,7 +234,7 @@
*
*/
-#define DHT_MSG_LAYOUT_MISMATCH (GLFS_DHT_BASE + 18)
+#define DHT_MSG_LAYOUT_MISMATCH (GLFS_DHT_BASE + 18)
/*!
* @messageid 109019
@@ -245,7 +243,7 @@
*
*/
-#define DHT_MSG_LAYOUT_NULL (GLFS_DHT_BASE + 19)
+#define DHT_MSG_LAYOUT_NULL (GLFS_DHT_BASE + 19)
/*!
* @messageid 109020
@@ -255,7 +253,7 @@
*
*/
-#define DHT_MSG_MIGRATE_DATA_COMPLETE (GLFS_DHT_BASE + 20)
+#define DHT_MSG_MIGRATE_DATA_COMPLETE (GLFS_DHT_BASE + 20)
/*!
* @messageid 109021
@@ -279,7 +277,7 @@
*
*/
-#define DHT_MSG_MIGRATE_FILE_COMPLETE (GLFS_DHT_BASE + 22)
+#define DHT_MSG_MIGRATE_FILE_COMPLETE (GLFS_DHT_BASE + 22)
/*!
* @messageid 109023
@@ -304,7 +302,7 @@
*
*/
-#define DHT_MSG_NO_MEMORY (GLFS_DHT_BASE + 24)
+#define DHT_MSG_NO_MEMORY (GLFS_DHT_BASE + 24)
/*!
* @messageid 109025
@@ -320,7 +318,7 @@
*
*/
-#define DHT_MSG_OPENDIR_FAILED (GLFS_DHT_BASE + 25)
+#define DHT_MSG_OPENDIR_FAILED (GLFS_DHT_BASE + 25)
/*!
* @messageid 109026
@@ -332,7 +330,7 @@
*
*/
-#define DHT_MSG_REBALANCE_FAILED (GLFS_DHT_BASE + 26)
+#define DHT_MSG_REBALANCE_FAILED (GLFS_DHT_BASE + 26)
/*!
* @messageid 109027
@@ -341,7 +339,7 @@
*
*/
-#define DHT_MSG_REBALANCE_START_FAILED (GLFS_DHT_BASE + 27)
+#define DHT_MSG_REBALANCE_START_FAILED (GLFS_DHT_BASE + 27)
/*!
* @messageid 109028
@@ -352,7 +350,7 @@
*
*/
-#define DHT_MSG_REBALANCE_STATUS (GLFS_DHT_BASE + 28)
+#define DHT_MSG_REBALANCE_STATUS (GLFS_DHT_BASE + 28)
/*!
* @messageid 109029
@@ -361,7 +359,7 @@
*
*/
-#define DHT_MSG_REBALANCE_STOPPED (GLFS_DHT_BASE + 29)
+#define DHT_MSG_REBALANCE_STOPPED (GLFS_DHT_BASE + 29)
/*!
* @messageid 109030
@@ -372,7 +370,7 @@
*
*/
-#define DHT_MSG_RENAME_FAILED (GLFS_DHT_BASE + 30)
+#define DHT_MSG_RENAME_FAILED (GLFS_DHT_BASE + 30)
/*!
* @messageid 109031
@@ -382,7 +380,7 @@
*
*/
-#define DHT_MSG_SETATTR_FAILED (GLFS_DHT_BASE + 31)
+#define DHT_MSG_SETATTR_FAILED (GLFS_DHT_BASE + 31)
/*!
* @messageid 109032
@@ -414,7 +412,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)
@@ -425,7 +423,7 @@
*
*/
-#define DHT_MSG_LAYOUT_SET_FAILED (GLFS_DHT_BASE + 35)
+#define DHT_MSG_LAYOUT_SET_FAILED (GLFS_DHT_BASE + 35)
/*!
* @messageid 109036
@@ -434,7 +432,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
@@ -442,7 +440,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
@@ -450,11 +448,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 b93d0859b50..9aefdabf153 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -308,7 +308,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;
@@ -321,10 +323,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;
}
@@ -580,7 +584,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;
}
@@ -1402,9 +1407,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;
}
@@ -1757,8 +1763,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));
@@ -1960,9 +1966,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;
}
@@ -2296,10 +2302,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);
@@ -2733,8 +2739,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 7563cbbd540..b6ed2ae90de 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -445,7 +445,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",
@@ -488,7 +489,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;
}
@@ -633,9 +635,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) {
@@ -1213,10 +1216,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);
@@ -1394,7 +1397,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 2c2e3ae863e..a7fcc9ceca5 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -140,7 +140,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;
}
@@ -192,10 +193,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;
}
@@ -936,9 +936,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);
@@ -1211,7 +1211,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++) {
@@ -1481,14 +1482,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
@@ -1587,9 +1590,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;
@@ -1626,9 +1629,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) {
@@ -1833,14 +1837,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;
@@ -1850,7 +1856,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 b8f42fb145b..342c2015b1a 100644
--- a/xlators/cluster/dht/src/dht-shared.c
+++ b/xlators/cluster/dht/src/dht-shared.c
@@ -259,8 +259,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:
@@ -289,7 +290,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;
@@ -354,12 +356,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);
}
}
@@ -453,7 +456,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);
}
@@ -592,7 +597,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;
@@ -717,7 +723,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;
}
@@ -746,8 +753,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;
@@ -762,9 +769,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 43519d97542..56e17d6e884 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -201,7 +201,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;
@@ -222,7 +223,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;
@@ -231,7 +233,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;
@@ -503,7 +506,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;
}
@@ -516,7 +521,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;
}
@@ -546,7 +552,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;
}
@@ -557,7 +564,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;
@@ -597,9 +605,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");
}
@@ -608,7 +616,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 c86a0a9b75b..f1e9a399442 100644
--- a/xlators/cluster/dht/src/switch.c
+++ b/xlators/cluster/dht/src/switch.c
@@ -290,7 +290,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);
@@ -309,14 +310,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);
@@ -657,7 +660,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");
@@ -676,7 +680,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",
@@ -718,7 +723,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;
@@ -750,7 +756,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 2ac2d466730..c8c6ad94c7e 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -481,11 +481,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) {
@@ -573,8 +573,9 @@ tier_build_migration_qfile (demotion_args_t *args,
ret = gettimeofday (&current_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;
@@ -585,8 +586,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:
@@ -603,7 +605,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;
}
@@ -810,10 +813,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;
}
@@ -829,7 +831,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
* using a NTP server*/
ret = gettimeofday (&current_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;
}