summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs-common.c
diff options
context:
space:
mode:
authorManikandan Selvaganesh <mselvaga@redhat.com>2015-04-13 15:50:12 +0530
committerNiels de Vos <ndevos@redhat.com>2015-04-28 11:57:54 -0700
commitf3ff9abbe5f80911a88222cbdbcfa8616b4743da (patch)
treea7e534c08da195e0a9ce87cbc47d2d8d1d8e80ec /xlators/nfs/server/src/nfs-common.c
parentee6cd10ce947787bf6ea589bca1cb259c4bb214d (diff)
nfs / nfs files : porting log messages to new framework
Porting log messages to a new framework for nfs-common.c, nfs-fops.c, nfs-fops.h, nfs-inodes.c, nfs3-fh.c, nfs3-helpers.c. Change-Id: I55cd94de62eafe6ad3754cd065d7459a81a9f285 BUG: 1194640 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/10214 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/nfs/server/src/nfs-common.c')
-rw-r--r--xlators/nfs/server/src/nfs-common.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index 547e5b3a833..b6791566c2c 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -24,6 +24,7 @@
#include "nfs-mem-types.h"
#include "rpcsvc.h"
#include "iatt.h"
+#include "nfs-messages.h"
#include <libgen.h>
@@ -87,7 +88,7 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path)
volname = strdupa (path);
pathlen = strlen (volname);
- gf_log (GF_NFS, GF_LOG_TRACE, "Subvolume search: %s", path);
+ gf_msg_trace (GF_NFS, 0, "Subvolume search: %s", path);
if (volname[0] == '/')
volptr = &volname[1];
else
@@ -167,7 +168,8 @@ nfs_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path)
if (path) {
loc->path = gf_strdup (path);
if (!loc->path) {
- gf_log (GF_NFS, GF_LOG_ERROR, "strdup failed");
+ gf_msg (GF_NFS, GF_LOG_ERROR, ENOMEM,
+ NFS_MSG_NO_MEMORY, "strdup failed");
goto loc_wipe;
}
loc->name = strrchr (loc->path, '/');
@@ -201,8 +203,9 @@ nfs_inode_loc_fill (inode_t *inode, loc_t *loc, int how)
if (!gf_uuid_is_null (inode->gfid)) {
ret = inode_path (inode, NULL, &resolvedpath);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed "
- "%s", resolvedpath);
+ gf_msg (GF_NFS, GF_LOG_ERROR, 0,
+ NFS_MSG_PATH_RESOLVE_FAIL, "path resolution "
+ "failed %s", resolvedpath);
goto err;
}
}
@@ -218,8 +221,9 @@ nfs_inode_loc_fill (inode_t *inode, loc_t *loc, int how)
ret = nfs_loc_fill (loc, inode, parent, resolvedpath);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "loc fill resolution failed %s",
- resolvedpath);
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret,
+ NFS_MSG_LOC_FILL_RESOLVE_FAIL,
+ "loc fill resolution failed %s", resolvedpath);
goto err;
}
@@ -244,31 +248,37 @@ nfs_gfid_loc_fill (inode_table_t *itable, uuid_t gfid, loc_t *loc, int how)
inode = inode_find (itable, gfid);
if (!inode) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Inode not found in itable, will try to create one.");
+ gf_msg_trace (GF_NFS, 0, "Inode not found in itable, will "
+ "try to create one.");
if (how == NFS_RESOLVE_CREATE) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Inode needs to be created.");
+ gf_msg_trace (GF_NFS, 0, "Inode needs to be created.");
inode = inode_new (itable);
if (!inode) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to "
+ gf_msg (GF_NFS, GF_LOG_ERROR, ENOMEM,
+ NFS_MSG_NO_MEMORY, "Failed to "
"allocate memory");
ret = -ENOMEM;
goto err;
}
} else {
- gf_log (GF_NFS, GF_LOG_ERROR, "Inode not found in itable and no creation was requested.");
+ gf_msg (GF_NFS, GF_LOG_ERROR, ENOENT,
+ NFS_MSG_INODE_NOT_FOUND, "Inode not found in "
+ "itable and no creation was requested.");
ret = -ENOENT;
goto err;
}
} else {
- gf_log (GF_NFS, GF_LOG_TRACE, "Inode was found in the itable.");
+ gf_msg_trace (GF_NFS, 0, "Inode was found in the itable.");
}
gf_uuid_copy (loc->gfid, gfid);
ret = nfs_inode_loc_fill (inode, loc, how);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Inode loc filling failed.: %s", strerror (-ret));
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret,
+ NFS_MSG_INODE_LOC_FILL_ERROR,
+ "Inode loc filling failed.: %s", strerror (-ret));
goto err;
}
@@ -302,8 +312,8 @@ nfs_parent_inode_loc_fill (inode_t *parent, inode_t *entryinode, char *entry,
ret = inode_path (parent, entry, &path);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed %s",
- path);
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret, NFS_MSG_PATH_RESOLVE_FAIL,
+ "path resolution failed %s", path);
goto err;
}
@@ -369,16 +379,16 @@ nfs_entry_loc_fill (inode_table_t *itable, uuid_t pargfid, char *entry,
ret = inode_path (parent, entry, &resolvedpath);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed %s",
- resolvedpath);
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret, NFS_MSG_PATH_RESOLVE_FAIL,
+ "path resolution failed %s", resolvedpath);
ret = -3;
goto err;
}
ret = nfs_loc_fill (loc, entryinode, parent, resolvedpath);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "loc_fill failed %s",
- resolvedpath);
+ gf_msg (GF_NFS, GF_LOG_ERROR, 0, NFS_MSG_INODE_LOC_FILL_ERROR,
+ "loc_fill failed %s", resolvedpath);
ret = -3;
}
@@ -449,7 +459,8 @@ nfs_fix_generation (xlator_t *this, inode_t *inode)
ictx = GF_CALLOC (1, sizeof (struct nfs_inode_ctx),
gf_nfs_mt_inode_ctx);
if (!ictx) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ NFS_MSG_NO_MEMORY,
"could not allocate nfs inode ctx");
return;
}
@@ -457,7 +468,8 @@ nfs_fix_generation (xlator_t *this, inode_t *inode)
ictx->generation = priv->generation;
ret = inode_ctx_put (inode, this, (uint64_t)ictx);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ NFS_MSG_INODE_CTX_STORE_FAIL,
"could not store nfs inode ctx");
return;
}