summaryrefslogtreecommitdiffstats
path: root/xlators/performance/symlink-cache/src/symlink-cache.c
diff options
context:
space:
mode:
authorarao <arao@redhat.com>2015-06-22 11:10:05 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-06-29 02:21:53 -0700
commitf6385aeb2f69b36fd02498259258f013582f706f (patch)
tree204f03a8f058e2ad7750814bb4af3d3b3955fb00 /xlators/performance/symlink-cache/src/symlink-cache.c
parent10dfc9b4d4d04314ccd0f6a4eb0ee0341fd91e0d (diff)
Logging: Porting the performance translator
logs to new logging framework > Change-Id: Ie6aaf8d30bd4457bb73c48e23e6b1dea27598644 > BUG: 1194640 > Signed-off-by: arao <arao@redhat.com> BUG: 1217722 Change-Id: I0856c43dbf8c0a1aa084d4478c9bdf3f41dfc0b8 Signed-off-by: arao <arao@redhat.com> Reviewed-on: http://review.gluster.org/11442 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/performance/symlink-cache/src/symlink-cache.c')
-rw-r--r--xlators/performance/symlink-cache/src/symlink-cache.c69
1 files changed, 38 insertions, 31 deletions
diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c
index c65629b6993..6ecfad41a21 100644
--- a/xlators/performance/symlink-cache/src/symlink-cache.c
+++ b/xlators/performance/symlink-cache/src/symlink-cache.c
@@ -22,6 +22,7 @@
#include "compat.h"
#include "compat-errno.h"
#include "common-utils.h"
+#include "symlink-cache-messages.h"
struct symlink_cache {
time_t ctime;
@@ -36,7 +37,8 @@ symlink_inode_ctx_get (inode_t *inode, xlator_t *this, void **ctx)
uint64_t tmp_ctx = 0;
ret = inode_ctx_get (inode, this, &tmp_ctx);
if (-1 == ret)
- gf_log (this->name, GF_LOG_ERROR, "dict get failed");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ SYMLINK_CACHE_MSG_DICT_GET_FAILED, "dict get failed");
else
*ctx = (void *)(long)tmp_ctx;
@@ -50,7 +52,8 @@ symlink_inode_ctx_set (inode_t *inode, xlator_t *this, void *ctx)
int ret = 0;
ret = inode_ctx_put (inode, this, (uint64_t)(long) ctx);
if (-1 == ret)
- gf_log (this->name, GF_LOG_ERROR, "dict set failed");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ SYMLINK_CACHE_MSG_DICT_SET_FAILED, "dict set failed");
return 0;
}
@@ -66,15 +69,15 @@ sc_cache_update (xlator_t *this, inode_t *inode, const char *link)
return 0;
if (!sc->readlink) {
- gf_log (this->name, GF_LOG_DEBUG,
- "updating cache: %s", link);
+ gf_msg_debug (this->name, 0,
+ "updating cache: %s", link);
sc->readlink = strdup (link);
- } else {
- gf_log (this->name, GF_LOG_DEBUG,
- "not updating existing cache: %s with %s",
- sc->readlink, link);
- }
+ } else
+ gf_msg_debug (this->name, 0,
+ "not updating existing cache: %s with %s",
+ sc->readlink, link);
+
return 0;
}
@@ -94,16 +97,17 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf,
need_set = 1;
sc = CALLOC (1, sizeof (*sc));
if (!sc) {
- gf_log (this->name, GF_LOG_ERROR,
- "out of memory :(");
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ SYMLINK_CACHE_MSG_NO_MEMORY,
+ "out of memory :(");
goto err;
}
}
if (sc->readlink) {
- gf_log (this->name, GF_LOG_DEBUG,
- "replacing old cache: %s with new cache: %s",
- sc->readlink, link);
+ gf_msg_debug (this->name, 0,
+ "replacing old cache: %s with new cache: %s",
+ sc->readlink, link);
FREE (sc->readlink);
sc->readlink = NULL;
}
@@ -111,24 +115,25 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf,
if (link) {
sc->readlink = strdup (link);
if (!sc->readlink) {
- gf_log (this->name, GF_LOG_ERROR,
- "out of memory :(");
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ SYMLINK_CACHE_MSG_NO_MEMORY,
+ "out of memory :(");
goto err;
}
}
sc->ctime = buf->ia_ctime;
- gf_log (this->name, GF_LOG_DEBUG,
- "setting symlink cache: %s", link);
+ gf_msg_debug (this->name, 0,
+ "setting symlink cache: %s", link);
if (need_set) {
ret = symlink_inode_ctx_set (inode, this, sc);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "could not set inode context (%s)",
- strerror (-ret));
+ gf_msg (this->name, GF_LOG_ERROR,
+ -ret, SYMLINK_CACHE_MSG_NO_MEMORY,
+ "could not set inode context ");
goto err;
}
}
@@ -156,8 +161,8 @@ sc_cache_flush (xlator_t *this, inode_t *inode)
return 0;
if (sc->readlink) {
- gf_log (this->name, GF_LOG_DEBUG,
- "flushing cache: %s", sc->readlink);
+ gf_msg_debug (this->name, 0,
+ "flushing cache: %s", sc->readlink);
FREE (sc->readlink);
sc->readlink = NULL;
@@ -199,8 +204,8 @@ sc_cache_validate (xlator_t *this, inode_t *inode, struct iatt *buf)
/* STALE */
if (sc->readlink) {
- gf_log (this->name, GF_LOG_DEBUG,
- "flushing cache: %s", sc->readlink);
+ gf_msg_debug (this->name, 0,
+ "flushing cache: %s", sc->readlink);
FREE (sc->readlink);
sc->readlink = NULL;
@@ -257,9 +262,9 @@ sc_readlink (call_frame_t *frame, xlator_t *this,
if (link) {
/* cache hit */
- gf_log (this->name, GF_LOG_DEBUG,
- "cache hit %s -> %s",
- loc->path, link);
+ gf_msg_debug (this->name, 0,
+ "cache hit %s -> %s",
+ loc->path, link);
/*
libglusterfsclient, nfs or any other translators
@@ -361,15 +366,17 @@ init (xlator_t *this)
{
if (!this->children || this->children->next)
{
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ SYMLINK_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED,
"FATAL: volume (%s) not configured with exactly one "
"child", this->name);
return -1;
}
if (!this->parents) {
- gf_log (this->name, GF_LOG_WARNING,
- "dangling volume. check volfile ");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ SYMLINK_CACHE_MSG_VOL_MISCONFIGURED,
+ "dangling volume. check volfile ");
}
return 0;