summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/fd-lk.c47
-rw-r--r--libglusterfs/src/fd.c82
-rw-r--r--libglusterfs/src/inode.c150
3 files changed, 172 insertions, 107 deletions
diff --git a/libglusterfs/src/fd-lk.c b/libglusterfs/src/fd-lk.c
index 3c1befea966..01c6c1a0157 100644
--- a/libglusterfs/src/fd-lk.c
+++ b/libglusterfs/src/fd-lk.c
@@ -10,7 +10,7 @@
#include "fd-lk.h"
#include "common-utils.h"
-
+#include "libglusterfs-messages.h"
int32_t
_fd_lk_delete_lock (fd_lk_ctx_node_t *lock)
@@ -89,8 +89,8 @@ fd_lk_ctx_t *
_fd_lk_ctx_ref (fd_lk_ctx_t *lk_ctx)
{
if (!lk_ctx) {
- gf_log_callingfn ("fd", GF_LOG_WARNING,
- "invalid argument");
+ gf_msg_callingfn ("fd-lk", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
return NULL;
}
@@ -105,8 +105,8 @@ fd_lk_ctx_ref (fd_lk_ctx_t *lk_ctx)
fd_lk_ctx_t *new_lk_ctx = NULL;
if (!lk_ctx) {
- gf_log_callingfn ("fd", GF_LOG_WARNING,
- "invalid argument");
+ gf_msg_callingfn ("fd-lk", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
return NULL;
}
@@ -418,19 +418,18 @@ print_lock_list (fd_lk_ctx_t *lk_ctx)
{
fd_lk_ctx_node_t *lk = NULL;
- gf_log ("fd-lk", GF_LOG_DEBUG, "lock list:");
+ gf_msg_debug ("fd-lk", 0, "lock list:");
list_for_each_entry (lk, &lk_ctx->lk_list, next)
- gf_log ("fd-lk", GF_LOG_DEBUG, "owner = %s, "
- "cmd = %s fl_type = %s, fs_start = %"PRId64", "
- "fs_end = %"PRId64", user_flock: l_type = %s, "
- "l_start = %"PRId64", l_len = %"PRId64", ",
- lkowner_utoa (&lk->user_flock.l_owner),
- get_lk_cmd (lk->cmd), get_lk_type (lk->fl_type),
- lk->fl_start, lk->fl_end,
- get_lk_type (lk->user_flock.l_type),
- lk->user_flock.l_start,
- lk->user_flock.l_len);
+ gf_msg_debug ("fd-lk", 0, "owner = %s, cmd = %s fl_type = %s,"
+ " fs_start = %"PRId64", fs_end = %"PRId64", "
+ "user_flock: l_type = %s, l_start = %"PRId64", "
+ "l_len = %"PRId64", ",
+ lkowner_utoa (&lk->user_flock.l_owner),
+ get_lk_cmd (lk->cmd), get_lk_type (lk->fl_type),
+ lk->fl_start, lk->fl_end,
+ get_lk_type (lk->user_flock.l_type),
+ lk->user_flock.l_start, lk->user_flock.l_len);
}
int
@@ -447,15 +446,13 @@ fd_lk_insert_and_merge (fd_t *fd, int32_t cmd,
lk_ctx = fd_lk_ctx_ref (fd->lk_ctx);
lk = fd_lk_ctx_node_new (cmd, flock);
- gf_log ("fd-lk", GF_LOG_DEBUG,
- "new lock requrest: owner = %s, fl_type = %s, "
- "fs_start = %"PRId64", fs_end = %"PRId64", "
- "user_flock: l_type = %s, l_start = %"PRId64", "
- "l_len = %"PRId64, lkowner_utoa (&flock->l_owner),
- get_lk_type (lk->fl_type), lk->fl_start,
- lk->fl_end, get_lk_type (lk->user_flock.l_type),
- lk->user_flock.l_start,
- lk->user_flock.l_len);
+ gf_msg_debug ("fd-lk", 0, "new lock requrest: owner = %s, fl_type = %s"
+ ", fs_start = %"PRId64", fs_end = %"PRId64", user_flock:"
+ " l_type = %s, l_start = %"PRId64", l_len = %"PRId64,
+ lkowner_utoa (&flock->l_owner),
+ get_lk_type (lk->fl_type), lk->fl_start, lk->fl_end,
+ get_lk_type (lk->user_flock.l_type),
+ lk->user_flock.l_start, lk->user_flock.l_len);
LOCK (&lk_ctx->lock);
{
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 1a191f340eb..af0d66da1ec 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -13,7 +13,7 @@
#include "inode.h"
#include "dict.h"
#include "statedump.h"
-
+#include "libglusterfs-messages.h"
static int
@@ -30,7 +30,8 @@ gf_fd_chain_fd_entries (fdentry_t *entries, uint32_t startidx,
uint32_t i = 0;
if (!entries) {
- gf_log_callingfn ("fd", GF_LOG_WARNING, "!entries");
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!entries");
return -1;
}
@@ -55,7 +56,8 @@ gf_fd_fdtable_expand (fdtable_t *fdtable, uint32_t nr)
int ret = -1;
if (fdtable == NULL || nr > UINT32_MAX) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
ret = EINVAL;
goto out;
}
@@ -122,7 +124,8 @@ __gf_fd_fdtable_get_all_fds (fdtable_t *fdtable, uint32_t *count)
fdentry_t *fdentries = NULL;
if (count == NULL) {
- gf_log_callingfn ("fd", GF_LOG_WARNING, "!count");
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!count");
goto out;
}
@@ -161,7 +164,8 @@ __gf_fd_fdtable_copy_all_fds (fdtable_t *fdtable, uint32_t *count)
int i = 0;
if (count == NULL) {
- gf_log_callingfn ("fd", GF_LOG_WARNING, "!count");
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!count");
goto out;
}
@@ -213,7 +217,8 @@ gf_fd_fdtable_destroy (fdtable_t *fdtable)
INIT_LIST_HEAD (&list);
if (!fdtable) {
- gf_log_callingfn ("fd", GF_LOG_WARNING, "!fdtable");
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!fdtable");
return;
}
@@ -248,7 +253,8 @@ gf_fd_unused_get (fdtable_t *fdtable, fd_t *fdptr)
int alloc_attempts = 0;
if (fdtable == NULL || fdptr == NULL) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
return EINVAL;
}
@@ -266,7 +272,8 @@ gf_fd_unused_get (fdtable_t *fdtable, fd_t *fdptr)
* seriously wrong with our data structures.
*/
if (alloc_attempts >= 2) {
- gf_log ("fd", GF_LOG_ERROR,
+ gf_msg ("fd", GF_LOG_ERROR, 0,
+ LG_MSG_EXPAND_FD_TABLE_FAILED,
"multiple attempts to expand fd table"
" have failed.");
goto out;
@@ -274,7 +281,8 @@ gf_fd_unused_get (fdtable_t *fdtable, fd_t *fdptr)
error = gf_fd_fdtable_expand (fdtable,
fdtable->max_fds + 1);
if (error) {
- gf_log ("fd", GF_LOG_ERROR,
+ gf_msg ("fd", GF_LOG_ERROR, 0,
+ LG_MSG_EXPAND_FD_TABLE_FAILED,
"Cannot expand fdtable: %s",
strerror (error));
goto out;
@@ -307,12 +315,14 @@ gf_fd_put (fdtable_t *fdtable, int32_t fd)
return;
if (fdtable == NULL || fd < 0) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
return;
}
if (!(fd < fdtable->max_fds)) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
return;
}
@@ -349,7 +359,8 @@ gf_fdptr_put (fdtable_t *fdtable, fd_t *fd)
int32_t i = 0;
if ((fdtable == NULL) || (fd == NULL)) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
return;
}
@@ -363,8 +374,10 @@ gf_fdptr_put (fdtable_t *fdtable, fd_t *fd)
}
if (fde == NULL) {
- gf_log_callingfn ("fd", GF_LOG_WARNING,
- "fd (%p) is not present in fdtable", fd);
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, 0,
+ LG_MSG_FD_NOT_FOUND_IN_FDTABLE,
+ "fd (%p) is not present in fdtable",
+ fd);
goto unlock_out;
}
@@ -396,13 +409,15 @@ gf_fd_fdptr_get (fdtable_t *fdtable, int64_t fd)
fd_t *fdptr = NULL;
if (fdtable == NULL || fd < 0) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
errno = EINVAL;
return NULL;
}
if (!(fd < fdtable->max_fds)) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
errno = EINVAL;
return NULL;
}
@@ -435,7 +450,8 @@ fd_ref (fd_t *fd)
fd_t *refed_fd = NULL;
if (!fd) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "null fd");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "null fd");
return NULL;
}
@@ -470,12 +486,15 @@ fd_destroy (fd_t *fd)
xlator_t *old_THIS = NULL;
if (fd == NULL){
- gf_log_callingfn ("xlator", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("xlator", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
goto out;
}
if (fd->inode == NULL){
- gf_log_callingfn ("xlator", GF_LOG_ERROR, "fd->inode is NULL");
+ gf_msg_callingfn ("xlator", GF_LOG_ERROR, 0,
+ LG_MSG_FD_INODE_NULL,
+ "fd->inode is NULL");
goto out;
}
if (!fd->_ctx)
@@ -528,7 +547,8 @@ fd_unref (fd_t *fd)
int32_t refcount = 0;
if (!fd) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "fd is NULL");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "fd is NULL");
return;
}
@@ -562,7 +582,8 @@ fd_t *
fd_bind (fd_t *fd)
{
if (!fd || !fd->inode) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "!fd || !fd->inode");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "!fd || !fd->inode");
return NULL;
}
@@ -582,7 +603,8 @@ __fd_create (inode_t *inode, uint64_t pid)
fd_t *fd = NULL;
if (inode == NULL) {
- gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_msg_callingfn ("fd", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid argument");
return NULL;
}
@@ -682,7 +704,8 @@ fd_lookup (inode_t *inode, pid_t pid)
fd_t *fd = NULL;
if (!inode) {
- gf_log_callingfn ("fd", GF_LOG_WARNING, "!inode");
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!inode");
return NULL;
}
@@ -701,7 +724,8 @@ fd_lookup_uint64 (inode_t *inode, uint64_t pid)
fd_t *fd = NULL;
if (!inode) {
- gf_log_callingfn ("fd", GF_LOG_WARNING, "!inode");
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!inode");
return NULL;
}
@@ -781,7 +805,8 @@ fd_lookup_anonymous (inode_t *inode)
fd_t *fd = NULL;
if (!inode) {
- gf_log_callingfn ("fd", GF_LOG_WARNING, "!inode");
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!inode");
return NULL;
}
@@ -850,10 +875,6 @@ __fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
(sizeof (struct _fd_ctx)
* new_xl_count));
if (tmp == NULL) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING,
- "realloc of fd->_ctx for fd "
- "(ptr: %p) failed, cannot set the key"
- , fd);
ret = -1;
goto out;
}
@@ -885,7 +906,8 @@ fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
int ret = 0;
if (!fd || !xlator) {
- gf_log_callingfn ("", GF_LOG_WARNING, "%p %p", fd, xlator);
+ gf_msg_callingfn ("fd", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "%p %p", fd, xlator);
return -1;
}
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 47096de5410..f0bb5238d56 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -18,6 +18,7 @@
#include "list.h"
#include <time.h>
#include <assert.h>
+#include "libglusterfs-messages.h"
/* TODO:
move latest accessed dentry to list_head of inode
@@ -80,7 +81,8 @@ __dentry_hash (dentry_t *dentry)
int hash = 0;
if (!dentry) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_DENTRY_NOT_FOUND, "dentry not found");
return;
}
@@ -97,7 +99,8 @@ static int
__is_dentry_hashed (dentry_t *dentry)
{
if (!dentry) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_DENTRY_NOT_FOUND, "dentry not found");
return 0;
}
@@ -109,7 +112,8 @@ static void
__dentry_unhash (dentry_t *dentry)
{
if (!dentry) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_DENTRY_NOT_FOUND, "dentry not found");
return;
}
@@ -121,7 +125,8 @@ static void
__dentry_unset (dentry_t *dentry)
{
if (!dentry) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_DENTRY_NOT_FOUND, "dentry not found");
return;
}
@@ -152,19 +157,24 @@ __foreach_ancestor_dentry (dentry_t *dentry,
int ret = 0;
if (!dentry) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_DENTRY_NOT_FOUND, "dentry not found");
return 0;
}
ret = per_dentry_fn (dentry, data);
if (ret) {
- gf_log (THIS->name, GF_LOG_WARNING, "per dentry fn returned %d", ret);
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_PER_DENTRY_FAILED, "per dentry fn returned %d",
+ ret);
goto out;
}
parent = dentry->parent;
if (!parent) {
- gf_log (THIS->name, GF_LOG_WARNING, "parent not found");
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_PARENT_DENTRY_NOT_FOUND,
+ "parent not found");
goto out;
}
@@ -207,10 +217,10 @@ __is_dentry_cyclic (dentry_t *dentry)
if (dentry->name)
name = dentry->name;
- gf_log (dentry->inode->table->name, GF_LOG_CRITICAL,
- "detected cyclic loop formation during inode linkage."
- " inode (%s) linking under itself as %s",
- uuid_utoa (inode->gfid), name);
+ gf_msg (dentry->inode->table->name, GF_LOG_CRITICAL, 0,
+ LG_MSG_DENTRY_CYCLIC_LOOP, "detected cyclic loop "
+ "formation during inode linkage. inode (%s) linking "
+ "under itself as %s", uuid_utoa (inode->gfid), name);
}
return ret;
@@ -221,7 +231,8 @@ static void
__inode_unhash (inode_t *inode)
{
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return;
}
@@ -233,7 +244,8 @@ static int
__is_inode_hashed (inode_t *inode)
{
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return 0;
}
@@ -248,7 +260,8 @@ __inode_hash (inode_t *inode)
int hash = 0;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return;
}
@@ -267,7 +280,9 @@ __dentry_search_for_inode (inode_t *inode, uuid_t pargfid, const char *name)
dentry_t *tmp = NULL;
if (!inode || !name) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode || name not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG,
+ "inode || name not found");
return NULL;
}
@@ -297,12 +312,14 @@ __inode_ctx_free (inode_t *inode)
xlator_t *old_THIS = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return;
}
if (!inode->_ctx) {
- gf_log (THIS->name, GF_LOG_WARNING, "_ctx not found");
+ gf_msg (THIS->name, GF_LOG_WARNING, 0, LG_MSG_CTX_NULL,
+ "_ctx not found");
goto noctx;
}
@@ -328,7 +345,8 @@ static void
__inode_destroy (inode_t *inode)
{
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return;
}
@@ -347,12 +365,14 @@ inode_ctx_merge (fd_t *fd, inode_t *inode, inode_t *linked_inode)
xlator_t *old_THIS = NULL;
if (!fd || !inode || !linked_inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "invalid inode");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid inode");
return;
}
if (!inode->_ctx || !linked_inode->_ctx) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING,
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG,
"invalid inode context");
return;
}
@@ -389,7 +409,8 @@ __inode_passivate (inode_t *inode)
dentry_t *t = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return;
}
@@ -410,7 +431,8 @@ __inode_retire (inode_t *inode)
dentry_t *t = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return;
}
@@ -531,7 +553,8 @@ __dentry_create (inode_t *inode, inode_t *parent, const char *name)
dentry_t *newd = NULL;
if (!inode || !parent || !name) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING,
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG,
"inode || parent || name not found");
return NULL;
}
@@ -568,7 +591,9 @@ __inode_create (inode_table_t *table)
inode_t *newi = NULL;
if (!table) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "table not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_TABLE_NOT_FOUND, "table not "
+ "found");
return NULL;
}
@@ -611,7 +636,9 @@ inode_new (inode_table_t *table)
inode_t *inode = NULL;
if (!table) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_TABLE_NOT_FOUND, "inode not "
+ "found");
return NULL;
}
@@ -722,8 +749,9 @@ inode_grep (inode_table_t *table, inode_t *parent, const char *name)
dentry_t *dentry = NULL;
if (!table || !parent || !name) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING,
- "table || parent || name not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "table || parent || name"
+ " not found");
return NULL;
}
@@ -795,8 +823,9 @@ inode_grep_for_gfid (inode_table_t *table, inode_t *parent, const char *name,
int ret = -1;
if (!table || !parent || !name) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING,
- "table || parent || name not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "table || parent || name"
+ " not found");
return ret;
}
@@ -843,7 +872,9 @@ __inode_find (inode_table_t *table, uuid_t gfid)
int hash = 0;
if (!table) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "table not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_TABLE_NOT_FOUND, "table not "
+ "found");
goto out;
}
@@ -870,7 +901,9 @@ inode_find (inode_table_t *table, uuid_t gfid)
inode_t *inode = NULL;
if (!table) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "table not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_TABLE_NOT_FOUND, "table not "
+ "found");
return NULL;
}
@@ -971,7 +1004,8 @@ __inode_link (inode_t *inode, inode_t *parent, const char *name,
if (!old_dentry || old_dentry->inode != link_inode) {
dentry = __dentry_create (link_inode, parent, name);
if (!dentry) {
- gf_log_callingfn (THIS->name, GF_LOG_ERROR,
+ gf_msg_callingfn (THIS->name, GF_LOG_ERROR, 0,
+ LG_MSG_DENTRY_CREATE_FAILED,
"dentry create failed on "
"inode %s with parent %s",
uuid_utoa (link_inode->gfid),
@@ -1001,7 +1035,8 @@ inode_link (inode_t *inode, inode_t *parent, const char *name,
inode_t *linked_inode = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return NULL;
}
@@ -1028,7 +1063,8 @@ inode_lookup (inode_t *inode)
inode_table_t *table = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return -1;
}
@@ -1050,7 +1086,8 @@ inode_ref_reduce_by_n (inode_t *inode, uint64_t nref)
inode_table_t *table = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return -1;
}
@@ -1074,7 +1111,8 @@ inode_forget (inode_t *inode, uint64_t nlookup)
inode_table_t *table = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return -1;
}
@@ -1104,7 +1142,8 @@ inode_invalidate(inode_t *inode)
xlator_t *old_THIS = NULL;
if (!inode) {
- gf_log_callingfn(THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn(THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return -1;
}
@@ -1156,8 +1195,9 @@ __inode_unlink (inode_t *inode, inode_t *parent, const char *name)
if (dentry) {
__dentry_unset (dentry);
} else {
- gf_log ("inode", GF_LOG_WARNING, "%s/%s: dentry not "
- "found in %s", uuid_utoa_r (parent->gfid, pgfid), name,
+ gf_msg ("inode", GF_LOG_WARNING, 0, LG_MSG_DENTRY_NOT_FOUND,
+ "%s/%s: dentry not found in %s",
+ uuid_utoa_r (parent->gfid, pgfid), name,
uuid_utoa_r (inode->gfid, gfid));
}
@@ -1170,7 +1210,8 @@ inode_unlink (inode_t *inode, inode_t *parent, const char *name)
inode_table_t *table = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return;
}
@@ -1192,7 +1233,8 @@ inode_rename (inode_table_t *table, inode_t *srcdir, const char *srcname,
struct iatt *iatt)
{
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return -1;
}
@@ -1246,7 +1288,8 @@ inode_parent (inode_t *inode, uuid_t pargfid, const char *name)
dentry_t *dentry = NULL;
if (!inode) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
return NULL;
}
@@ -1285,7 +1328,8 @@ __inode_path (inode_t *inode, const char *name, char **bufp)
if (!inode || gf_uuid_is_null (inode->gfid)) {
GF_ASSERT (0);
- gf_log_callingfn (THIS->name, GF_LOG_WARNING, "invalid inode");
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "invalid inode");
return -EINVAL;
}
@@ -1298,9 +1342,10 @@ __inode_path (inode_t *inode, const char *name, char **bufp)
i ++; /* "/" */
i += strlen (trav->name);
if (i > PATH_MAX) {
- gf_log (table->name, GF_LOG_CRITICAL,
- "possible infinite loop detected, "
- "forcing break. name=(%s)", name);
+ gf_msg (table->name, GF_LOG_CRITICAL, 0,
+ LG_MSG_DENTRY_CYCLIC_LOOP, "possible infinite "
+ "loop detected, forcing break. name=(%s)",
+ name);
ret = -ENOENT;
goto out;
}
@@ -1618,12 +1663,13 @@ inode_table_ctx_free (inode_table_t *table)
ret = purge_count + lru_count + active_count;
itable_size = table->active_size + table->lru_size + table->purge_size;
- gf_log_callingfn (this->name, GF_LOG_INFO, "total %d (itable size: %d) "
- "inode contexts have been freed (active: %d, "
- "(active size: %d), lru: %d, (lru size: %d), "
- " purge: %d, (purge size: %d))", ret, itable_size,
- active_count, table->active_size, lru_count,
- table->lru_size, purge_count, table->purge_size);
+ gf_msg_callingfn (this->name, GF_LOG_INFO, 0,
+ LG_MSG_INODE_CONTEXT_FREED, "total %d (itable size: "
+ "%d) inode contexts have been freed (active: %d, ("
+ "active size: %d), lru: %d, (lru size: %d), purge: "
+ "%d, (purge size: %d))", ret, itable_size,
+ active_count, table->active_size, lru_count,
+ table->lru_size, purge_count, table->purge_size);
return ret;
}