summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNithya Balachandran <nbalacha@redhat.com>2014-05-30 11:26:40 +0530
committerVijay Bellur <vbellur@redhat.com>2014-06-16 06:25:51 -0700
commit7382b66de76101d625ed888ec7b7f82fd7da56d3 (patch)
treee28bc5b65c6557907c4e011ca1ca7776cabd0656
parent0031bd1d18c874f3b68b59df7f84fce354b9b86c (diff)
Cluster/DHT: New logging framework
Moved all relevant DHT gf_log calls to the new logging framework. Change-Id: I3af3cfe0416e332774a6c4ff6a091d006c400af2 BUG: 1075611 Signed-off-by: Nithya Balachandran <nbalacha@redhat.com> Reviewed-on: http://review.gluster.org/7929 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--libglusterfs/src/glfs-message-id.h5
-rw-r--r--xlators/cluster/dht/src/Makefile.am2
-rw-r--r--xlators/cluster/dht/src/dht-common.c729
-rw-r--r--xlators/cluster/dht/src/dht-common.h1
-rw-r--r--xlators/cluster/dht/src/dht-diskusage.c38
-rw-r--r--xlators/cluster/dht/src/dht-hashfn.c6
-rw-r--r--xlators/cluster/dht/src/dht-helper.c25
-rw-r--r--xlators/cluster/dht/src/dht-inode-read.c76
-rw-r--r--xlators/cluster/dht/src/dht-inode-write.c76
-rw-r--r--xlators/cluster/dht/src/dht-layout.c74
-rw-r--r--xlators/cluster/dht/src/dht-linkfile.c63
-rw-r--r--xlators/cluster/dht/src/dht-messages.h443
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c321
-rw-r--r--xlators/cluster/dht/src/dht-rename.c184
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c151
-rw-r--r--xlators/cluster/dht/src/dht-shared.c53
-rw-r--r--xlators/cluster/dht/src/nufa.c50
-rw-r--r--xlators/cluster/dht/src/switch.c82
18 files changed, 1626 insertions, 753 deletions
diff --git a/libglusterfs/src/glfs-message-id.h b/libglusterfs/src/glfs-message-id.h
index e29142ed615..f0f407ba6f5 100644
--- a/libglusterfs/src/glfs-message-id.h
+++ b/libglusterfs/src/glfs-message-id.h
@@ -61,6 +61,11 @@
#define GLFS_MSGID_COMP_AFR_END GLFS_MSGID_COMP_AFR +\
GLFS_MSGID_SEGMENT
+#define GLFS_MSGID_COMP_DHT GLFS_MSGID_COMP_AFR_END
+#define GLFS_MSGID_COMP_DHT_END GLFS_MSGID_COMP_DHT +\
+ GLFS_MSGID_SEGMENT
+
+
/* --- new segments for messages goes above this line --- */
#endif /* !_GLFS_MESSAGE_ID_H_ */
diff --git a/xlators/cluster/dht/src/Makefile.am b/xlators/cluster/dht/src/Makefile.am
index 3fc29bf8154..a180f9263ff 100644
--- a/xlators/cluster/dht/src/Makefile.am
+++ b/xlators/cluster/dht/src/Makefile.am
@@ -20,7 +20,7 @@ nufa_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
switch_la_LDFLAGS = -module -avoid-version
switch_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
-noinst_HEADERS = dht-common.h dht-mem-types.h \
+noinst_HEADERS = dht-common.h dht-mem-types.h dht-messages.h \
$(top_builddir)/xlators/lib/src/libxlator.h
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 419815cce4d..5c4fe2d4ca4 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -43,8 +43,9 @@ dht_aggregate (dict_t *this, char *key, data_t *value, void *data)
size = GF_CALLOC (1, sizeof (int64_t),
gf_common_mt_char);
if (size == NULL) {
- gf_log ("dht", GF_LOG_WARNING,
- "memory allocation failed");
+ gf_msg ("dht", GF_LOG_WARNING, 0,
+ DHT_MSG_NO_MEMORY,
+ "Memory allocation failed");
return -1;
}
ret = dict_set_bin (dst, key, size, sizeof (int64_t));
@@ -75,13 +76,17 @@ dht_aggregate (dict_t *this, char *key, data_t *value, void *data)
if (!ret && dict_data && value) {
ret = is_data_equal (dict_data, value);
if (!ret)
- gf_log ("dht", GF_LOG_DEBUG,
- "xattr mismatch for %s", key);
+ gf_msg_debug ("dht", 0,
+ "xattr mismatch for %s",
+ key);
}
}
ret = dict_set (dst, key, value);
if (ret)
- gf_log ("dht", GF_LOG_WARNING, "xattr dict set failed");
+ gf_msg ("dht", GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value: key = %s",
+ key);
}
return 0;
@@ -171,7 +176,8 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)
return 0;
if (local->file_count && local->dir_count) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_FILE_TYPE_MISMATCH,
"path %s exists as a file on one subvolume "
"and directory on another. "
"Please fix it manually",
@@ -184,7 +190,8 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)
ret = dht_layout_preset (this, local->cached_subvol,
local->inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_LAYOUT_SET_FAILED,
"failed to set layout for subvolume %s",
local->cached_subvol ? local->cached_subvol->name : "<nil>");
op_errno = EINVAL;
@@ -196,11 +203,11 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)
/* either the layout is incorrect or the directory is
* not found even in one subvolume.
*/
- gf_log (this->name, GF_LOG_DEBUG,
- "normalizing failed on %s "
- "(overlaps/holes present: %s, "
- "ENOENT errors: %d)", local->loc.path,
- (ret < 0) ? "yes" : "no", (ret > 0) ? ret : 0);
+ gf_msg_debug (this->name, 0,
+ "normalizing failed on %s "
+ "(overlaps/holes present: %s, "
+ "ENOENT errors: %d)", local->loc.path,
+ (ret < 0) ? "yes" : "no", (ret > 0) ? ret : 0);
if ((ret > 0) && (ret == conf->subvolume_cnt)) {
op_errno = ESTALE;
goto out;
@@ -238,6 +245,8 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int is_linkfile = 0;
int attempt_unwind = 0;
dht_conf_t *conf = 0;
+ char gfid_local[GF_UUID_BUF_SIZE] = {0};
+ char gfid_node[GF_UUID_BUF_SIZE] = {0};
GF_VALIDATE_OR_GOTO ("dht", frame, out);
GF_VALIDATE_OR_GOTO ("dht", this, out);
@@ -251,11 +260,19 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
layout = local->layout;
+
/* Check if the gfid is different for file from other node */
if (!op_ret && uuid_compare (local->gfid, stbuf->ia_gfid)) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: gfid different on %s",
- local->loc.path, prev->this->name);
+
+ uuid_unparse(stbuf->ia_gfid, gfid_node);
+ uuid_unparse(local->gfid, gfid_local);
+
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_GFID_MISMATCH,
+ "%s: gfid different on %s, gfid local = %s"
+ "gfid other = %s",
+ local->loc.path, prev->this->name,
+ gfid_local, gfid_node);
}
@@ -269,15 +286,17 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dht_layout_merge (this, layout, prev->this,
op_ret, op_errno, xattr);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to merge layouts", local->loc.path);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_LAYOUT_MERGE_FAILED,
+ "%s: failed to merge layouts for subvol %s",
+ local->loc.path, prev->this->name);
if (op_ret == -1) {
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "lookup of %s on %s returned error (%s)",
- local->loc.path, prev->this->name,
- strerror (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));
goto unlock;
}
@@ -347,14 +366,16 @@ dht_discover (call_frame_t *frame, xlator_t *this, loc_t *loc)
ret = dict_set_uint32 (local->xattr_req, conf->xattr_name, 4 * 4);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to set '%s' key",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value:key = %s",
loc->path, conf->xattr_name);
ret = dict_set_uint32 (local->xattr_req, conf->link_xattr_name, 256);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to set '%s' key",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value:key = %s",
loc->path, conf->link_xattr_name);
call_cnt = conf->subvolume_cnt;
@@ -408,6 +429,8 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_layout_t *layout = NULL;
int ret = -1;
int is_dir = 0;
+ char gfid_local[GF_UUID_BUF_SIZE] = {0};
+ char gfid_node[GF_UUID_BUF_SIZE] = {0};
GF_VALIDATE_OR_GOTO ("dht", frame, out);
GF_VALIDATE_OR_GOTO ("dht", this, out);
@@ -423,11 +446,19 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!op_ret && uuid_is_null (local->gfid))
memcpy (local->gfid, stbuf->ia_gfid, 16);
+
/* Check if the gfid is different for file from other node */
if (!op_ret && uuid_compare (local->gfid, stbuf->ia_gfid)) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: gfid different on %s",
- local->loc.path, prev->this->name);
+
+ uuid_unparse(stbuf->ia_gfid, gfid_node);
+ uuid_unparse(local->gfid, gfid_local);
+
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_GFID_MISMATCH,
+ "%s: gfid different on %s."
+ " gfid local = %s, gfid subvol = %s",
+ local->loc.path, prev->this->name,
+ gfid_local, gfid_node);
}
LOCK (&frame->lock);
@@ -442,20 +473,20 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "lookup of %s on %s returned error (%s)",
- local->loc.path, prev->this->name,
- strerror (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));
goto unlock;
}
is_dir = check_is_dir (inode, stbuf, xattr);
if (!is_dir) {
- gf_log (this->name, GF_LOG_DEBUG,
- "lookup of %s on %s returned non dir 0%o",
- local->loc.path, prev->this->name,
- stbuf->ia_type);
+ gf_msg_debug (this->name, 0,
+ "lookup of %s on %s returned non dir 0%o",
+ local->loc.path, prev->this->name,
+ stbuf->ia_type);
local->need_selfheal = 1;
goto unlock;
}
@@ -491,9 +522,9 @@ unlock:
ret = dht_layout_normalize (this, &local->loc, layout);
if (ret != 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "fixing assignment on %s",
- local->loc.path);
+ gf_msg_debug (this->name, 0,
+ "fixing assignment on %s",
+ local->loc.path);
goto selfheal;
}
@@ -538,6 +569,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int is_linkfile = 0;
call_frame_t *copy = NULL;
dht_local_t *copy_local = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
GF_VALIDATE_OR_GOTO ("dht", frame, err);
GF_VALIDATE_OR_GOTO ("dht", this, err);
@@ -550,6 +582,8 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!conf)
goto out;
+ uuid_unparse (local->loc.gfid, gfid);
+
LOCK (&frame->lock);
{
if (op_ret == -1) {
@@ -559,9 +593,10 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
&& (op_errno != ENOENT)
&& (op_errno != ESTALE)) {
gf_log (this->name, GF_LOG_INFO,
- "subvolume %s for %s returned -1 (%s)",
+ "Revalidate: subvolume %s for %s "
+ "(gfid = %s) returned -1 (%s)",
prev->this->name, local->loc.path,
- strerror (op_errno));
+ gfid, strerror (op_errno));
}
if (op_errno == ESTALE) {
/* propagate the ESTALE to parent.
@@ -582,10 +617,12 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
if (stbuf->ia_type != local->inode->ia_type) {
- gf_log (this->name, GF_LOG_INFO,
- "mismatching filetypes 0%o v/s 0%o for %s",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_FILE_TYPE_MISMATCH,
+ "mismatching filetypes 0%o v/s 0%o for %s,"
+ " gfid = %s",
(stbuf->ia_type), (local->inode->ia_type),
- local->loc.path);
+ local->loc.path, gfid);
local->op_ret = -1;
local->op_errno = EINVAL;
@@ -601,8 +638,8 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (is_linkfile) {
gf_log (this->name, GF_LOG_INFO,
- "linkfile found in revalidate for %s",
- local->loc.path);
+ "Revalidate: linkfile found %s, (gfid = %s)",
+ local->loc.path, gfid);
local->return_estale = 1;
goto unlock;
@@ -630,9 +667,10 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev->this, &local->loc,
xattr);
if (ret != 0) {
- gf_log (this->name, GF_LOG_INFO,
- "mismatching layouts for %s",
- local->loc.path);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LAYOUT_MISMATCH,
+ "Mismatching layouts for %s, gfid = %s",
+ local->loc.path, gfid);
local->layout_mismatch = 1;
@@ -739,6 +777,7 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
xlator_t *cached_subvol = NULL;
dht_conf_t *conf = NULL;
int ret = -1;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
GF_VALIDATE_OR_GOTO ("dht", frame, out);
GF_VALIDATE_OR_GOTO ("dht", this, out);
@@ -750,11 +789,15 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
cached_subvol = local->cached_subvol;
conf = this->private;
+ uuid_unparse(local->loc.gfid, gfid);
+
ret = dht_layout_preset (this, local->cached_subvol, local->loc.inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set layout for subvolume %s",
- cached_subvol ? cached_subvol->name : "<nil>");
+ gf_msg_debug (this->name, 0,
+ "Failed to set layout for subvolume %s, "
+ "(gfid = %s)",
+ cached_subvol ? cached_subvol->name : "<nil>",
+ gfid);
local->op_ret = -1;
local->op_errno = EINVAL;
goto unwind;
@@ -792,17 +835,21 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
xlator_t *hashed_subvol = NULL;
xlator_t *cached_subvol = NULL;
dht_layout_t *layout = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
hashed_subvol = local->hashed_subvol;
cached_subvol = local->cached_subvol;
+ uuid_unparse (local->loc.gfid, gfid);
+
if (local->file_count && local->dir_count) {
- gf_log (this->name, GF_LOG_ERROR,
- "path %s exists as a file on one subvolume "
- "and directory on another. "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_FILE_TYPE_MISMATCH,
+ "path %s (gfid = %s)exists as a file on one "
+ "subvolume and directory on another. "
"Please fix it manually",
- local->loc.path);
+ local->loc.path, gfid);
DHT_STACK_UNWIND (lookup, frame, -1, EIO, NULL, NULL, NULL,
NULL);
return 0;
@@ -831,19 +878,21 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
layout = dht_layout_for_subvol (this, cached_subvol);
if (!layout) {
gf_log (this->name, GF_LOG_INFO,
- "%s: no pre-set layout for subvolume %s",
+ "%s: no pre-set layout for subvolume %s,"
+ " gfid = %s",
local->loc.path, (cached_subvol ?
cached_subvol->name :
- "<nil>"));
+ "<nil>"), gfid);
}
ret = dht_layout_set (this, local->inode, layout);
if (ret < 0) {
gf_log (this->name, GF_LOG_INFO,
- "%s: failed to set layout for subvol %s",
+ "%s: failed to set layout for subvol %s, "
+ "gfid = %s",
local->loc.path, (cached_subvol ?
cached_subvol->name :
- "<nil>"));
+ "<nil>"), gfid);
}
if (local->loc.parent) {
@@ -860,10 +909,11 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
}
if (!hashed_subvol) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_HASHED_SUBVOL_GET_FAILED,
"cannot create linkfile file for %s on %s: "
- "hashed subvolume cannot be found.",
- local->loc.path, cached_subvol->name);
+ "hashed subvolume cannot be found, gfid = %s.",
+ local->loc.path, cached_subvol->name, gfid);
local->op_ret = 0;
local->op_errno = 0;
@@ -872,9 +922,10 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
local->inode);
if (ret < 0) {
gf_log (this->name, GF_LOG_INFO,
- "failed to set layout for subvol %s",
+ "Failed to set layout for subvol %s"
+ ", gfid = %s",
cached_subvol ? cached_subvol->name :
- "<nil>");
+ "<nil>", gfid);
local->op_ret = -1;
local->op_errno = EINVAL;
}
@@ -892,10 +943,10 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
return 0;
}
- gf_log (this->name, GF_LOG_DEBUG,
- "linking file %s existing on %s to %s (hash)",
- local->loc.path, cached_subvol->name,
- hashed_subvol->name);
+ gf_msg_debug (this->name, 0,
+ "Linking file %s on %s to %s (hash)(gfid = %s)",
+ local->loc.path, cached_subvol->name,
+ hashed_subvol->name, gfid);
ret = dht_linkfile_create (frame,
dht_lookup_linkfile_create_cbk, this,
@@ -939,6 +990,7 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int ret = -1;
int32_t fd_count = 0;
dht_conf_t *conf = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
GF_VALIDATE_OR_GOTO ("dht", frame, out);
GF_VALIDATE_OR_GOTO ("dht", this, out);
@@ -964,10 +1016,15 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (uuid_is_null (local->gfid))
uuid_copy (local->gfid, buf->ia_gfid);
+ uuid_unparse(local->gfid, gfid);
+
if (uuid_compare (local->gfid, buf->ia_gfid)) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: gfid differs on subvolume %s",
- loc->path, prev->this->name);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_GFID_MISMATCH,
+ "%s: gfid differs on subvolume %s,"
+ " gfid local = %s, gfid node = %s",
+ loc->path, prev->this->name, gfid,
+ uuid_utoa(buf->ia_gfid));
}
is_linkfile = check_is_linkfile (inode, buf, xattr,
@@ -977,10 +1034,10 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (is_linkfile) {
link_subvol = dht_linkfile_subvol (this, inode, buf,
xattr);
- gf_log (this->name, GF_LOG_DEBUG,
- "found on %s linkfile %s (-> %s)",
- subvol->name, loc->path,
- link_subvol ? link_subvol->name : "''");
+ gf_msg_debug (this->name, 0,
+ "found on %s linkfile %s (-> %s)",
+ subvol->name, loc->path,
+ link_subvol ? link_subvol->name : "''");
goto unlock;
}
@@ -990,9 +1047,9 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (is_dir) {
local->dir_count++;
- gf_log (this->name, GF_LOG_DEBUG,
- "found on %s directory %s",
- subvol->name, loc->path);
+ gf_msg_debug (this->name, 0,
+ "found on %s directory %s",
+ subvol->name, loc->path);
} else {
local->file_count++;
@@ -1002,18 +1059,19 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
subvol);
local->xattr = dict_ref (xattr);
local->cached_subvol = subvol;
- gf_log (this->name, GF_LOG_DEBUG,
- "found on %s file %s",
- subvol->name, loc->path);
+ gf_msg_debug (this->name, 0,
+ "found on %s file %s",
+ subvol->name, loc->path);
dht_iatt_merge (this, &local->postparent,
postparent, subvol);
} else {
/* This is where we need 'rename' both entries logic */
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_FILE_ON_MULT_SUBVOL,
"multiple subvolumes (%s and %s) have "
"file %s (preferably rename the file "
- "in the backend, and do a fresh lookup)",
+ "in the backend,and do a fresh lookup)",
local->cached_subvol->name,
subvol->name, local->loc.path);
}
@@ -1096,6 +1154,7 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
loc_t *loc = NULL;
dht_conf_t *conf = NULL;
int ret = 0;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
GF_VALIDATE_OR_GOTO ("dht", frame, out);
GF_VALIDATE_OR_GOTO ("dht", this, unwind);
@@ -1109,10 +1168,13 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
local = frame->local;
loc = &local->loc;
+ 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)",
- local->loc.path, subvol->name, strerror (op_errno));
+ "Lookup of %s on %s (following linkfile) failed (%s)"
+ ",gfid = %s", local->loc.path, subvol->name,
+ strerror (op_errno), gfid);
/* If cached subvol returned ENOTCONN, do not do
lookup_everywhere. We need to make sure linkfile does not get
@@ -1127,22 +1189,25 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
if (check_is_dir (inode, stbuf, xattr)) {
gf_log (this->name, GF_LOG_INFO,
- "lookup of %s on %s (following linkfile) reached dir",
- local->loc.path, subvol->name);
+ "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,
- "lookup of %s on %s (following linkfile) reached link",
- local->loc.path, subvol->name);
+ "lookup of %s on %s (following linkfile) reached link,"
+ "gfid = %s", local->loc.path, subvol->name, gfid);
goto err;
}
if (uuid_compare (local->gfid, stbuf->ia_gfid)) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: gfid different on data file on %s",
- local->loc.path, subvol->name);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_GFID_MISMATCH,
+ "%s: gfid different on data file on %s,"
+ " gfid local = %s, gfid node = %s ",
+ local->loc.path, subvol->name, gfid,
+ uuid_utoa(stbuf->ia_gfid));
goto err;
}
@@ -1154,8 +1219,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,
- "failed to set layout for subvolume %s",
- prev->this->name);
+ "Failed to set layout for subvolume %s,"
+ "gfid = %s", prev->this->name, gfid);
op_ret = -1;
op_errno = EINVAL;
}
@@ -1214,8 +1279,10 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc)
ret = dict_set_static_bin (local->xattr_req, "gfid-req",
local->gfid, 16);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to set gfid", local->loc.path);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value:"
+ " key = gfid-req", local->loc.path);
}
for (i = 0; i < call_cnt; i++) {
@@ -1268,8 +1335,8 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
memcpy (local->gfid, stbuf->ia_gfid, 16);
if (ENTRY_MISSING (op_ret, op_errno)) {
- gf_log (this->name, GF_LOG_TRACE, "Entry %s missing on subvol"
- " %s", loc->path, prev->this->name);
+ gf_msg_trace (this->name, 0, "Entry %s missing on subvol"
+ " %s", loc->path, prev->this->name);
if (conf->search_unhashed == GF_DHT_LOOKUP_UNHASHED_ON) {
local->op_errno = ENOENT;
dht_lookup_everywhere (frame, this, loc);
@@ -1303,9 +1370,9 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG, "Lookup of %s for subvolume"
- " %s failed with error %s", loc->path, prev->this->name,
- strerror (op_errno));
+ gf_msg_debug (this->name, 0, "Lookup of %s for subvolume"
+ " %s failed with error %s", loc->path,
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -1329,9 +1396,9 @@ 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_DEBUG,
- "linkfile not having link subvolume. path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "linkfile not having link subvolume. path=%s",
+ loc->path);
dht_lookup_everywhere (frame, this, loc);
return 0;
}
@@ -1380,16 +1447,18 @@ 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_log (THIS->name, GF_LOG_WARNING,
- "failed to set key %s",
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value:key = %s",
POSIX_ACL_ACCESS_XATTR);
}
if (!dict_get (xattr_req, POSIX_ACL_DEFAULT_XATTR)) {
ret = dict_set_int8 (xattr_req, POSIX_ACL_DEFAULT_XATTR, 0);
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING,
- "failed to set key %s",
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value:key = %s",
POSIX_ACL_DEFAULT_XATTR);
}
@@ -1438,9 +1507,9 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
/* check if loc_dup() is successful */
if (ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "copying location failed for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "copying location failed for path=%s",
+ loc->path);
goto err;
}
}
@@ -1465,17 +1534,17 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
if (is_revalidate (loc)) {
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "revalidate without cache. path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "Revalidate lookup without cache."
+ " path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
if (layout->gen && (layout->gen < conf->gen)) {
- gf_log (this->name, GF_LOG_TRACE,
- "incomplete layout failure for path=%s",
- loc->path);
+ gf_msg_trace (this->name, 0,
+ "incomplete layout failure for path=%s",
+ loc->path);
dht_layout_unref (this, local->layout);
local->layout = NULL;
@@ -1538,10 +1607,10 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
dht_check_and_set_acl_xattr_req (loc->inode, local->xattr_req);
if (!hashed_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s, "
- "checking on all the subvols to see if "
- "it is a directory", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s, "
+ "checking on all the subvols to see if "
+ "it is a directory", loc->path);
call_cnt = conf->subvolume_cnt;
local->call_cnt = call_cnt;
@@ -1592,9 +1661,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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "Unlink: subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto unlock;
}
@@ -1638,9 +1707,11 @@ 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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "Unlink link: subvolume %s"
+ " returned -1 (%s)",
+ prev->this->name,
+ strerror (op_errno));
goto unlock;
}
@@ -1654,9 +1725,9 @@ unlock:
cached_subvol = dht_subvol_get_cached (this, local->loc.inode);
if (!cached_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s",
- local->loc.path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s",
+ local->loc.path);
local->op_errno = EINVAL;
goto err;
}
@@ -1688,9 +1759,10 @@ dht_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
if (op_ret == -1) {
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name,
+ strerror (op_errno));
goto unlock;
}
@@ -1935,7 +2007,8 @@ 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, "Subvolume %s returned -1 "
+ gf_log (this->name, GF_LOG_ERROR,
+ "vgetxattr: Subvolume %s returned -1 "
"(%s)", prev->this->name, strerror (op_errno));
goto unwind;
}
@@ -1943,8 +2016,9 @@ dht_vgetxattr_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,
- "alloc or fill failure");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_NO_MEMORY,
+ "Allocation or fill failure");
goto unwind;
}
@@ -1980,8 +2054,8 @@ dht_linkinfo_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!ret) {
ret = dict_set_str (xattr, GF_XATTR_LINKINFO_KEY, value);
if (!ret)
- gf_log (this->name, GF_LOG_TRACE,
- "failed to set linkinfo");
+ gf_msg_trace (this->name, 0,
+ "failed to set linkinfo");
}
}
@@ -2138,8 +2212,9 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_ERROR,
- "layout is NULL");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_LAYOUT_NULL,
+ "Layout is NULL");
op_errno = ENOENT;
goto err;
}
@@ -2199,16 +2274,20 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
if (key && (strcmp (key, GF_XATTR_LINKINFO_KEY) == 0)) {
hashed_subvol = dht_subvol_get_hashed (this, loc);
if (!hashed_subvol) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get"
- "hashed subvol for %s", loc->path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_HASHED_SUBVOL_GET_FAILED,
+ "Failed to get hashed subvol for %s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
cached_subvol = dht_subvol_get_cached (this, loc->inode);
if (!cached_subvol) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get"
- "cached subvol for %s", loc->path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_CACHED_SUBVOL_GET_FAILED,
+ "Failed to get cached subvol for %s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
@@ -2337,8 +2416,9 @@ dht_fgetxattr (call_frame_t *frame, xlator_t *this,
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_ERROR,
- "layout is NULL");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_LAYOUT_NULL,
+ "Layout is NULL");
op_errno = ENOENT;
goto err;
}
@@ -2403,8 +2483,8 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -2510,16 +2590,17 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no layout for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no layout for path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
@@ -2545,8 +2626,10 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
local->rebalance.target_node = dht_subvol_get_hashed (this, loc);
if (!local->rebalance.target_node) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
- "hashed subvol for %s", loc->path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_HASHED_SUBVOL_GET_FAILED,
+ "Failed to get hashed subvol for %s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
@@ -2564,8 +2647,9 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
if (!ret)
return 0;
- gf_log (this->name, GF_LOG_ERROR,
- "%s: failed to create a new synctask",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_REBALANCE_START_FAILED,
+ "%s: failed to create a new rebalance synctask",
loc->path);
}
op_errno = EINVAL;
@@ -2665,9 +2749,10 @@ dht_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
if (op_ret == -1) {
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name,
+ strerror (op_errno));
goto unlock;
}
@@ -2696,7 +2781,6 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
dht_layout_t *layout = NULL;
int call_cnt = 0;
dht_conf_t *conf = NULL;
-
int i;
VALIDATE_OR_GOTO (this, err);
@@ -2718,16 +2802,17 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
layout = local->layout;
if (!local->layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no layout for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no layout for path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
@@ -2781,17 +2866,18 @@ dht_fremovexattr (call_frame_t *frame, xlator_t *this,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for inode=%s",
- uuid_utoa (fd->inode->gfid));
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for inode=%s",
+ uuid_utoa (fd->inode->gfid));
op_errno = EINVAL;
goto err;
}
layout = local->layout;
if (!local->layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no layout for inode=%s", uuid_utoa (fd->inode->gfid));
+ gf_msg_debug (this->name, 0,
+ "no layout for inode=%s",
+ uuid_utoa (fd->inode->gfid));
op_errno = EINVAL;
goto err;
}
@@ -2831,9 +2917,9 @@ dht_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
if (op_ret == -1) {
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto unlock;
}
@@ -2984,8 +3070,9 @@ dht_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
subvol = dht_subvol_get_cached (this, loc->inode);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
@@ -3155,7 +3242,8 @@ list:
ret = dht_layout_preset (this, prev->this,
orig_entry->inode);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_LAYOUT_SET_FAILED,
"failed to link the layout in inode");
entry->inode = inode_ref (orig_entry->inode);
} else if (orig_entry->inode) {
@@ -3197,8 +3285,11 @@ done:
ret = dict_set_int32 (local->xattr,
GF_READDIR_SKIP_DIRS, 1);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
- "dict set failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value"
+ ":key = %s",
+ GF_READDIR_SKIP_DIRS );
} else {
dict_del (local->xattr,
GF_READDIR_SKIP_DIRS);
@@ -3261,8 +3352,9 @@ 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_log (this->name, GF_LOG_ERROR,
- "memory allocation failed :(");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_NO_MEMORY,
+ "Memory allocation failed ");
goto unwind;
}
@@ -3363,17 +3455,24 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
ret = dict_set_uint32 (local->xattr,
conf->link_xattr_name, 256);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "failed to set '%s' key",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value"
+ " : key = %s",
conf->link_xattr_name);
+
if (conf->readdir_optimize == _gf_true) {
if (xvol != local->first_up_subvol) {
ret = dict_set_int32 (local->xattr,
GF_READDIR_SKIP_DIRS, 1);
if (ret)
- gf_log (this->name,
- GF_LOG_ERROR,
- "Dict set failed");
+ gf_msg (this->name,
+ GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set "
+ "dictionary value: "
+ "key = %s",
+ GF_READDIR_SKIP_DIRS);
} else {
dict_del (local->xattr,
GF_READDIR_SKIP_DIRS);
@@ -3539,9 +3638,9 @@ dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dht_layout_preset (this, prev, inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "could not set pre-set layout for subvolume %s",
- prev? prev->name: NULL);
+ gf_msg_debug (this->name, 0,
+ "could not set pre-set layout for subvolume %s",
+ prev? prev->name: NULL);
op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -3619,16 +3718,17 @@ dht_mknod (call_frame_t *frame, xlator_t *this,
subvol = dht_subvol_get_hashed (this, loc);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ loc->path);
op_errno = ENOENT;
goto err;
}
if (!dht_is_subvol_filled (this, subvol)) {
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path,
+ subvol->name);
STACK_WIND_COOKIE (frame, dht_newfile_cbk, (void *)subvol,
subvol, subvol->fops->mknod, loc, mode,
@@ -3650,8 +3750,9 @@ dht_mknod (call_frame_t *frame, xlator_t *this,
dht_mknod_linkfile_create_cbk,
this, avail_subvol, subvol, loc);
} else {
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path,
+ subvol->name);
STACK_WIND_COOKIE (frame, dht_newfile_cbk,
(void *)subvol, subvol,
@@ -3691,15 +3792,15 @@ dht_symlink (call_frame_t *frame, xlator_t *this,
subvol = dht_subvol_get_hashed (this, loc);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ loc->path);
op_errno = ENOENT;
goto err;
}
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path, subvol->name);
STACK_WIND_COOKIE (frame, dht_newfile_cbk, (void *)subvol, subvol,
subvol->fops->symlink, linkname, loc, umask,
@@ -3751,15 +3852,15 @@ dht_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
/* Dont fail unlink if hashed_subvol is NULL which can be the result
* of layout anomaly */
if (!hashed_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ loc->path);
}
cached_subvol = local->cached_subvol;
if (!cached_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
@@ -3803,9 +3904,9 @@ dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
layout = dht_layout_for_subvol (this, prev->this);
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no pre-set layout for subvolume %s",
- prev->this->name);
+ gf_msg_debug (this->name, 0,
+ "no pre-set layout for subvolume %s",
+ prev->this->name);
op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -3884,17 +3985,18 @@ dht_link (call_frame_t *frame, xlator_t *this,
cached_subvol = local->cached_subvol;
if (!cached_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", oldloc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s",
+ oldloc->path);
op_errno = ENOENT;
goto err;
}
hashed_subvol = dht_subvol_get_hashed (this, newloc);
if (!hashed_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- newloc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ newloc->path);
op_errno = ENOENT;
goto err;
}
@@ -3957,9 +4059,9 @@ dht_create_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_DEBUG,
- "could not set preset layout for subvol %s",
- prev->this->name);
+ gf_msg_debug (this->name, 0,
+ "could not set preset layout for subvol %s",
+ prev->this->name);
op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -4040,16 +4142,17 @@ dht_create (call_frame_t *frame, xlator_t *this,
subvol = dht_subvol_get_hashed (this, loc);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ loc->path);
op_errno = ENOENT;
goto err;
}
if (!dht_is_subvol_filled (this, subvol)) {
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path,
+ subvol->name);
STACK_WIND (frame, dht_create_cbk,
subvol, subvol->fops->create,
loc, flags, mode, umask, fd, params);
@@ -4065,15 +4168,15 @@ dht_create (call_frame_t *frame, xlator_t *this,
local->umask = umask;
local->cached_subvol = avail_subvol;
local->hashed_subvol = subvol;
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s (link at %s)", loc->path,
- avail_subvol->name, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s (link at %s)", loc->path,
+ avail_subvol->name, subvol->name);
dht_linkfile_create (frame, dht_create_linkfile_create_cbk,
this, avail_subvol, subvol, loc);
goto done;
}
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path, subvol->name);
STACK_WIND (frame, dht_create_cbk,
subvol, subvol->fops->create,
loc, flags, mode, umask, fd, params);
@@ -4155,8 +4258,10 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
op_ret, op_errno, NULL);
}
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to merge layouts", local->loc.path);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_LAYOUT_MERGE_FAILED,
+ "%s: failed to merge layouts for subvol %s",
+ local->loc.path, prev->this->name);
if (op_ret == -1) {
local->op_errno = op_errno;
@@ -4215,8 +4320,10 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie,
/* TODO: we may have to return from the function
if layout merge fails. For now, lets just log an error */
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to merge layouts", local->loc.path);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_LAYOUT_MERGE_FAILED,
+ "%s: failed to merge layouts for subvol %s",
+ local->loc.path, prev->this->name);
if (op_ret == -1) {
local->op_errno = op_errno;
@@ -4281,9 +4388,9 @@ dht_mkdir (call_frame_t *frame, xlator_t *this,
hashed_subvol = dht_subvol_get_hashed (this, loc);
if (hashed_subvol == NULL) {
- gf_log (this->name, GF_LOG_DEBUG,
- "hashed subvol not found for %s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "hashed subvol not found for %s",
+ loc->path);
op_errno = ENOENT;
goto err;
}
@@ -4339,10 +4446,13 @@ dht_rmdir_hashed_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_local_t *local = NULL;
int this_call_cnt = 0;
call_frame_t *prev = NULL;
+ char gfid[GF_UUID_BUF_SIZE] ={0};
local = frame->local;
prev = cookie;
+ uuid_unparse(local->loc.gfid, gfid);
+
LOCK (&frame->lock);
{
if (op_ret == -1) {
@@ -4353,10 +4463,11 @@ dht_rmdir_hashed_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
- gf_log (this->name, GF_LOG_DEBUG,
- "rmdir on %s for %s failed (%s)",
- prev->this->name, local->loc.path,
- strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "rmdir on %s for %s failed "
+ "(gfid = %s) (%s)",
+ prev->this->name, local->loc.path,
+ gfid, strerror (op_errno));
goto unlock;
}
@@ -4413,10 +4524,12 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int this_call_cnt = 0;
call_frame_t *prev = NULL;
int done = 0;
+ char gfid[GF_UUID_BUF_SIZE] ={0};
local = frame->local;
prev = cookie;
+
LOCK (&frame->lock);
{
if (op_ret == -1) {
@@ -4426,11 +4539,13 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_errno != ENOENT && op_errno != EACCES) {
local->need_selfheal = 1;
}
+ uuid_unparse(local->loc.gfid, gfid);
- gf_log (this->name, GF_LOG_DEBUG,
- "rmdir on %s for %s failed (%s)",
- prev->this->name, local->loc.path,
- strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "rmdir on %s for %s failed."
+ "(gfid = %s) (%s)",
+ prev->this->name, local->loc.path,
+ gfid, strerror (op_errno));
goto unlock;
}
@@ -4507,6 +4622,7 @@ dht_rmdir_do (call_frame_t *frame, xlator_t *this)
dht_conf_t *conf = NULL;
int i = 0;
xlator_t *hashed_subvol = NULL;
+ char gfid[GF_UUID_BUF_SIZE] ={0};
VALIDATE_OR_GOTO (this->private, err);
@@ -4518,12 +4634,17 @@ dht_rmdir_do (call_frame_t *frame, xlator_t *this)
local->call_cnt = conf->subvolume_cnt;
+
/* first remove from non-hashed_subvol */
hashed_subvol = dht_subvol_get_hashed (this, &local->loc);
if (!hashed_subvol) {
- gf_log (this->name, GF_LOG_WARNING, "failed to get hashed "
- "subvol for %s",local->loc.path);
+ uuid_unparse(local->loc.gfid, gfid);
+
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_HASHED_SUBVOL_GET_FAILED,
+ "Failed to get hashed subvol for %s (gfid = %s)",
+ local->loc.path, gfid);
} else {
local->hashed_subvol = hashed_subvol;
}
@@ -4568,6 +4689,8 @@ dht_rmdir_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this
call_frame_t *main_frame = NULL;
dht_local_t *main_local = NULL;
int this_call_cnt = 0;
+ char gfid[GF_UUID_BUF_SIZE] ={0};
+
local = frame->local;
prev = cookie;
@@ -4576,16 +4699,19 @@ dht_rmdir_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this
main_frame = local->main_frame;
main_local = main_frame->local;
+ uuid_unparse(local->loc.gfid, gfid);
+
if (op_ret == 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "unlinked linkfile %s on %s",
- local->loc.path, src->name);
+ gf_msg_trace (this->name, 0,
+ "Unlinked linkfile %s on %s, gfid = %s",
+ local->loc.path, src->name, gfid);
} else {
main_local->op_ret = -1;
main_local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "unlink of %s on %s failed (%s)",
- local->loc.path, src->name, strerror (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));
}
this_call_cnt = dht_frame_return (main_frame);
@@ -4609,6 +4735,7 @@ dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_local_t *main_local = NULL;
int this_call_cnt = 0;
dht_conf_t *conf = this->private;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
prev = cookie;
@@ -4624,9 +4751,11 @@ dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
main_local->op_ret = -1;
main_local->op_errno = ENOTEMPTY;
+ uuid_unparse(local->loc.gfid, gfid);
+
gf_log (this->name, GF_LOG_WARNING,
- "%s on %s found to be not a linkfile (type=0%o)",
- local->loc.path, src->name, stbuf->ia_type);
+ "%s on %s is not a linkfile (type=0%o, gfid = %s)",
+ local->loc.path, src->name, stbuf->ia_type, gfid);
goto err;
}
@@ -4687,8 +4816,10 @@ dht_rmdir_cached_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dict_set_uint32 (xattrs, conf->link_xattr_name, 256);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "failed to set linkto key"
- " in dict");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value: key = %s",
+ conf->link_xattr_name);
if (xattrs)
dict_unref (xattrs);
goto err;
@@ -4724,6 +4855,7 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,
dict_t *xattrs = NULL;
dht_conf_t *conf = this->private;
xlator_t *subvol = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
@@ -4753,8 +4885,11 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,
ret = dict_set_uint32 (xattrs, conf->link_xattr_name, 256);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "failed to set linkto key"
- " in dict");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value: key = %s",
+ conf->link_xattr_name);
+
if (xattrs)
dict_unref (xattrs);
return -1;
@@ -4792,9 +4927,11 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,
uuid_copy (lookup_local->loc.gfid, trav->d_stat.ia_gfid);
- gf_log (this->name, GF_LOG_TRACE,
- "looking up %s on %s",
- lookup_local->loc.path, src->name);
+ uuid_unparse(lookup_local->loc.gfid, gfid);
+
+ gf_msg_trace (this->name, 0,
+ "looking up %s on subvolume %s, gfid = %s",
+ lookup_local->loc.path, src->name, gfid);
LOCK (&frame->lock);
{
@@ -4806,8 +4943,9 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,
trav->dict);
if (!subvol) {
gf_log (this->name, GF_LOG_INFO,
- "linkfile not having link subvolume. path=%s",
- lookup_local->loc.path);
+ "Linkfile does not have link subvolume. "
+ "path = %s, gfid = %s",
+ lookup_local->loc.path, gfid);
STACK_WIND (lookup_frame, dht_rmdir_lookup_cbk,
src, src->fops->lookup,
&lookup_local->loc, xattrs);
@@ -4852,17 +4990,19 @@ dht_rmdir_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
switch (ret) {
case 0: /* non linkfiles exist */
- gf_log (this->name, GF_LOG_TRACE,
- "readdir on %s for %s returned %d entries",
- prev->this->name, local->loc.path, op_ret);
+ gf_msg_trace (this->name, 0,
+ "readdir on %s for %s returned %d "
+ "entries", prev->this->name,
+ local->loc.path, op_ret);
local->op_ret = -1;
local->op_errno = ENOTEMPTY;
break;
default:
/* @ret number of linkfiles are getting unlinked */
- gf_log (this->name, GF_LOG_TRACE,
- "readdir on %s for %s found %d linkfiles",
- prev->this->name, local->loc.path, ret);
+ gf_msg_trace (this->name, 0,
+ "readdir on %s for %s found %d "
+ "linkfiles", prev->this->name,
+ local->loc.path, ret);
break;
}
}
@@ -4888,16 +5028,21 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int ret = 0;
dht_conf_t *conf = this->private;
int i = 0;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
prev = cookie;
+
this_call_cnt = dht_frame_return (frame);
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "opendir on %s for %s failed (%s)",
- prev->this->name, local->loc.path,
- strerror (op_errno));
+ uuid_unparse(local->loc.gfid, gfid);
+
+ gf_msg_debug (this->name, 0,
+ "opendir on %s for %s failed, "
+ "gfid = %s, (%s)",
+ prev->this->name, local->loc.path, gfid,
+ strerror (op_errno));
if (op_errno != ENOENT) {
local->op_ret = -1;
local->op_errno = op_errno;
@@ -4920,8 +5065,9 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dict_set_uint32 (dict, conf->link_xattr_name, 256);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to set '%s' key",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value:key = %s",
local->loc.path, conf->link_xattr_name);
local->call_cnt = conf->subvolume_cnt;
@@ -5018,6 +5164,7 @@ dht_entrylk (call_frame_t *frame, xlator_t *this,
xlator_t *subvol = NULL;
int op_errno = -1;
dht_local_t *local = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
VALIDATE_OR_GOTO (frame, err);
VALIDATE_OR_GOTO (this, err);
@@ -5030,10 +5177,14 @@ dht_entrylk (call_frame_t *frame, xlator_t *this,
goto err;
}
+
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ uuid_unparse(loc->gfid, gfid);
+
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s, "
+ "gfid = %s", loc->path, gfid);
op_errno = EINVAL;
goto err;
}
@@ -5071,15 +5222,21 @@ dht_fentrylk (call_frame_t *frame, xlator_t *this,
{
xlator_t *subvol = NULL;
int op_errno = -1;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
+
VALIDATE_OR_GOTO (frame, err);
VALIDATE_OR_GOTO (this, err);
VALIDATE_OR_GOTO (fd, err);
+ VALIDATE_OR_GOTO(fd->inode, err);
+
+ uuid_unparse(fd->inode->gfid, gfid);
subvol = dht_subvol_get_cached (this, fd->inode);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "No cached subvolume for fd=%p,"
+ " gfid = %s", fd, gfid);
op_errno = EINVAL;
goto err;
}
@@ -5167,9 +5324,10 @@ dht_notify (xlator_t *this, int event, void *data, ...)
}
if (cnt == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "got GF_EVENT_CHILD_UP bad subvolume %s",
- subvol->name);
+ gf_msg_debug (this->name, 0,
+ "got GF_EVENT_CHILD_UP bad "
+ "subvolume %s",
+ subvol->name);
break;
}
@@ -5217,9 +5375,9 @@ dht_notify (xlator_t *this, int event, void *data, ...)
}
if (cnt == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "got GF_EVENT_CHILD_DOWN bad subvolume %s",
- subvol->name);
+ gf_msg_debug (this->name, 0,
+ "got GF_EVENT_CHILD_DOWN bad "
+ "subvolume %s", subvol->name);
break;
}
@@ -5244,9 +5402,10 @@ dht_notify (xlator_t *this, int event, void *data, ...)
}
if (cnt == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "got GF_EVENT_CHILD_CONNECTING bad subvolume %s",
- subvol->name);
+ gf_msg_debug (this->name, 0,
+ "got GF_EVENT_CHILD_CONNECTING"
+ " bad subvolume %s",
+ subvol->name);
break;
}
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index b61a1e9a319..6fa5b91d97d 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -17,6 +17,7 @@
#include <signal.h>
#include "dht-mem-types.h"
+#include "dht-messages.h"
#include "libxlator.h"
#include "syncop.h"
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c
index d035aca2665..8664f550ba2 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -19,6 +19,7 @@
#include "glusterfs.h"
#include "xlator.h"
#include "dht-common.h"
+#include "dht-messages.h"
#include "defaults.h"
#include <sys/time.h>
@@ -70,14 +71,15 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
conf->du_stats[i].avail_percent = percent;
conf->du_stats[i].avail_space = bytes;
conf->du_stats[i].avail_inodes = percent_inodes;
- gf_log (this->name, GF_LOG_DEBUG,
- "on subvolume '%s': avail_percent is: "
- "%.2f and avail_space is: %"PRIu64" "
- "and avail_inodes is: %.2f",
- prev->this->name,
- conf->du_stats[i].avail_percent,
- conf->du_stats[i].avail_space,
- conf->du_stats[i].avail_inodes);
+ gf_msg_debug (this->name, 0,
+ "subvolume '%s': avail_percent "
+ "is: %.2f and avail_space "
+ "is: %" PRIu64" and avail_inodes"
+ " is: %.2f",
+ prev->this->name,
+ conf->du_stats[i].avail_percent,
+ conf->du_stats[i].avail_space,
+ conf->du_stats[i].avail_inodes);
}
}
UNLOCK (&conf->subvolume_lock);
@@ -239,7 +241,8 @@ dht_is_subvol_filled (xlator_t *this, xlator_t *subvol)
if (subvol_filled_space && conf->subvolume_status[i]) {
if (!(conf->du_stats[i].log++ % (GF_UNIVERSAL_ANSWER * 10))) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_SUBVOL_INSUFF_SPACE,
"disk space on subvolume '%s' is getting "
"full (%.2f %%), consider adding more nodes",
subvol->name,
@@ -249,7 +252,8 @@ dht_is_subvol_filled (xlator_t *this, xlator_t *subvol)
if (subvol_filled_inodes && conf->subvolume_status[i]) {
if (!(conf->du_stats[i].log++ % (GF_UNIVERSAL_ANSWER * 10))) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ DHT_MSG_SUBVOL_INSUFF_INODES,
"inodes on subvolume '%s' are at "
"(%.2f %%), consider adding more nodes",
subvol->name,
@@ -281,9 +285,10 @@ dht_free_disk_available_subvol (xlator_t *this, xlator_t *subvol,
layout = dht_layout_get (this, loc->parent);
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "layout missing path=%s parent=%s",
- loc->path, uuid_utoa (loc->parent->gfid));
+ gf_msg_debug (this->name, 0,
+ "Missing layout. path=%s,"
+ " parent gfid = %s", loc->path,
+ uuid_utoa (loc->parent->gfid));
goto out;
}
} else {
@@ -305,10 +310,9 @@ dht_free_disk_available_subvol (xlator_t *this, xlator_t *subvol,
UNLOCK (&conf->subvolume_lock);
out:
if (!avail_subvol) {
- gf_log (this->name,
- GF_LOG_DEBUG,
- "no subvolume has enough free space and/or inodes\
- to create");
+ gf_msg_debug (this->name, 0,
+ "No subvolume has enough free space \
+ and/or inodes to create");
avail_subvol = subvol;
}
diff --git a/xlators/cluster/dht/src/dht-hashfn.c b/xlators/cluster/dht/src/dht-hashfn.c
index 656cf23a058..72b3df022da 100644
--- a/xlators/cluster/dht/src/dht-hashfn.c
+++ b/xlators/cluster/dht/src/dht-hashfn.c
@@ -94,12 +94,12 @@ dht_hash_compute (xlator_t *this, int type, const char *name, uint32_t *hash_p)
if (!munged && priv->rsync_regex_valid) {
len = strlen(name) + 1;
rsync_friendly_name = alloca(len);
- gf_log (this->name, GF_LOG_TRACE, "trying regex for %s", name);
+ gf_msg_trace (this->name, 0, "trying regex for %s", name);
munged = dht_munge_name (name, rsync_friendly_name, len,
&priv->rsync_regex);
if (munged) {
- gf_log (this->name, GF_LOG_DEBUG,
- "munged down to %s", rsync_friendly_name);
+ gf_msg_debug (this->name, 0,
+ "munged down to %s", rsync_friendly_name);
}
}
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 58af04db392..7f0748a07cc 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -440,18 +440,18 @@ dht_subvol_get_hashed (xlator_t *this, loc_t *loc)
layout = dht_layout_get (this, loc->parent);
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "layout missing path=%s parent=%s",
- loc->path, uuid_utoa (loc->parent->gfid));
+ gf_msg_debug (this->name, 0,
+ "Missing layout. path=%s, parent gfid =%s",
+ loc->path, uuid_utoa (loc->parent->gfid));
goto out;
}
subvol = dht_layout_search (this, layout, loc->name);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "could not find subvolume for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "No hashed subvolume for path=%s",
+ loc->path);
goto out;
}
@@ -816,7 +816,8 @@ dht_migration_complete_check_task (void *data)
}
if (uuid_compare (stbuf.ia_gfid, local->loc.inode->gfid)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_GFID_MISMATCH,
"%s: gfid different on the target file on %s",
local->loc.path, dst_node->name);
ret = -1;
@@ -830,9 +831,10 @@ dht_migration_complete_check_task (void *data)
ret = dht_layout_preset (this, dst_node, inode);
if (ret != 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "%s: could not set preset layout for subvol %s",
- local->loc.path, dst_node->name);
+ gf_msg_debug (this->name, 0,
+ "%s: could not set preset layout "
+ "for subvol %s", local->loc.path,
+ dst_node->name);
ret = -1;
local->op_errno = EINVAL;
goto out;
@@ -1011,7 +1013,8 @@ dht_rebalance_inprogress_task (void *data)
}
if (uuid_compare (stbuf.ia_gfid, local->loc.inode->gfid)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_GFID_MISMATCH,
"%s: gfid different on the target file on %s",
local->loc.path, dst_node->name);
ret = -1;
diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c
index e8a9a7196bf..aac402a2a42 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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -105,8 +105,8 @@ dht_open (call_frame_t *frame, xlator_t *this,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -146,9 +146,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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -233,9 +233,10 @@ dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
if (op_ret == -1) {
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name,
+ strerror (op_errno));
goto unlock;
}
@@ -281,8 +282,8 @@ dht_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no layout for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no layout for path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
@@ -341,8 +342,8 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no layout for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no layout for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -475,8 +476,8 @@ dht_readv (call_frame_t *frame, xlator_t *this,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -598,8 +599,9 @@ dht_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
local->call_cnt = 1;
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
@@ -686,8 +688,8 @@ dht_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -723,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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -854,8 +856,8 @@ dht_lk (call_frame_t *frame, xlator_t *this,
subvol = dht_subvol_get_cached (this, fd->inode);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -920,8 +922,8 @@ dht_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
@@ -974,8 +976,9 @@ dht_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
@@ -1019,8 +1022,8 @@ dht_fxattrop (call_frame_t *frame, xlator_t *this,
subvol = dht_subvol_get_cached (this, fd->inode);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -1073,8 +1076,9 @@ dht_inodelk (call_frame_t *frame, xlator_t *this, const char *volume,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
@@ -1119,8 +1123,8 @@ dht_finodelk (call_frame_t *frame, xlator_t *this, const char *volume,
subvol = dht_subvol_get_cached (this, fd->inode);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c
index 576f007e513..2bfd80af3cd 100644
--- a/xlators/cluster/dht/src/dht-inode-write.c
+++ b/xlators/cluster/dht/src/dht-inode-write.c
@@ -133,8 +133,8 @@ dht_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -184,9 +184,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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -288,8 +288,8 @@ dht_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
local->call_cnt = 1;
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
@@ -329,8 +329,8 @@ dht_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
local->call_cnt = 1;
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -370,9 +370,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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -463,8 +463,8 @@ dht_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
local->call_cnt = 1;
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -504,9 +504,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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -596,8 +596,8 @@ dht_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
local->call_cnt = 1;
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -634,9 +634,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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -729,8 +729,8 @@ dht_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
local->call_cnt = 1;
subvol = local->cached_subvol;
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no cached subvolume for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
@@ -764,9 +764,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_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto out;
}
@@ -847,9 +847,9 @@ dht_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
if (op_ret == -1) {
local->op_errno = op_errno;
- gf_log (this->name, GF_LOG_DEBUG,
- "subvolume %s returned -1 (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
goto unlock;
}
@@ -899,15 +899,15 @@ dht_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no layout for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no layout for path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
if (!layout_is_sane (layout)) {
- gf_log (this->name, GF_LOG_DEBUG,
- "layout is not sane for path=%s", loc->path);
+ gf_msg_debug (this->name, 0,
+ "layout is not sane for path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
@@ -970,15 +970,15 @@ dht_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf,
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no layout for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "no layout for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
if (!layout_is_sane (layout)) {
- gf_log (this->name, GF_LOG_DEBUG,
- "layout is not sane for fd=%p", fd);
+ gf_msg_debug (this->name, 0,
+ "layout is not sane for fd=%p", fd);
op_errno = EINVAL;
goto err;
}
diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c
index e1a37b77cda..82127adf6e5 100644
--- a/xlators/cluster/dht/src/dht-layout.c
+++ b/xlators/cluster/dht/src/dht-layout.c
@@ -18,6 +18,8 @@
#include "xlator.h"
#include "dht-common.h"
#include "byte-order.h"
+#include "dht-messages.h"
+
#define layout_base_size (sizeof (dht_layout_t))
@@ -284,7 +286,8 @@ dht_disk_layout_merge (xlator_t *this, dht_layout_t *layout,
int disk_layout[4];
if (!disk_layout_raw) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ DHT_MSG_LAYOUT_MERGE_FAILED,
"error no layout on disk for merge");
return -1;
}
@@ -295,22 +298,25 @@ dht_disk_layout_merge (xlator_t *this, dht_layout_t *layout,
cnt = ntoh32 (disk_layout[0]);
if (cnt != 1) {
- gf_log (this->name, GF_LOG_ERROR,
- "disk layout has invalid count %d", cnt);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_DISK_LAYOUT,
+ "Invalid disk layout: Invalid count %d", cnt);
return -1;
}
type = ntoh32 (disk_layout[1]);
switch (type) {
case DHT_HASH_TYPE_DM_USER:
- gf_log (this->name, GF_LOG_DEBUG, "found user-set layout");
+ gf_msg_debug (this->name, 0, "found user-set layout");
layout->type = type;
/* Fall through. */
case DHT_HASH_TYPE_DM:
break;
default:
- gf_log (this->name, GF_LOG_CRITICAL,
- "Catastrophic error layout with unknown type found %d",
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ DHT_MSG_INVALID_DISK_LAYOUT,
+ "Invalid disk layout: "
+ "Catastrophic error layout with unknown type found %d",
disk_layout[1]);
return -1;
}
@@ -321,10 +327,10 @@ dht_disk_layout_merge (xlator_t *this, dht_layout_t *layout,
layout->list[pos].start = start_off;
layout->list[pos].stop = stop_off;
- gf_log (this->name, GF_LOG_TRACE,
- "merged to layout: %u - %u (type %d) from %s",
- start_off, stop_off, type,
- layout->list[pos].xlator->name);
+ gf_msg_trace (this->name, 0,
+ "merged to layout: %u - %u (type %d) from %s",
+ start_off, stop_off, type,
+ layout->list[pos].xlator->name);
return 0;
}
@@ -366,9 +372,9 @@ dht_layout_merge (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
if (ret != 0) {
layout->list[i].err = 0;
- gf_log (this->name, GF_LOG_TRACE,
- "missing disk layout on %s. err = %d",
- subvol->name, err);
+ gf_msg_trace (this->name, 0,
+ "Missing disk layout on %s. err = %d",
+ subvol->name, err);
ret = 0;
goto out;
}
@@ -376,7 +382,8 @@ dht_layout_merge (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
ret = dht_disk_layout_merge (this, layout, i, disk_layout_raw,
disk_layout_len);
if (ret != 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_LAYOUT_MERGE_FAILED,
"layout merge from subvolume %s failed",
subvol->name);
goto out;
@@ -624,6 +631,7 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)
uint32_t missing = 0;
uint32_t down = 0;
uint32_t misc = 0;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
ret = dht_layout_sort (layout);
if (ret == -1) {
@@ -632,25 +640,28 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)
goto out;
}
+ uuid_unparse(loc->gfid, gfid);
+
ret = dht_layout_anomalies (this, loc, layout,
&holes, &overlaps,
&missing, &down, &misc, NULL);
if (ret == -1) {
gf_log (this->name, GF_LOG_WARNING,
- "error while finding anomalies in %s -- not good news",
- loc->path);
+ "Error finding anomalies in %s, gfid = %s",
+ loc->path, gfid);
goto out;
}
if (holes || overlaps) {
if (missing == layout->cnt) {
- gf_log (this->name, GF_LOG_DEBUG,
- "directory %s looked up first time",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "Directory %s looked up first time"
+ " gfid = %s", loc->path, gfid);
} else {
gf_log (this->name, GF_LOG_INFO,
- "found anomalies in %s. holes=%d overlaps=%d",
- loc->path, holes, overlaps);
+ "Found anomalies in %s (gfid = %s). "
+ "Holes=%d overlaps=%d",
+ loc->path, gfid, holes, overlaps );
}
ret = -1;
}
@@ -702,7 +713,10 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
uint32_t start_off = -1;
uint32_t stop_off = -1;
dht_conf_t *conf = this->private;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
+ if(loc && loc->inode)
+ uuid_unparse(loc->inode->gfid, gfid);
for (idx = 0; idx < layout->cnt; idx++) {
if (layout->list[idx].xlator == subvol) {
@@ -712,9 +726,9 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
}
if (pos == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "%s - no layout info for subvolume %s",
- loc->path, subvol->name);
+ gf_msg_debug (this->name, 0,
+ "%s - no layout info for subvolume %s",
+ loc->path, subvol->name);
ret = 1;
goto out;
}
@@ -724,7 +738,7 @@ 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",
+ "%s: xattr dictionary is NULL",
loc->path);
ret = -1;
}
@@ -737,7 +751,8 @@ 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", loc->path);
+ "%s: Disk layout missing, gfid = %s",
+ loc->path, gfid);
ret = -1;
}
goto out;
@@ -747,9 +762,10 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
count = ntoh32 (disk_layout[0]);
if (count != 1) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s - disk layout has invalid count %d",
- loc->path, count);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_DISK_LAYOUT,
+ "Invalid disk layout: invalid count %d,"
+ "path = %s, gfid = %s ", count, loc->path, gfid);
ret = -1;
goto out;
}
diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
index dbc9d0b3c7b..3daa3c60713 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -18,6 +18,7 @@
#include "xlator.h"
#include "compat.h"
#include "dht-common.h"
+#include "dht-messages.h"
int
dht_linkfile_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -29,6 +30,7 @@ dht_linkfile_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_conf_t *conf = NULL;
dht_local_t *local = NULL;
call_frame_t *prev = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
prev = cookie;
@@ -37,11 +39,14 @@ dht_linkfile_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret)
goto out;
+ uuid_unparse(local->loc.gfid, gfid);
+
is_linkfile = check_is_linkfile (inode, stbuf, xattr,
conf->link_xattr_name);
if (!is_linkfile)
- gf_log (this->name, GF_LOG_WARNING, "got non-linkfile %s:%s",
- prev->this->name, local->loc.path);
+ gf_log (this->name, GF_LOG_WARNING,
+ "got non-linkfile %s:%s, gfid = %s",
+ prev->this->name, local->loc.path, gfid);
out:
local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno,
inode, stbuf, postparent, postparent,
@@ -49,7 +54,7 @@ out:
return 0;
}
-#define is_equal(a, b) (a == b)
+#define is_equal(a, b) ((a) == (b))
int
dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, inode_t *inode,
@@ -81,8 +86,10 @@ dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
ret = dict_set_uint32 (xattrs, conf->link_xattr_name, 256);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Failed to set linkto key");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value. key : %s",
+ conf->link_xattr_name);
goto out;
}
@@ -112,6 +119,7 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
int need_unref = 0;
int ret = 0;
dht_conf_t *conf = this->private;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
local->linkfile.linkfile_cbk = linkfile_cbk;
@@ -127,24 +135,35 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
need_unref = 1;
}
+
if (!uuid_is_null (local->gfid)) {
+ uuid_unparse(local->gfid, gfid);
+
ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16);
if (ret)
- gf_log ("dht-linkfile", GF_LOG_INFO,
- "%s: gfid set failed", loc->path);
+ gf_msg ("dht-linkfile", GF_LOG_INFO, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value: "
+ "key = gfid-req, gfid = %s ", loc->path, gfid);
+ } else {
+ uuid_unparse(loc->gfid, gfid);
}
ret = dict_set_str (dict, GLUSTERFS_INTERNAL_FOP_KEY, "yes");
if (ret)
- gf_log ("dht-linkfile", GF_LOG_INFO,
- "%s: internal-fop set failed", loc->path);
+ gf_msg ("dht-linkfile", GF_LOG_INFO, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value: key = %s,"
+ " gfid = %s", loc->path,
+ GLUSTERFS_INTERNAL_FOP_KEY, gfid);
ret = dict_set_str (dict, conf->link_xattr_name, tovol->name);
if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_INFO,
- "%s: failed to initialize linkfile data",
- loc->path);
+ gf_msg (frame->this->name, GF_LOG_INFO, 0,
+ DHT_MSG_CREATE_LINK_FAILED,
+ "%s: failed to initialize linkfile data, gfid = %s",
+ loc->path, gfid);
goto out;
}
@@ -180,15 +199,21 @@ dht_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_local_t *local = NULL;
call_frame_t *prev = NULL;
xlator_t *subvol = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
prev = cookie;
subvol = prev->this;
+
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_INFO,
- "unlinking linkfile %s on %s failed (%s)",
- local->loc.path, subvol->name, strerror (op_errno));
+
+ uuid_unparse(local->loc.gfid, gfid);
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ DHT_MSG_UNLINK_FAILED,
+ "Unlinking linkfile %s (gfid = %s)on "
+ "subvolume %s failed ",
+ local->loc.path, gfid, subvol->name);
}
DHT_STACK_DESTROY (frame);
@@ -272,10 +297,12 @@ dht_linkfile_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
loc = &local->loc;
if (op_ret)
- gf_log (this->name, GF_LOG_ERROR, "setattr of uid/gid on %s"
- " :<gfid:%s> failed (%s)",
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ DHT_MSG_SETATTR_FAILED,
+ "Failed to set attr uid/gid on %s"
+ " :<gfid:%s> ",
(loc->path? loc->path: "NULL"),
- uuid_utoa(local->gfid), strerror(op_errno));
+ uuid_utoa(local->gfid));
DHT_STACK_DESTROY (frame);
diff --git a/xlators/cluster/dht/src/dht-messages.h b/xlators/cluster/dht/src/dht-messages.h
new file mode 100644
index 00000000000..7668e91ac99
--- /dev/null
+++ b/xlators/cluster/dht/src/dht-messages.h
@@ -0,0 +1,443 @@
+/*Copyright (c) 2013 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
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+
+#ifndef _DHT_MESSAGES_H_
+#define _DHT_MESSAGES_H_
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "glfs-message-id.h"
+
+/*! \file dht-messages.h
+ * \brief DHT log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ * if the message format is the same. Reasoning is that, if the message
+ * format needs to change in one instance, the other instances are not
+ * impacted or the new change does not change the ID of the instance being
+ * modified.
+ * 2) Addition of a message,
+ * - Should increment the GLFS_NUM_MESSAGES
+ * - Append to the list of messages defined, towards the end
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ * anywhere. If reused then then the modifications should ensure correctness
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
+ * not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ * anywhere, then can be deleted, but will leave a hole by design, as
+ * addition rules specify modification to the end of the list and not filling
+ * holes.
+ */
+
+#define GLFS_DHT_BASE GLFS_MSGID_COMP_DHT
+#define GLFS_DHT_NUM_MESSAGES 35
+#define GLFS_MSGID_END (GLFS_DHT_BASE + GLFS_DHT_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_DHT_BASE, "Invalid: Start of messages"
+
+
+
+
+/*!
+ * @messageid 109001
+ * @diagnosis Cached subvolume could not be found for the specified
+ * path
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_CACHED_SUBVOL_GET_FAILED (GLFS_DHT_BASE + 1)
+
+/*!
+ * @messageid 109002
+ * @diagnosis Linkfile creation failed
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_CREATE_LINK_FAILED (GLFS_DHT_BASE + 2)
+
+/*!
+ * @messageid 109003
+ * @diagnosis The value could not be set for the specified key in
+ * the dictionary
+ *
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_DICT_SET_FAILED (GLFS_DHT_BASE + 3)
+
+/*!
+ * @messageid 109004
+ * @diagnosis Directory attributes could not be healed
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_DIR_ATTR_HEAL_FAILED (GLFS_DHT_BASE + 4)
+
+/*!
+ * @messageid 109005
+ * @diagnosis Self-heal failed for the specified directory
+ * @recommendedaction Ensure that all subvolumes are online
+ * and reachable and perform a lookup operation
+ * on the directory again.
+ *
+ */
+
+#define DHT_MSG_DIR_SELFHEAL_FAILED (GLFS_DHT_BASE + 5)
+
+/*!
+ * @messageid 109006
+ * @diagnosis The extended attributes could not be healed for
+ * the specified directory on the specified subvolume
+ *
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_DIR_SELFHEAL_XATTR_FAILED (GLFS_DHT_BASE + 6)
+
+/*!
+ * @messageid 109007
+ * @diagnosis A lookup operation found the file with the same path
+ * on multiple subvolumes.
+ * @recommendedaction
+ * 1. Create backups of the file on other subvolumes.
+ * 2. Inspect the content of the files to identify
+ * and retain the most appropriate file.
+ *
+ */
+
+#define DHT_MSG_FILE_ON_MULT_SUBVOL (GLFS_DHT_BASE + 7)
+
+/*!
+ * @messageid 109008
+ * @diagnosis A path resolves to a file on one subvolume and a directory
+ * on another
+ * @recommendedaction
+ * 1. Create a backup of the file with a different name
+ * and delete the original file.
+ * 2. In the newly created back up file, remove the "trusted.gfid"
+ * extended attribute.
+ * - Command: setfattr -x "trusted.gfid" \<path to the newly created backup file\>
+ * 3. Perform a new lookup operation on both the new and old paths.
+ * 4. From the mount point, inspect both the paths and retain the
+ * relevant file or directory.
+ *
+ */
+
+#define DHT_MSG_FILE_TYPE_MISMATCH (GLFS_DHT_BASE + 8)
+
+/*!
+ * @messageid 109009
+ * @diagnosis The GFID of the file/directory is different on different subvolumes
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_GFID_MISMATCH (GLFS_DHT_BASE + 9)
+
+/*!
+ * @messageid 109010
+ * @diagnosis The GFID of the specified file/directory is NULL.
+ * @recommendedaction None
+ *
+ */
+
+#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
+ *
+ */
+
+#define DHT_MSG_HASHED_SUBVOL_GET_FAILED (GLFS_DHT_BASE + 11)
+
+/*!
+ * @messageid 109012
+ * @diagnosis The Distributed Hash Table Translator could not be initiated as the
+ * system is out of memory.
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_INIT_FAILED (GLFS_DHT_BASE + 12)
+
+/*!
+ * @messageid 109013
+ * @diagnosis Invalid DHT configuration in the volfile
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_INVALID_CONFIGURATION (GLFS_DHT_BASE + 13)
+
+/*!
+ * @messageid 109014
+ * @diagnosis Invalid disk layout
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_INVALID_DISK_LAYOUT (GLFS_DHT_BASE + 14)
+
+/*!
+ * @messageid 109015
+ * @diagnosis Invalid DHT configuration option.
+ * @recommendedaction
+ * 1. Reset the option with a valid value using the volume
+ * set command.
+ * 2. Restart the process that logged the message in the
+ * log file.
+ *
+ */
+
+#define DHT_MSG_INVALID_OPTION (GLFS_DHT_BASE + 15)
+
+/*!
+ * @messageid 109016
+ * @diagnosis The fix layout operation failed
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_LAYOUT_FIX_FAILED (GLFS_DHT_BASE + 16)
+
+/*!
+ * @messageid 109017
+ * @diagnosis Layout merge failed
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_LAYOUT_MERGE_FAILED (GLFS_DHT_BASE + 17)
+
+/*!
+ * @messageid 109018
+ * @diagnosis The layout for the specified directory does not match
+ that on the disk.
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_LAYOUT_MISMATCH (GLFS_DHT_BASE + 18)
+
+/*!
+ * @messageid 109019
+ * @diagnosis No layout is present for the specified file/directory
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_LAYOUT_NULL (GLFS_DHT_BASE + 19)
+
+/*!
+ * @messageid 109020
+ * @diagnosis Informational message: Migration of data from the cached
+ * subvolume to the hashed subvolume is complete
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_MIGRATE_DATA_COMPLETE (GLFS_DHT_BASE + 20)
+
+/*!
+ * @messageid 109021
+ * @diagnosis Migration of data failed during the rebalance operation
+ * \n Cause: Directories could not be read to identify the files for the
+ * migration process.
+ * @recommendedaction
+ * The log message would indicate the reason for the failure and
+ * the corrective action depends on the specific error that is
+ * encountered. The error is one of the standard UNIX errors.
+ *
+ */
+
+#define DHT_MSG_MIGRATE_DATA_FAILED (GLFS_DHT_BASE + 21)
+
+/*!
+ * @messageid 109022
+ * @diagnosis Informational message: The file was migrated successfully during
+ * the rebalance operation.
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_MIGRATE_FILE_COMPLETE (GLFS_DHT_BASE + 22)
+
+/*!
+ * @messageid 109023
+ * @diagnosis File migration failed during the rebalance operation
+ * \n Cause: Rebalance moves data from the cached subvolume to
+ * the hashed subvolume. Migrating a single file is a multi-step operation
+ * which involves opening, reading, and writing the data and metadata.
+ * Any failures in this multi-step operation can result in a file
+ * migration failure.
+ * @recommendedaction The log message would indicate the reason for the failure and the
+ * corrective action depends on the specific error that is encountered.
+ * The error is one of the standard UNIX errors.
+ *
+ */
+
+#define DHT_MSG_MIGRATE_FILE_FAILED (GLFS_DHT_BASE + 23)
+
+/*!
+ * @messageid 109024
+ * @diagnosis Out of memory
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_NO_MEMORY (GLFS_DHT_BASE + 24)
+
+/*!
+ * @messageid 109025
+ * @diagnosis The opendir() call failed on the specified directory
+ * \n Cause: When a directory is renamed, the Distribute Hash
+ * table translator checks whether the destination directory
+ * is empty. This message indicates that the opendir() call
+ * on the destination directory has failed.
+ * @recommendedaction The log message would indicate the reason for the
+ * failure and the corrective action depends on the specific
+ * error that is encountered. The error is one of the standard
+ * UNIX errors.
+ *
+ */
+
+#define DHT_MSG_OPENDIR_FAILED (GLFS_DHT_BASE + 25)
+
+/*!
+ * @messageid 109026
+ * @diagnosis The rebalance operation failed.
+ * @recommendedaction Check the log file for details about the failure.
+ * Possible causes:
+ * - A subvolume is down: Restart the rebalance operation after
+ * bringing up all subvolumes.
+ *
+ */
+
+#define DHT_MSG_REBALANCE_FAILED (GLFS_DHT_BASE + 26)
+
+/*!
+ * @messageid 109027
+ * @diagnosis Failed to start the rebalance process.
+ * @recommendedaction Check the log file for details about the failure.
+ *
+ */
+
+#define DHT_MSG_REBALANCE_START_FAILED (GLFS_DHT_BASE + 27)
+
+/*!
+ * @messageid 109028
+ * @diagnosis Informational message that indicates the status of the
+ * rebalance operation and details as to how many files were
+ * migrated, skipped, failed etc
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_REBALANCE_STATUS (GLFS_DHT_BASE + 28)
+
+/*!
+ * @messageid 109029
+ * @diagnosis The rebalance operation was aborted by the user.
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_REBALANCE_STOPPED (GLFS_DHT_BASE + 29)
+
+/*!
+ * @messageid 109030
+ * @diagnosis The file or directory could not be renamed
+ * @recommendedaction Ensure that all the subvolumes are
+ * online and reachable and try renaming
+ * the file or directory again.
+ *
+ */
+
+#define DHT_MSG_RENAME_FAILED (GLFS_DHT_BASE + 30)
+
+/*!
+ * @messageid 109031
+ * @diagnosis Attributes could not be set for the specified file or
+ * directory.
+ * @recommendedaction None
+ *
+ */
+
+#define DHT_MSG_SETATTR_FAILED (GLFS_DHT_BASE + 31)
+
+/*!
+ * @messageid 109032
+ * @diagnosis The specified subvolume is running out of file system inodes.
+ If all subvolumes run out of inodes, then new files cannot be created.
+ * @recommendedaction Consider adding more nodes to the cluster if all subvolumes
+ * run out of inodes
+ *
+ */
+
+#define DHT_MSG_SUBVOL_INSUFF_INODES (GLFS_DHT_BASE + 32)
+
+/*!
+ * @messageid 109033
+ * @diagnosis The specified subvolume is running out of disk space. If all
+ subvolumes run out of space, new files cannot be created.
+ * @recommendedaction Consider adding more nodes to the cluster if all subvolumes
+ * run out of disk space.
+ *
+ */
+
+#define DHT_MSG_SUBVOL_INSUFF_SPACE (GLFS_DHT_BASE + 33)
+
+/*!
+ * @messageid 109034
+ * @diagnosis Failed to unlink the specified file/directory
+ * @recommendedaction The log message would indicate the reason
+ for the failure and the corrective action depends on
+ the specific error that is encountered.
+ */
+
+#define DHT_MSG_UNLINK_FAILED (GLFS_DHT_BASE + 34)
+
+
+
+/*!
+ * @messageid 109035
+ * @diagnosis The layout information could not be set in the inode
+ * @recommendedaction None
+ *
+ */
+#define DHT_MSG_LAYOUT_SET_FAILED (GLFS_DHT_BASE + 35)
+
+
+/*------------*/
+#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 49241d17657..603502c780c 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -154,14 +154,18 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs,
conf = this->private;
if (uuid_is_null (loc->pargfid)) {
- gf_log ("", GF_LOG_ERROR, "loc->pargfid is NULL for "
- "%s", loc->path);
+ gf_msg ("", GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed :"
+ "loc->pargfid is NULL for %s", loc->path);
goto out;
}
if (uuid_is_null (loc->gfid)) {
- gf_log ("", GF_LOG_ERROR, "loc->gfid is NULL for "
- "%s", loc->path);
+ gf_msg ("", GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed :"
+ "loc->gfid is NULL for %s", loc->path);
goto out;
}
@@ -174,14 +178,20 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs,
cached_subvol = dht_subvol_get_cached (this, loc->inode);
if (!cached_subvol) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get cached subvol"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed :"
+ "Failed to get cached subvol"
" for %s on %s", loc->name, this->name);
goto out;
}
hashed_subvol = dht_subvol_get_hashed (this, loc);
if (!hashed_subvol) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get hashed subvol"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed :"
+ "Failed to get hashed subvol"
" for %s on %s", loc->name, this->name);
goto out;
}
@@ -195,15 +205,22 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs,
ret = dict_set_str (link_xattr, conf->link_xattr_name,
hashed_subvol->name);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set "
- "linkto xattr in dict for %s", loc->name);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed :"
+ "Failed to set dictionary value:"
+ " key = %s for %s",
+ conf->link_xattr_name, loc->name);
goto out;
}
ret = syncop_setxattr (cached_subvol, loc, link_xattr, 0);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Linkto setxattr "
- "failed %s -> %s (%s)", cached_subvol->name,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed :"
+ "Linkto setxattr failed %s -> %s (%s)",
+ cached_subvol->name,
loc->name, strerror (-ret));
ret = -1;
goto out;
@@ -236,8 +253,11 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs,
}
ret = syncop_lookup (hashed_subvol, loc, NULL, &iatt, NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed lookup %s on %s (%s)"
- , loc->name, hashed_subvol->name, strerror (-ret));
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed :Failed lookup %s on %s ",
+ loc->name, hashed_subvol->name);
+
ret = -1;
goto out;
}
@@ -270,7 +290,9 @@ __is_file_migratable (xlator_t *this, loc_t *loc,
int ret = -1;
if (IA_ISDIR (stbuf->ia_type)) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
"%s: migrate-file called on directory", loc->path);
ret = -1;
goto out;
@@ -291,12 +313,16 @@ __is_file_migratable (xlator_t *this, loc_t *loc,
Checkout gf_defrag_handle_hardlink for more information.
*/
if (ret && ret != -2) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
"%s: failed to migrate file with link",
loc->path);
}
} else {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
"%s: file has hardlinks", loc->path);
ret = -ENOTSUP;
}
@@ -324,21 +350,26 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc
ret = dict_set_static_bin (dict, "gfid-req", stbuf->ia_gfid, 16);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s: failed to set gfid in dict for create", loc->path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: failed to set dictionary value: key = gfid-req",
+ loc->path);
goto out;
}
ret = dict_set_str (dict, conf->link_xattr_name, from->name);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s: failed to set gfid in dict for create", loc->path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: failed to set dictionary value: key = %s ",
+ loc->path, conf->link_xattr_name);
goto out;
}
fd = fd_create (loc->inode, DHT_REBALANCE_PID);
if (!fd) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: fd create failed (destination) (%s)",
loc->path, strerror (errno));
ret = -1;
@@ -349,8 +380,9 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc
if (!ret) {
/* File exits in the destination, check if gfid matches */
if (uuid_compare (stbuf->ia_gfid, new_stbuf.ia_gfid) != 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "file %s exits in %s with different gfid",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_GFID_MISMATCH,
+ "file %s exists in %s with different gfid",
loc->path, to->name);
fd_unref (fd);
goto out;
@@ -358,7 +390,8 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc
}
if ((ret < 0) && (-ret != ENOENT)) {
/* File exists in destination, but not accessible */
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: failed to lookup file (%s)",
loc->path, strerror (-ret));
ret = -1;
@@ -370,7 +403,8 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc
ret = syncop_create (to, loc, O_RDWR, DHT_LINKFILE_MODE, fd,
dict, &new_stbuf);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"failed to create %s on %s (%s)",
loc->path, to->name, strerror (-ret));
ret = -1;
@@ -379,13 +413,15 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc
ret = syncop_fsetxattr (to, fd, xattr, 0);
if (ret < 0)
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: failed to set xattr on %s (%s)",
loc->path, to->name, strerror (-ret));
ret = syncop_ftruncate (to, fd, stbuf->ia_size);
if (ret < 0)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"ftruncate failed for %s on %s (%s)",
loc->path, to->name, strerror (-ret));
@@ -393,7 +429,8 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc
(GF_SET_ATTR_UID | GF_SET_ATTR_GID),
NULL, NULL);
if (ret < 0)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"chown failed for %s on %s (%s)",
loc->path, to->name, strerror (-ret));
@@ -423,7 +460,8 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc,
ret = syncop_statfs (from, loc, &src_statfs);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"failed to get statfs of %s on %s (%s)",
loc->path, from->name, strerror (-ret));
ret = -1;
@@ -432,7 +470,8 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc,
ret = syncop_statfs (to, loc, &dst_statfs);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"failed to get statfs of %s on %s (%s)",
loc->path, to->name, strerror (-ret));
ret = -1;
@@ -460,7 +499,9 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc,
GF_DISK_SECTOR_SIZE);
if ((dst_statfs_blocks - stbuf->ia_blocks) <
(src_statfs_blocks + stbuf->ia_blocks)) {
- gf_log (this->name, GF_LOG_WARNING,
+
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"data movement attempted from node (%s) with"
" higher disk space to a node (%s) with "
"lesser disk space (%s)", from->name,
@@ -475,7 +516,8 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc,
check_avail_space:
if (((dst_statfs.f_bavail * dst_statfs.f_bsize) /
GF_DISK_SECTOR_SIZE) < stbuf->ia_blocks) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"data movement attempted from node (%s) with "
"to node (%s) which does not have required free space"
" for %s", from->name, to->name, loc->path);
@@ -557,7 +599,8 @@ __dht_rebalance_open_src_file (xlator_t *from, xlator_t *to, loc_t *loc,
fd = fd_create (loc->inode, DHT_REBALANCE_PID);
if (!fd) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: fd create failed (source)", loc->path);
ret = -1;
goto out;
@@ -565,7 +608,8 @@ __dht_rebalance_open_src_file (xlator_t *from, xlator_t *to, loc_t *loc,
ret = syncop_open (from, loc, O_RDWR, fd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"failed to open file %s on %s (%s)",
loc->path, from->name, strerror (-ret));
ret = -1;
@@ -589,7 +633,8 @@ __dht_rebalance_open_src_file (xlator_t *from, xlator_t *to, loc_t *loc,
to show which is the target, so other clients can work around it */
ret = syncop_setxattr (from, loc, dict, 0);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"failed to set xattr on %s in %s (%s)",
loc->path, from->name, strerror (-ret));
ret = -1;
@@ -604,7 +649,8 @@ __dht_rebalance_open_src_file (xlator_t *from, xlator_t *to, loc_t *loc,
ret = syncop_setattr (from, loc, &iatt, GF_SET_ATTR_MODE, NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"failed to set mode on %s in %s (%s)",
loc->path, from->name, strerror (-ret));
ret = -1;
@@ -648,7 +694,9 @@ migrate_special_files (xlator_t *this, xlator_t *from, xlator_t *to, loc_t *loc,
/* check in the destination if the file is link file */
ret = syncop_lookup (to, loc, dict, &stbuf, &rsp_dict, NULL);
if ((ret < 0) && (-ret != ENOENT)) {
- gf_log (this->name, GF_LOG_WARNING, "%s: lookup failed (%s)",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "%s: lookup failed (%s)",
loc->path, strerror (-ret));
ret = -1;
goto out;
@@ -662,7 +710,8 @@ migrate_special_files (xlator_t *this, xlator_t *from, xlator_t *to, loc_t *loc,
if (!ret) {
if (!check_is_linkfile (loc->inode, &stbuf, rsp_dict,
conf->link_xattr_name)) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: file exists in destination", loc->path);
ret = -1;
goto out;
@@ -671,7 +720,8 @@ migrate_special_files (xlator_t *this, xlator_t *from, xlator_t *to, loc_t *loc,
/* as file is linkfile, delete it */
ret = syncop_unlink (to, loc);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: failed to delete the linkfile (%s)",
loc->path, strerror (-ret));
ret = -1;
@@ -692,7 +742,8 @@ migrate_special_files (xlator_t *this, xlator_t *from, xlator_t *to, loc_t *loc,
/* Handle symlinks separately */
ret = syncop_readlink (from, loc, &link, buf->ia_size);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: readlink on symlink failed (%s)",
loc->path, strerror (-ret));
ret = -1;
@@ -701,7 +752,8 @@ migrate_special_files (xlator_t *this, xlator_t *from, xlator_t *to, loc_t *loc,
ret = syncop_symlink (to, loc, link, dict, 0);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: creating symlink failed (%s)",
loc->path, strerror (-ret));
ret = -1;
@@ -716,7 +768,9 @@ migrate_special_files (xlator_t *this, xlator_t *from, xlator_t *to, loc_t *loc,
makedev (ia_major (buf->ia_rdev),
ia_minor (buf->ia_rdev)), dict, 0);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "%s: mknod failed (%s)",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "%s: mknod failed (%s)",
loc->path, strerror (-ret));
ret = -1;
goto out;
@@ -727,7 +781,8 @@ done:
(GF_SET_ATTR_UID | GF_SET_ATTR_GID |
GF_SET_ATTR_MODE), NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: failed to perform setattr on %s (%s)",
loc->path, to->name, strerror (-ret));
ret = -1;
@@ -735,7 +790,9 @@ done:
ret = syncop_unlink (from, loc);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "%s: unlink failed (%s)",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "%s: unlink failed (%s)",
loc->path, strerror (-ret));
ret = -1;
}
@@ -783,7 +840,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
ret = dict_set_int32 (dict, conf->link_xattr_name, 256);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
"%s: failed to set 'linkto' key in dict", loc->path);
goto out;
}
@@ -791,7 +850,10 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
/* Phase 1 - Data migration is in progress from now on */
ret = syncop_lookup (from, loc, dict, &stbuf, &xattr_rsp, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s: lookup failed on %s (%s)",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
+ "%s: lookup failed on %s (%s)",
loc->path, from->name, strerror (-ret));
ret = -1;
goto out;
@@ -820,7 +882,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
/* TODO: move all xattr related operations to fd based operations */
ret = syncop_listxattr (from, loc, &xattr);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
"%s: failed to get xattr from %s (%s)",
loc->path, from->name, strerror (-ret));
ret = -1;
@@ -840,7 +904,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
/* Open the source, and also update mode/xattr */
ret = __dht_rebalance_open_src_file (from, to, loc, &stbuf, &src_fd);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "failed to open %s on %s",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed: failed to open %s on %s",
loc->path, from->name);
goto out;
}
@@ -848,8 +914,10 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
ret = syncop_fstat (from, src_fd, &stbuf);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "failed to lookup %s on %s (%s)",
- loc->path, from->name, strerror (-ret));
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:failed to lookup %s on %s ",
+ loc->path, from->name);
ret = -1;
goto out;
}
@@ -862,12 +930,16 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
ret = __dht_rebalance_migrate_data (from, to, src_fd, dst_fd,
stbuf.ia_size, file_has_holes);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s: failed to migrate data",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed: %s: failed to migrate data",
loc->path);
/* reset the destination back to 0 */
ret = syncop_ftruncate (to, dst_fd, 0);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed: "
"%s: failed to reset target size back to 0 (%s)",
loc->path, strerror (-ret));
}
@@ -892,9 +964,10 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
ret = syncop_fstat (from, src_fd, &new_stbuf);
if (ret < 0) {
/* Failed to get the stat info */
- gf_log (this->name, GF_LOG_ERROR,
- "failed to fstat file %s on %s (%s)",
- loc->path, from->name, strerror (-ret));
+ gf_msg ( this->name, GF_LOG_ERROR, -ret,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed: failed to fstat file %s on %s ",
+ loc->path, from->name);
ret = -1;
goto out;
}
@@ -915,9 +988,11 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
(GF_SET_ATTR_UID | GF_SET_ATTR_GID |
GF_SET_ATTR_MODE), NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to perform setattr on %s (%s)",
- loc->path, to->name, strerror (-ret));
+ gf_msg (this->name, GF_LOG_WARNING, -ret,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
+ "%s: failed to perform setattr on %s ",
+ loc->path, to->name);
ret = -1;
goto out;
}
@@ -927,9 +1002,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
(GF_SET_ATTR_MTIME | GF_SET_ATTR_ATIME),
NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to perform setattr on %s (%s)",
- loc->path, to->name, strerror (-ret));
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to perform setattr on %s ",
+ loc->path, to->name);
ret = -1;
}
@@ -938,9 +1013,11 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
ret = syncop_fsetattr (from, src_fd, &empty_iatt,
GF_SET_ATTR_MODE, NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, \
- "%s: failed to perform setattr on %s (%s)",
- loc->path, from->name, strerror (-ret));
+ gf_msg (this->name, GF_LOG_WARNING, -ret,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
+ "%s: failed to perform setattr on %s ",
+ loc->path, from->name);
ret = -1;
goto out;
}
@@ -967,7 +1044,8 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
/* Do a stat and check the gfid before unlink */
ret = syncop_stat (from, loc, &empty_iatt);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: failed to do a stat on %s (%s)",
loc->path, from->name, strerror (-ret));
ret = -1;
@@ -978,7 +1056,8 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
/* take out the source from namespace */
ret = syncop_unlink (from, loc);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"%s: failed to perform unlink on %s (%s)",
loc->path, from->name, strerror (-ret));
ret = -1;
@@ -988,13 +1067,14 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
ret = syncop_lookup (this, loc, NULL, NULL, NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
- "%s: failed to lookup the file on subvolumes (%s)",
- loc->path, strerror (-ret));
+ gf_msg_debug (this->name, 0,
+ "%s: failed to lookup the file on subvolumes (%s)",
+ loc->path, strerror (-ret));
ret = -1;
}
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_MIGRATE_FILE_COMPLETE,
"completed migration of %s from subvolume %s to %s",
loc->path, from->name, to->name);
@@ -1241,7 +1321,9 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
ret = syncop_opendir (this, loc, fd);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to open dir %s",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_DATA_FAILED,
+ "Migrate data failed: Failed to open dir %s",
loc->path);
ret = -1;
goto out;
@@ -1254,8 +1336,10 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Readdir returned %s."
- " Aborting migrate-data",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_DATA_FAILED,
+ "%s: Migrate data failed: Readdir returned"
+ " %s. Aborting migrate-data", loc->path,
strerror(-ret));
ret = -1;
goto out;
@@ -1301,8 +1385,9 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
}
if (uuid_is_null (entry->d_stat.ia_gfid)) {
- gf_log (this->name, GF_LOG_ERROR, "%s/%s"
- " gfid not present", loc->path,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_GFID_NULL,
+ "%s/%s gfid not present", loc->path,
entry->d_name);
continue;
}
@@ -1310,8 +1395,9 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
uuid_copy (entry_loc.gfid, entry->d_stat.ia_gfid);
if (uuid_is_null (loc->gfid)) {
- gf_log (this->name, GF_LOG_ERROR, "%s/%s"
- " gfid not present", loc->path,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_GFID_NULL,
+ "%s/%s gfid not present", loc->path,
entry->d_name);
continue;
}
@@ -1323,8 +1409,10 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
ret = syncop_lookup (this, &entry_loc, NULL, &iatt,
NULL, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s"
- " lookup failed", entry_loc.path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:%s lookup failed",
+ entry_loc.path);
ret = -1;
continue;
}
@@ -1332,8 +1420,11 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
ret = syncop_getxattr (this, &entry_loc, &dict,
GF_XATTR_NODE_UUID_KEY);
if(ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
- "get node-uuid for %s", entry_loc.path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "Migrate file failed:"
+ "Failed to get node-uuid for %s",
+ entry_loc.path);
ret = -1;
continue;
}
@@ -1358,8 +1449,9 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
* the other node will take responsibility of migration
*/
if (uuid_compare (node_uuid, defrag->node_uuid)) {
- gf_log (this->name, GF_LOG_TRACE, "%s does not"
- "belong to this node", entry_loc.path);
+ gf_msg_trace (this->name, 0, "%s does not"
+ "belong to this node",
+ entry_loc.path);
continue;
}
@@ -1398,13 +1490,15 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
/* errno is overloaded. See
* rebalance_task_completion () */
if (op_errno == ENOSPC) {
- gf_log (this->name, GF_LOG_DEBUG,
- "migrate-data skipped for %s"
- " due to space constraints",
- entry_loc.path);
+ gf_msg_debug (this->name, 0,
+ "migrate-data skipped for"
+ " %s due to space "
+ "constraints",
+ entry_loc.path);
defrag->skipped +=1;
} else{
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"migrate-data failed for %s",
entry_loc.path);
defrag->total_failures +=1;
@@ -1414,16 +1508,18 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
defrag);
if (!ret)
- gf_log (this->name, GF_LOG_DEBUG,
- "migrate-data on %s failed: %s",
- entry_loc.path,
- strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "migrate-data on %s "
+ "failed: %s",
+ entry_loc.path,
+ strerror (op_errno));
else if (ret == 1)
continue;
else if (ret == -1)
goto out;
} else if (ret > 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_MIGRATE_FILE_FAILED,
"migrate-data failed for %s",
entry_loc.path);
defrag->total_failures +=1;
@@ -1502,7 +1598,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
goto out;
}
- gf_log (this->name, GF_LOG_TRACE, "fix layout called on %s", loc->path);
+ gf_msg_trace (this->name, 0, "fix layout called on %s", loc->path);
fd = fd_create (loc->inode, defrag->pid);
if (!fd) {
@@ -1618,8 +1714,10 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
fix_layout, migrate_data);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Fix layout "
- "failed for %s", entry_loc.path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_LAYOUT_FIX_FAILED,
+ "Fix layout failed for %s",
+ entry_loc.path);
defrag->total_failures++;
goto out;
}
@@ -1691,7 +1789,9 @@ gf_defrag_start_crawl (void *data)
ret = syncop_lookup (this, &loc, NULL, &iatt, NULL, &parent);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "look up on / failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_REBALANCE_START_FAILED,
+ "Failed to start rebalance: look up on / failed");
ret = -1;
goto out;
}
@@ -1704,13 +1804,20 @@ gf_defrag_start_crawl (void *data)
ret = dict_set_str (fix_layout, GF_XATTR_FIX_LAYOUT_KEY, "yes");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set dict str");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_REBALANCE_START_FAILED,
+ "Failed to start rebalance:"
+ "Failed to set dictionary value: key = %s",
+ GF_XATTR_FIX_LAYOUT_KEY);
+
goto out;
}
ret = syncop_setxattr (this, &loc, fix_layout, 0);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "fix layout on %s failed",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_REBALANCE_FAILED,
+ "fix layout on %s failed",
loc.path);
defrag->total_failures++;
ret = -1;
@@ -1806,8 +1913,9 @@ gf_defrag_start (void *data)
gf_defrag_done, frame, this);
if (ret)
- gf_log (this->name, GF_LOG_ERROR, "Could not create"
- " task for rebalance");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_REBALANCE_START_FAILED,
+ "Could not create task for rebalance");
out:
return NULL;
}
@@ -1903,9 +2011,11 @@ log:
break;
}
- gf_log (THIS->name, GF_LOG_INFO, "Rebalance is %s. Time taken is %.2f "
- "secs", status, elapsed);
- gf_log (THIS->name, GF_LOG_INFO, "Files migrated: %"PRIu64", size: %"
+ gf_msg (THIS->name, GF_LOG_INFO, 0, DHT_MSG_REBALANCE_STATUS,
+ "Rebalance is %s. Time taken is %.2f secs",
+ status, elapsed);
+ gf_msg (THIS->name, GF_LOG_INFO, 0, DHT_MSG_REBALANCE_STATUS,
+ "Files migrated: %"PRIu64", size: %"
PRIu64", lookups: %"PRIu64", failures: %"PRIu64", skipped: "
"%"PRIu64, files, size, lookup, failures, skipped);
@@ -1927,13 +2037,14 @@ gf_defrag_stop (gf_defrag_info_t *defrag, gf_defrag_status_t status,
goto out;
}
- gf_log ("", GF_LOG_INFO, "Received stop command on rebalance");
+ gf_msg ("", GF_LOG_INFO, 0, DHT_MSG_REBALANCE_STOPPED,
+ "Received stop command on rebalance");
defrag->defrag_status = status;
if (output)
gf_defrag_status_get (defrag, output);
ret = 0;
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("", 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index 925538cc80c..9b440a7690b 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -32,17 +32,21 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_local_t *local = NULL;
int this_call_cnt = 0;
call_frame_t *prev = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
prev = cookie;
+
if (op_ret == -1) {
/* TODO: undo the damage */
+ uuid_unparse(local->loc.inode->gfid, gfid);
- gf_log (this->name, GF_LOG_INFO,
- "rename %s -> %s on %s failed (%s)",
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ DHT_MSG_RENAME_FAILED,
+ "Rename %s -> %s on %s failed, (gfid = %s)",
local->loc.path, local->loc2.path,
- prev->this->name, strerror (op_errno));
+ prev->this->name, gfid);
local->op_ret = op_ret;
local->op_errno = op_errno;
@@ -96,18 +100,23 @@ dht_rename_hashed_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int call_cnt = 0;
call_frame_t *prev = NULL;
int i = 0;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
conf = this->private;
local = frame->local;
prev = cookie;
+
if (op_ret == -1) {
/* TODO: undo the damage */
- gf_log (this->name, GF_LOG_INFO,
- "rename %s -> %s on %s failed (%s)",
+ uuid_unparse(local->loc.inode->gfid, gfid);
+
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ DHT_MSG_RENAME_FAILED,
+ "rename %s -> %s on %s failed, (gfid = %s) ",
local->loc.path, local->loc2.path,
- prev->this->name, strerror (op_errno));
+ prev->this->name, gfid );
local->op_ret = op_ret;
local->op_errno = op_errno;
@@ -200,9 +209,9 @@ dht_rename_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev = cookie;
if (op_ret > 2) {
- gf_log (this->name, GF_LOG_TRACE,
- "readdir on %s for %s returned %d entries",
- prev->this->name, local->loc.path, op_ret);
+ gf_msg_trace (this->name, 0,
+ "readdir on %s for %s returned %d entries",
+ prev->this->name, local->loc.path, op_ret);
local->op_ret = -1;
local->op_errno = ENOTEMPTY;
}
@@ -224,16 +233,19 @@ dht_rename_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_local_t *local = NULL;
int this_call_cnt = -1;
call_frame_t *prev = NULL;
-
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
prev = cookie;
+
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_INFO,
- "opendir on %s for %s failed (%s)",
- prev->this->name, local->loc.path,
- strerror (op_errno));
+
+ uuid_unparse(local->loc.inode->gfid, gfid);
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ DHT_MSG_OPENDIR_FAILED,
+ "opendir on %s for %s failed,(gfid = %s) ",
+ prev->this->name, local->loc.path, gfid);
goto err;
}
@@ -270,8 +282,9 @@ dht_rename_dir (call_frame_t *frame, xlator_t *this)
for (i = 0; i < conf->subvolume_cnt; i++) {
if (!conf->subvolume_status[i]) {
- gf_log (this->name, GF_LOG_INFO,
- "one of the subvolumes down (%s)",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_RENAME_FAILED,
+ "Rename dir failed: subvolume down (%s)",
conf->subvolumes[i]->name);
op_errno = ENOTCONN;
goto err;
@@ -315,8 +328,11 @@ err:
} \
tmp = dict_set_str (xattr, GLUSTERFS_INTERNAL_FOP_KEY, "yes"); \
if (tmp) { \
- gf_log (this->name, GF_LOG_ERROR, "Failed to set" \
- " internal dict key for %s", local->loc.path); \
+ gf_msg (this->name, GF_LOG_ERROR, 0, \
+ DHT_MSG_DICT_SET_FAILED, \
+ "Failed to set dictionary value: key = %s," \
+ " path = %s", GLUSTERFS_INTERNAL_FOP_KEY, \
+ local->loc.path); \
} \
}while (0)
@@ -330,8 +346,11 @@ err:
tmp = dict_set_str (xattr, GLUSTERFS_MARKER_DONT_ACCOUNT_KEY, \
"yes"); \
if (tmp) { \
- gf_log (this->name, GF_LOG_ERROR, "Failed to set" \
- " marker dont account key for %s", local->loc.path); \
+ gf_msg (this->name, GF_LOG_ERROR, 0, \
+ DHT_MSG_DICT_SET_FAILED, \
+ "Failed to set dictionary value: key = %s," \
+ " path = %s",GLUSTERFS_MARKER_DONT_ACCOUNT_KEY, \
+ local->loc.path); \
} \
}while (0)
@@ -376,9 +395,10 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
this_call_cnt = dht_frame_return (frame);
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: unlink on %s failed (%s)",
- local->loc.path, prev->this->name, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ DHT_MSG_UNLINK_FAILED,
+ "%s: Rename: unlink on %s failed ",
+ local->loc.path, prev->this->name);
}
WIPE (&local->preoldparent);
@@ -406,6 +426,7 @@ dht_rename_cleanup (call_frame_t *frame)
xlator_t *dst_cached = NULL;
int call_cnt = 0;
dict_t *xattr = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
this = frame->this;
@@ -431,12 +452,15 @@ dht_rename_cleanup (call_frame_t *frame)
DHT_MARK_FOP_INTERNAL (xattr);
+ uuid_unparse(local->loc.inode->gfid, gfid);
+
if (dst_hashed != src_hashed && dst_hashed != src_cached) {
dict_t *xattr_new = NULL;
- gf_log (this->name, GF_LOG_TRACE,
- "unlinking linkfile %s @ %s => %s",
- local->loc.path, dst_hashed->name, src_cached->name);
+ gf_msg_trace (this->name, 0,
+ "unlinking linkfile %s @ %s => %s, (gfid = %s)",
+ local->loc.path, dst_hashed->name,
+ src_cached->name, gfid);
xattr_new = dict_copy_with_ref (xattr, NULL);
@@ -454,9 +478,10 @@ dht_rename_cleanup (call_frame_t *frame)
if (src_cached != dst_hashed) {
dict_t *xattr_new = NULL;
- gf_log (this->name, GF_LOG_TRACE,
- "unlinking link %s => %s (%s)", local->loc.path,
- local->loc2.path, src_cached->name);
+ gf_msg_trace (this->name, 0,
+ "unlinking link %s => %s (%s), (gfid = %s)",
+ local->loc.path, local->loc2.path,
+ src_cached->name, gfid);
xattr_new = dict_copy_with_ref (xattr, NULL);
@@ -552,9 +577,11 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->linked == _gf_true)
FRAME_SU_UNDO (frame, dht_local_t);
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: rename on %s failed (%s)", local->loc.path,
- prev->this->name, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ DHT_MSG_RENAME_FAILED,
+ "%s: Rename on %s failed, (gfid = %s) ",
+ local->loc.path, prev->this->name,
+ local->loc.inode? uuid_utoa(local->loc.inode->gfid):"");
local->op_ret = op_ret;
local->op_errno = op_errno;
goto cleanup;
@@ -630,9 +657,9 @@ err:
xattr_new = dict_copy_with_ref (xattr, NULL);
- gf_log (this->name, GF_LOG_TRACE,
- "deleting old src datafile %s @ %s",
- local->loc.path, src_cached->name);
+ gf_msg_trace (this->name, 0,
+ "deleting old src datafile %s @ %s",
+ local->loc.path, src_cached->name);
if (uuid_compare (local->loc.pargfid,
local->loc2.pargfid) == 0) {
@@ -652,9 +679,9 @@ err:
xattr_new = dict_copy_with_ref (xattr, NULL);
- gf_log (this->name, GF_LOG_TRACE,
- "deleting old src linkfile %s @ %s",
- local->loc.path, src_hashed->name);
+ gf_msg_trace (this->name, 0,
+ "deleting old src linkfile %s @ %s",
+ local->loc.path, src_hashed->name);
DHT_MARKER_DONT_ACCOUNT(xattr_new);
@@ -669,9 +696,9 @@ err:
if (dst_cached
&& (dst_cached != dst_hashed)
&& (dst_cached != src_cached)) {
- gf_log (this->name, GF_LOG_TRACE,
- "deleting old dst datafile %s @ %s",
- local->loc2.path, dst_cached->name);
+ gf_msg_trace (this->name, 0,
+ "deleting old dst datafile %s @ %s",
+ local->loc2.path, dst_cached->name);
STACK_WIND (frame, dht_rename_unlink_cbk,
dst_cached, dst_cached->fops->unlink,
@@ -713,7 +740,6 @@ dht_do_rename (call_frame_t *frame)
xlator_t *rename_subvol = NULL;
dict_t *dict = NULL;
-
local = frame->local;
this = frame->this;
@@ -730,9 +756,9 @@ dht_do_rename (call_frame_t *frame)
DHT_MARKER_DONT_ACCOUNT(dict);
}
- gf_log (this->name, GF_LOG_TRACE,
- "renaming %s => %s (%s)",
- local->loc.path, local->loc2.path, rename_subvol->name);
+ gf_msg_trace (this->name, 0,
+ "renaming %s => %s (%s)",
+ local->loc.path, local->loc2.path, rename_subvol->name);
if (local->linked == _gf_true)
FRAME_SU_DO (frame, dht_local_t);
@@ -760,9 +786,9 @@ dht_rename_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev = cookie;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "link/file on %s failed (%s)",
- prev->this->name, strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "link/file on %s failed (%s)",
+ prev->this->name, strerror (op_errno));
local->op_ret = -1;
if (op_errno != ENOENT)
local->op_errno = op_errno;
@@ -802,10 +828,10 @@ dht_rename_unlink_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev = cookie;
if ((op_ret == -1) && (op_errno != ENOENT)) {
- gf_log (this->name, GF_LOG_DEBUG,
- "unlink of %s on %s failed (%s)",
- local->loc2.path, prev->this->name,
- strerror (op_errno));
+ gf_msg_debug (this->name, 0,
+ "unlink of %s on %s failed (%s)",
+ local->loc2.path, prev->this->name,
+ strerror (op_errno));
local->op_ret = -1;
local->op_errno = op_errno;
}
@@ -855,9 +881,9 @@ dht_rename_create_links (call_frame_t *frame)
xattr_new = dict_copy_with_ref (xattr, NULL);
- gf_log (this->name, GF_LOG_TRACE,
- "unlinking dst linkfile %s @ %s",
- local->loc2.path, dst_hashed->name);
+ gf_msg_trace (this->name, 0,
+ "unlinking dst linkfile %s @ %s",
+ local->loc2.path, dst_hashed->name);
DHT_MARKER_DONT_ACCOUNT(xattr_new);
@@ -878,9 +904,11 @@ dht_rename_create_links (call_frame_t *frame)
local->call_cnt = call_cnt;
if (dst_hashed != src_hashed && dst_hashed != src_cached) {
- gf_log (this->name, GF_LOG_TRACE,
- "linkfile %s @ %s => %s",
- local->loc.path, dst_hashed->name, src_cached->name);
+ gf_msg_trace (this->name, 0,
+ "linkfile %s @ %s => %s",
+ local->loc.path, dst_hashed->name,
+ src_cached->name);
+
memcpy (local->gfid, local->loc.inode->gfid, 16);
dht_linkfile_create (frame, dht_rename_links_cbk, this,
src_cached, dst_hashed, &local->loc);
@@ -891,9 +919,9 @@ dht_rename_create_links (call_frame_t *frame)
xattr_new = dict_copy_with_ref (xattr, NULL);
- gf_log (this->name, GF_LOG_TRACE,
- "link %s => %s (%s)", local->loc.path,
- local->loc2.path, src_cached->name);
+ gf_msg_trace (this->name, 0,
+ "link %s => %s (%s)", local->loc.path,
+ local->loc2.path, src_cached->name);
if (uuid_compare (local->loc.pargfid,
local->loc2.pargfid) == 0) {
DHT_MARKER_DONT_ACCOUNT(xattr_new);
@@ -929,34 +957,41 @@ dht_rename (call_frame_t *frame, xlator_t *this,
int op_errno = -1;
int ret = -1;
dht_local_t *local = NULL;
-
+ char gfid[GF_UUID_BUF_SIZE] = {0};
VALIDATE_OR_GOTO (frame, err);
VALIDATE_OR_GOTO (this, err);
VALIDATE_OR_GOTO (oldloc, err);
VALIDATE_OR_GOTO (newloc, err);
+ uuid_unparse(oldloc->inode->gfid, gfid);
+
src_hashed = dht_subvol_get_hashed (this, oldloc);
if (!src_hashed) {
- gf_log (this->name, GF_LOG_INFO,
- "no subvolume in layout for path=%s",
- oldloc->path);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_RENAME_FAILED,
+ "No hashed subvolume in layout for path=%s,"
+ "(gfid = %s)", oldloc->path, gfid);
op_errno = EINVAL;
goto err;
}
src_cached = dht_subvol_get_cached (this, oldloc->inode);
if (!src_cached) {
- gf_log (this->name, GF_LOG_INFO,
- "no cached subvolume for path=%s", oldloc->path);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_RENAME_FAILED,
+ "No cached subvolume for path = %s,"
+ "(gfid = %s)", oldloc->path, gfid);
+
op_errno = EINVAL;
goto err;
}
dst_hashed = dht_subvol_get_hashed (this, newloc);
if (!dst_hashed) {
- gf_log (this->name, GF_LOG_INFO,
- "no subvolume in layout for path=%s",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_RENAME_FAILED,
+ "No hashed subvolume in layout for path=%s",
newloc->path);
op_errno = EINVAL;
goto err;
@@ -985,11 +1020,12 @@ 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_TRACE,
- "renaming %s (hash=%s/cache=%s) => %s (hash=%s/cache=%s)",
- oldloc->path, src_hashed->name, src_cached->name,
- newloc->path, dst_hashed->name,
- dst_cached ? dst_cached->name : "<nul>");
+ gf_msg_trace (this->name, 0,
+ "renaming %s (hash=%s/cache=%s) => %s"
+ " (hash=%s/cache=%s)",
+ oldloc->path, src_hashed->name, src_cached->name,
+ newloc->path, dst_hashed->name,
+ dst_cached ? dst_cached->name : "<nul>");
if (IA_ISDIR (oldloc->inode->ia_type)) {
dht_rename_dir (frame, this);
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index 0e65275442a..84b0f2f4679 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -17,16 +17,18 @@
#include "glusterfs.h"
#include "xlator.h"
#include "dht-common.h"
+#include "dht-messages.h"
#include "glusterfs-acl.h"
#define DHT_SET_LAYOUT_RANGE(layout,i,srt,chunk,cnt,path) do { \
layout->list[i].start = srt; \
layout->list[i].stop = srt + chunk - 1; \
\
- gf_log (this->name, GF_LOG_TRACE, \
- "gave fix: %u - %u on %s for %s", \
- layout->list[i].start, layout->list[i].stop, \
- layout->list[i].xlator->name, path); \
+ gf_msg_trace (this->name, 0, \
+ "gave fix: %u - %u on %s for %s", \
+ layout->list[i].start, \
+ layout->list[i].stop, \
+ layout->list[i].xlator->name, path); \
} while (0)
#define DHT_RESET_LAYOUT_RANGE(layout) do { \
@@ -128,6 +130,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
dht_local_t *local = NULL;
dht_conf_t *conf = NULL;
data_t *data = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
if (req_subvol)
@@ -149,27 +152,33 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
goto err;
}
+ uuid_unparse(loc->inode->gfid, gfid);
+
ret = dht_disk_layout_extract (this, layout, i, &disk_layout);
if (ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: (subvol %s) failed to extract disk layout",
- loc->path, subvol->name);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DIR_SELFHEAL_XATTR_FAILED,
+ "Directory self heal xattr failed:"
+ " %s: (subvol %s) Failed to extract disk layout,"
+ " gfid = %s", loc->path, subvol->name, gfid);
goto err;
}
ret = dict_set_bin (xattr, conf->xattr_name, disk_layout, 4 * 4);
if (ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s: (subvol %s) failed to set xattr dictionary",
- loc->path, subvol->name);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DIR_SELFHEAL_XATTR_FAILED,
+ "Directory self heal xattr failed:"
+ "%s: (subvol %s) Failed to set xattr dictionary,"
+ " gfid = %s", loc->path, subvol->name, gfid);
goto err;
}
disk_layout = NULL;
- gf_log (this->name, GF_LOG_TRACE,
- "setting hash range %u - %u (type %d) on subvolume %s for %s",
- layout->list[i].start, layout->list[i].stop,
- layout->type, subvol->name, loc->path);
+ gf_msg_trace (this->name, 0,
+ "setting hash range %u - %u (type %d) on subvolume %s"
+ " for %s", layout->list[i].start, layout->list[i].stop,
+ layout->type, subvol->name, loc->path);
dict_ref (xattr);
if (local->xattr) {
@@ -177,8 +186,11 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
if (data) {
ret = dict_add (xattr, QUOTA_LIMIT_KEY, data);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
- "set quota limit key on %s",loc->path);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value:"
+ " key = %s",
+ loc->path, QUOTA_LIMIT_KEY);
}
}
}
@@ -218,8 +230,9 @@ dht_fix_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout)
this = frame->this;
conf = this->private;
- gf_log (this->name, GF_LOG_DEBUG,
- "writing the new range for all subvolumes");
+ gf_msg_debug (this->name, 0,
+ "%s: Writing the new range for all subvolumes",
+ loc->path);
local->call_cnt = count = conf->subvolume_cnt;
@@ -283,9 +296,9 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout)
missing_xattr++;
}
}
- 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);
@@ -369,9 +382,10 @@ dht_selfheal_dir_setattr (call_frame_t *frame, loc_t *loc, struct iatt *stbuf,
local->call_cnt = missing_attr;
for (i = 0; i < layout->cnt; i++) {
if (layout->list[i].err == -1) {
- gf_log (this->name, GF_LOG_TRACE,
- "setattr for %s on subvol %s",
- loc->path, layout->list[i].xlator->name);
+ gf_msg_trace (this->name, 0,
+ "%s: setattr on subvol %s, gfid = %s",
+ loc->path, layout->list[i].xlator->name,
+ uuid_utoa(loc->gfid));
STACK_WIND (frame, dht_selfheal_dir_setattr_cbk,
layout->list[i].xlator,
@@ -396,7 +410,7 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
xlator_t *subvol = NULL;
int i = 0;
int this_call_cnt = 0;
-
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
layout = local->selfheal.layout;
@@ -413,10 +427,13 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
if (op_ret) {
- gf_log (this->name, ((op_errno == EEXIST) ? GF_LOG_DEBUG :
+
+ uuid_unparse(local->loc.gfid, gfid);
+ gf_msg (this->name, ((op_errno == EEXIST) ? 0 :
GF_LOG_WARNING),
- "selfhealing directory %s failed: %s",
- local->loc.path, strerror (op_errno));
+ op_errno, DHT_MSG_DIR_SELFHEAL_FAILED,
+ "Directory selfheal failed: path = %s, gfid = %s",
+ local->loc.path, gfid );
goto out;
}
@@ -451,25 +468,29 @@ dht_selfheal_dir_mkdir_setacl (dict_t *xattr, dict_t *dict)
acl_default = dict_get (xattr, POSIX_ACL_DEFAULT_XATTR);
if (!acl_default) {
- gf_log (this->name, GF_LOG_DEBUG,
- "ACL_DEFAULT xattr not present");
+ gf_msg_debug (this->name, 0,
+ "ACL_DEFAULT xattr not present");
goto cont;
}
ret = dict_set (dict, POSIX_ACL_DEFAULT_XATTR, acl_default);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "Could not set ACL_DEFAULT xattr");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value.key = %s",
+ POSIX_ACL_DEFAULT_XATTR);
cont:
acl_access = dict_get (xattr, POSIX_ACL_ACCESS_XATTR);
if (!acl_access) {
- gf_log (this->name, GF_LOG_DEBUG,
- "ACL_ACCESS xattr not present");
+ gf_msg_debug (this->name, 0,
+ "ACL_ACCESS xattr not present");
goto out;
}
ret = dict_set (dict, POSIX_ACL_ACCESS_XATTR, acl_access);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "Could not set ACL_ACCESS xattr");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "Failed to set dictionary value.key = %s",
+ POSIX_ACL_ACCESS_XATTR);
out:
return;
@@ -507,8 +528,10 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc,
ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to set gfid in dict", loc->path);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value:"
+ " key = gfid-req", loc->path);
} else if (local->params) {
/* Send the dictionary from higher layers directly */
dict = dict_ref (local->params);
@@ -523,9 +546,9 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc,
for (i = 0; i < layout->cnt; i++) {
if (layout->list[i].err == ENOENT || force) {
- gf_log (this->name, GF_LOG_DEBUG,
- "creating directory %s on subvol %s",
- loc->path, layout->list[i].xlator->name);
+ gf_msg_debug (this->name, 0,
+ "Creating directory %s on subvol %s",
+ loc->path, layout->list[i].xlator->name);
STACK_WIND (frame, dht_selfheal_dir_mkdir_cbk,
layout->list[i].xlator,
@@ -742,8 +765,8 @@ dht_fix_layout_of_directory (call_frame_t *frame, loc_t *loc,
local = frame->local;
if (layout->type == DHT_HASH_TYPE_DM_USER) {
- gf_log (THIS->name, GF_LOG_DEBUG, "leaving %s alone",
- loc->path);
+ gf_msg_debug (THIS->name, 0, "leaving %s alone",
+ loc->path);
goto done;
}
@@ -756,7 +779,9 @@ dht_fix_layout_of_directory (call_frame_t *frame, loc_t *loc,
&subvol_down, NULL, NULL);
if (subvol_down || (ret == -1)) {
- gf_log (this->name, GF_LOG_WARNING, "%u subvolume(s) are down"
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_LAYOUT_FIX_FAILED,
+ "Layout fix failed: %u subvolume(s) are down"
". Skipping fix layout.", subvol_down);
GF_FREE (new_layout);
return NULL;
@@ -931,10 +956,14 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
uint32_t misc = 0;
int ret = 0;
xlator_t *this = NULL;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
local = frame->local;
this = frame->this;
+ uuid_unparse(loc->gfid, gfid);
+
+
dht_layout_anomalies (this, loc, layout,
&local->selfheal.hole_cnt,
&local->selfheal.overlaps_cnt,
@@ -948,15 +977,22 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
local->selfheal.layout = dht_layout_ref (this, layout);
if (down) {
- gf_log (this->name, GF_LOG_WARNING,
- "%d subvolumes down -- not fixing", down);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DIR_SELFHEAL_FAILED,
+ "Directory selfheal failed: %d subvolumes down."
+ "Not fixing. path = %s, gfid = %s",
+ down, loc->path, gfid);
ret = 0;
goto sorry_no_fix;
}
if (misc) {
- gf_log (this->name, GF_LOG_WARNING,
- "%d subvolumes have unrecoverable errors", misc);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DIR_SELFHEAL_FAILED,
+ "Directory selfheal failed : %d subvolumes "
+ "have unrecoverable errors. path = %s, gfid = %s",
+ misc, loc->path, gfid);
+
ret = 0;
goto sorry_no_fix;
}
@@ -965,8 +1001,11 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
ret = dht_selfheal_dir_getafix (frame, loc, layout);
if (ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
- "not able to form layout for the directory");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_DIR_SELFHEAL_FAILED,
+ "Directory selfheal failed: "
+ "Unable to form layout for directory %s",
+ loc->path);
goto sorry_no_fix;
}
@@ -1010,6 +1049,8 @@ dht_dir_attr_heal (void *data)
int call_cnt = 0;
int ret = -1;
int i = 0;
+ char gfid[GF_UUID_BUF_SIZE] = {0};
+
GF_VALIDATE_OR_GOTO ("dht", data, out);
@@ -1031,9 +1072,13 @@ dht_dir_attr_heal (void *data)
(GF_SET_ATTR_UID | GF_SET_ATTR_GID),
NULL, NULL);
if (ret) {
- gf_log ("dht", GF_LOG_ERROR, "Failed to set uid/gid on"
- " %s on %s subvol (%s)", local->loc.path,
- subvol->name, strerror (-ret));
+ uuid_unparse(local->loc.gfid, gfid);
+
+ gf_msg ("dht", GF_LOG_ERROR, -ret,
+ DHT_MSG_DIR_ATTR_HEAL_FAILED,
+ "Directory attr heal failed. Failed to set"
+ " uid/gid on path %s on subvol %s, gfid = %s ",
+ local->loc.path, subvol->name, gfid);
}
}
out:
diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c
index f2e7467abe7..3d1d635b4ed 100644
--- a/xlators/cluster/dht/src/dht-shared.c
+++ b/xlators/cluster/dht/src/dht-shared.c
@@ -18,6 +18,8 @@
#include "statedump.h"
#include "dht-common.h"
+#include "dht-messages.h"
+
/* TODO:
- use volumename in xattr instead of "dht"
@@ -357,21 +359,23 @@ dht_reconfigure (xlator_t *this, dict_t *options)
/* If option is not "auto", other options _should_ be boolean*/
if (strcasecmp (temp_str, "auto")) {
if (!gf_string2boolean (temp_str, &search_unhashed)) {
- gf_log(this->name, GF_LOG_DEBUG, "Reconfigure:"
- " lookup-unhashed reconfigured (%s)",
- temp_str);
+ gf_msg_debug(this->name, 0, "Reconfigure: "
+ "lookup-unhashed reconfigured(%s)",
+ temp_str);
conf->search_unhashed = search_unhashed;
} else {
- gf_log(this->name, GF_LOG_ERROR, "Reconfigure:"
- " lookup-unhashed should be boolean,"
+ gf_msg(this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_OPTION,
+ "Invalid option: Reconfigure: "
+ "lookup-unhashed should be boolean,"
" not (%s), defaulting to (%d)",
temp_str, conf->search_unhashed);
ret = -1;
goto out;
}
} else {
- gf_log(this->name, GF_LOG_DEBUG, "Reconfigure:"
- " lookup-unhashed reconfigured auto ");
+ gf_msg_debug(this->name, 0, "Reconfigure:"
+ " lookup-unhashed reconfigured auto ");
conf->search_unhashed = GF_DHT_LOOKUP_UNHASHED_AUTO;
}
}
@@ -453,8 +457,10 @@ gf_defrag_pattern_list_fill (xlator_t *this, gf_defrag_info_t *defrag, char *dat
pattern = "*";
}
} else if (gf_string2bytesize_uint64 (num, &pattern_list->size) != 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "invalid number format \"%s\"", num);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_OPTION,
+ "Invalid option. Defrag pattern:"
+ " Invalid number format \"%s\"", num);
goto out;
}
memcpy (pattern_list->path_pattern, pattern, strlen (dup_str));
@@ -499,13 +505,15 @@ dht_init (xlator_t *this)
GF_VALIDATE_OR_GOTO ("dht", this, err);
if (!this->children) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ DHT_MSG_INVALID_CONFIGURATION,
"Distribute needs more than one subvolume");
return -1;
}
if (!this->parents) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_INVALID_CONFIGURATION,
"dangling volume. check volfile");
}
@@ -530,14 +538,17 @@ dht_init (xlator_t *this)
ret = dict_get_str (this->options, "node-uuid", &node_uuid);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "node-uuid not "
- "specified");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_CONFIGURATION,
+ "Invalid volume configuration: "
+ "node-uuid not specified");
goto err;
}
if (uuid_parse (node_uuid, defrag->node_uuid)) {
- gf_log (this->name, GF_LOG_ERROR, "Cannot parse "
- "glusterd node uuid");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_OPTION, "Invalid option:"
+ " Cannot parse glusterd node uuid");
goto err;
}
@@ -581,8 +592,12 @@ dht_init (xlator_t *this)
== 0) {
if (gf_defrag_pattern_list_fill (this, defrag, temp_str)
== -1) {
- gf_log (this->name, GF_LOG_ERROR, "Cannot parse"
- " rebalance-filter (%s)", temp_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_OPTION,
+ "Invalid option:"
+ " Cannot parse rebalance-filter (%s)",
+ temp_str);
+
goto err;
}
}
@@ -621,7 +636,9 @@ dht_init (xlator_t *this)
this->local_pool = mem_pool_new (dht_local_t, 512);
if (!this->local_pool) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INIT_FAILED,
+ " DHT initialisation failed. "
"failed to create local_t's memory pool");
goto err;
}
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index e934acdf00a..f188a5479f4 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -62,9 +62,9 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* non-directory and not a linkfile */
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "could not set pre-set layout for subvol %s",
- prev->this->name);
+ gf_msg_debug (this->name, 0,
+ "could not set pre-set layout for subvol"
+ " %s", prev->this->name);
op_ret = -1;
op_errno = EINVAL;
goto err;
@@ -102,9 +102,9 @@ nufa_local_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_DEBUG,
- "linkfile not having link subvolume. path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "linkfile has no link subvolume. path=%s",
+ loc->path);
dht_lookup_everywhere (frame, this, loc);
return 0;
}
@@ -118,9 +118,9 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
if (!local->hashed_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- local->loc.path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ local->loc.path);
local->op_errno = ENOENT;
dht_lookup_everywhere (frame, this, loc);
return 0;
@@ -180,17 +180,17 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
if (is_revalidate (loc)) {
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "revalidate without cache. path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "revalidate lookup without cache. "
+ "path=%s", loc->path);
op_errno = EINVAL;
goto err;
}
if (layout->gen && (layout->gen < conf->gen)) {
- gf_log (this->name, GF_LOG_DEBUG,
- "incomplete layout failure for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "incomplete layout failure for path=%s",
+ loc->path);
dht_layout_unref (this, local->layout);
goto do_fresh_lookup;
}
@@ -312,9 +312,9 @@ nufa_create (call_frame_t *frame, xlator_t *this,
subvol = dht_subvol_get_hashed (this, loc);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ loc->path);
op_errno = ENOENT;
goto err;
}
@@ -339,8 +339,8 @@ nufa_create (call_frame_t *frame, xlator_t *this,
return 0;
}
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path, subvol->name);
STACK_WIND (frame, dht_create_cbk,
subvol, subvol->fops->create,
@@ -416,9 +416,9 @@ nufa_mknod (call_frame_t *frame, xlator_t *this,
subvol = dht_subvol_get_hashed (this, loc);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ loc->path);
op_errno = ENOENT;
goto err;
}
@@ -446,8 +446,8 @@ nufa_mknod (call_frame_t *frame, xlator_t *this,
return 0;
}
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path, subvol->name);
STACK_WIND_COOKIE (frame, dht_newfile_cbk, (void *)subvol, subvol,
subvol->fops->mknod, loc, mode, rdev, umask,
diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c
index 2717ce97541..0071dfa265d 100644
--- a/xlators/cluster/dht/src/switch.c
+++ b/xlators/cluster/dht/src/switch.c
@@ -146,9 +146,10 @@ switch_local_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_DEBUG,
- "could not set pre-set layout for subvol %s",
- prev->this->name);
+ gf_msg_debug (this->name, 0,
+ "could not set pre-set layout "
+ "for subvol %s",
+ prev->this->name);
op_ret = -1;
op_errno = EINVAL;
goto err;
@@ -171,8 +172,8 @@ switch_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!local->layout) {
op_ret = -1;
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_DEBUG,
- "memory allocation failed :(");
+ gf_msg_debug (this->name, 0,
+ "memory allocation failed :(");
goto err;
}
@@ -188,9 +189,9 @@ switch_local_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_DEBUG,
- "linkfile not having link subvolume. path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "linkfile has no link subvolume.path=%s",
+ loc->path);
dht_lookup_everywhere (frame, this, loc);
return 0;
}
@@ -204,9 +205,9 @@ switch_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
if (!local->hashed_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- local->loc.path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ local->loc.path);
local->op_errno = ENOENT;
dht_lookup_everywhere (frame, this, loc);
return 0;
@@ -268,17 +269,17 @@ switch_lookup (call_frame_t *frame, xlator_t *this,
if (is_revalidate (loc)) {
layout = local->layout;
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
- "revalidate without cache. path=%s",
- loc->path);
+ gf_msg_debug(this->name, 0,
+ "revalidate lookup without cache. path=%s",
+ loc->path);
op_errno = EINVAL;
goto err;
}
if (layout->gen && (layout->gen < conf->gen)) {
- gf_log (this->name, GF_LOG_DEBUG,
- "incomplete layout failure for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "incomplete layout failure for path=%s",
+ loc->path);
dht_layout_unref (this, local->layout);
goto do_fresh_lookup;
}
@@ -325,10 +326,10 @@ switch_lookup (call_frame_t *frame, xlator_t *this,
conf->link_xattr_name);
if (!hashed_subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s, "
- "checking on all the subvols to see if "
- "it is a directory", loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s, "
+ "checking on all the subvols to see if "
+ "it is a directory", loc->path);
call_cnt = conf->subvolume_cnt;
local->call_cnt = call_cnt;
@@ -427,9 +428,9 @@ switch_create (call_frame_t *frame, xlator_t *this,
subvol = dht_subvol_get_hashed (this, loc);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ loc->path);
op_errno = ENOENT;
goto err;
}
@@ -452,8 +453,8 @@ switch_create (call_frame_t *frame, xlator_t *this,
return 0;
}
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path, subvol->name);
STACK_WIND (frame, dht_create_cbk,
subvol, subvol->fops->create,
@@ -526,9 +527,9 @@ switch_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
subvol = dht_subvol_get_hashed (this, loc);
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no subvolume in layout for path=%s",
- loc->path);
+ gf_msg_debug (this->name, 0,
+ "no subvolume in layout for path=%s",
+ loc->path);
op_errno = ENOENT;
goto err;
}
@@ -555,8 +556,8 @@ switch_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
return 0;
}
- gf_log (this->name, GF_LOG_TRACE,
- "creating %s on %s", loc->path, subvol->name);
+ gf_msg_trace (this->name, 0,
+ "creating %s on %s", loc->path, subvol->name);
STACK_WIND_COOKIE (frame, dht_newfile_cbk, (void *)subvol, subvol,
subvol->fops->mknod, loc, mode, rdev, umask,
@@ -701,13 +702,13 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf,
for (index = 0; index < child_count; index++) {
if (strcmp (switch_buf_array[index].xl->name,
child) == 0) {
- gf_log ("switch", GF_LOG_DEBUG,
- "'%s' pattern will be "
- "scheduled to \"%s\"",
- switch_opt->path_pattern, child);
+ gf_msg_debug ("switch", 0,
+ "'%s' pattern will be "
+ "scheduled to \"%s\"",
+ switch_opt->path_pattern, child);
/*
if (switch_buf_array[index-1].considered) {
- gf_log ("switch", GF_LOG_DEBUG,
+ gf_msg_debug ("switch", 0,
"ambiguity found, exiting");
return -1;
}
@@ -777,10 +778,11 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf,
/* check for considered flag */
if (switch_buf_array[index].considered)
continue;
- gf_log ("switch", GF_LOG_DEBUG,
- "'%s' pattern will be scheduled to \"%s\"",
- switch_opt->path_pattern,
- switch_buf_array[index].xl->name);
+ gf_msg_debug ("switch", 0, "'%s'"
+ " pattern will be scheduled to \"%s\"",
+ switch_opt->path_pattern,
+ switch_buf_array[index].xl->name);
+
switch_opt->array[flag].xl =
switch_buf_array[index].xl;
switch_buf_array[index].considered = 1;