diff options
author | Amar Tumballi <amar@gluster.com> | 2011-06-16 06:43:12 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-06-16 22:02:13 -0700 |
commit | 0101eb0b6444dc22860d8fdc82170aefa87ff0b3 (patch) | |
tree | 83031b823600d1f905d36a15d26b427585c00cc1 /libglusterfs/src | |
parent | 25e8700721a71128c9f6143dc2effcdbcee692fc (diff) |
logging: fill proper domain names at places where it is missing
also changed some error messages where it was not explicit
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2346 (Log message enhancements in GlusterFS - phase 1)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/common-utils.c | 32 | ||||
-rw-r--r-- | libglusterfs/src/compat.c | 10 | ||||
-rw-r--r-- | libglusterfs/src/inode.c | 61 | ||||
-rw-r--r-- | libglusterfs/src/iobuf.c | 26 | ||||
-rw-r--r-- | libglusterfs/src/xlator.c | 6 |
5 files changed, 63 insertions, 72 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 15371d194..96beee179 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -455,7 +455,7 @@ gf_strsplit (const char *str, const char *delim, int j = 0; if (str == NULL || delim == NULL || tokens == NULL || token_count == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); return -1; } @@ -526,7 +526,7 @@ gf_strstr (const char *str, const char *delim, const char *match) tmp_str = strdup (str); if (str == NULL || delim == NULL || match == NULL || tmp_str == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); ret = -1; goto out; } @@ -557,7 +557,7 @@ gf_volume_name_validate (const char *volume_name) const char *vname = NULL; if (volume_name == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); return -1; } @@ -586,7 +586,7 @@ gf_string2time (const char *str, uint32_t *n) if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -641,7 +641,7 @@ gf_string2percent (const char *str, uint32_t *n) if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -694,7 +694,7 @@ _gf_string2long (const char *str, long *n, int base) if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -734,7 +734,7 @@ _gf_string2ulong (const char *str, unsigned long *n, int base) if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -789,7 +789,7 @@ _gf_string2uint (const char *str, unsigned int *n, int base) if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -842,7 +842,7 @@ _gf_string2double (const char *str, double *n) int old_errno = 0; if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -877,7 +877,7 @@ _gf_string2longlong (const char *str, long long *n, int base) if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -917,7 +917,7 @@ _gf_string2ulonglong (const char *str, unsigned long long *n, int base) if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -1308,7 +1308,7 @@ gf_string2bytesize (const char *str, uint64_t *n) if (str == NULL || n == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); errno = EINVAL; return -1; } @@ -1419,7 +1419,7 @@ int gf_string2boolean (const char *str, gf_boolean_t *b) { if (str == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); return -1; } @@ -1537,7 +1537,7 @@ get_checksum_for_path (char *path, uint32_t *checksum) fd = open (path, O_RDWR); if (fd == -1) { - gf_log ("", GF_LOG_ERROR, "Unable to open %s, errno: %d", + gf_log (THIS->name, GF_LOG_ERROR, "Unable to open %s, errno: %d", path, errno); goto out; } @@ -1666,7 +1666,7 @@ valid_internet_address (char *address) int length = 0; if (address == NULL) { - gf_log_callingfn ("", GF_LOG_WARNING, "arguement invalid"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "arguement invalid"); goto out; } @@ -1762,7 +1762,7 @@ gf_is_str_int (const char *value) char *str = NULL; char *fptr = NULL; - GF_VALIDATE_OR_GOTO ("", value, out); + GF_VALIDATE_OR_GOTO (THIS->name, value, out); str = gf_strdup (value); if (!str) diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c index 72bd0d3e2..2197272d9 100644 --- a/libglusterfs/src/compat.c +++ b/libglusterfs/src/compat.c @@ -181,7 +181,7 @@ solaris_xattr_resolve_path (const char *real_path, char **path) if (lstat (export_path, &statbuf)) { ret = mkdir (export_path, 0777); if (ret && (errno != EEXIST)) { - gf_log ("", GF_LOG_DEBUG, "mkdir failed," + gf_log (THIS->name, GF_LOG_DEBUG, "mkdir failed," " errno: %d", errno); goto out; } @@ -195,7 +195,7 @@ solaris_xattr_resolve_path (const char *real_path, char **path) if (ret) { ret = mknod (xattr_path, S_IFREG|O_WRONLY, 0); if (ret && (errno != EEXIST)) { - gf_log ("", GF_LOG_WARNING,"Failed to create " + gf_log (THIS->name, GF_LOG_WARNING,"Failed to create " "mapped file %s, error %d", xattr_path, errno); goto out; @@ -490,13 +490,13 @@ int solaris_unlink (const char *path) if (!ret && mapped_path) { if (lstat(path, &stbuf)) { - gf_log ("",GF_LOG_WARNING, "Stat failed on mapped" + gf_log (THIS->name, GF_LOG_WARNING, "Stat failed on mapped" " file %s with error %d", mapped_path, errno); goto out; } if (stbuf.st_nlink == 1) { if(remove (mapped_path)) - gf_log ("", GF_LOG_WARNING, "Failed to remove mapped " + gf_log (THIS->name, GF_LOG_WARNING, "Failed to remove mapped " "file %s. Errno %d", mapped_path, errno); } @@ -520,7 +520,7 @@ solaris_rename (const char *old_path, const char *new_path) if (!ret && mapped_path) { if (!remove (mapped_path)) - gf_log ("", GF_LOG_WARNING, "Failed to remove mapped " + gf_log (THIS->name, GF_LOG_WARNING, "Failed to remove mapped " "file %s. Errno %d", mapped_path, errno); GF_FREE (mapped_path); } diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index bfcc9e2bc..90b62a2f4 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -94,7 +94,7 @@ __dentry_hash (dentry_t *dentry) int hash = 0; if (!dentry) { - gf_log_callingfn ("", GF_LOG_WARNING, "dentry not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found"); return; } @@ -111,7 +111,7 @@ static int __is_dentry_hashed (dentry_t *dentry) { if (!dentry) { - gf_log_callingfn ("", GF_LOG_WARNING, "dentry not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found"); return 0; } @@ -123,7 +123,7 @@ static void __dentry_unhash (dentry_t *dentry) { if (!dentry) { - gf_log_callingfn ("", GF_LOG_WARNING, "dentry not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found"); return; } @@ -137,7 +137,7 @@ __dentry_unset (dentry_t *dentry) struct mem_pool *tmp_pool = NULL; if (!dentry) { - gf_log_callingfn ("", GF_LOG_WARNING, "dentry not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found"); return; } @@ -171,19 +171,19 @@ __foreach_ancestor_dentry (dentry_t *dentry, int ret = 0; if (!dentry) { - gf_log_callingfn ("", GF_LOG_WARNING, "dentry not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "dentry not found"); return 0; } ret = per_dentry_fn (dentry, data); if (ret) { - gf_log ("", GF_LOG_WARNING, "per dentry fn returned %d", ret); + gf_log (THIS->name, GF_LOG_WARNING, "per dentry fn returned %d", ret); goto out; } parent = dentry->parent; if (!parent) { - gf_log ("", GF_LOG_WARNING, "parent not found"); + gf_log (THIS->name, GF_LOG_WARNING, "parent not found"); goto out; } @@ -240,7 +240,7 @@ static void __inode_unhash (inode_t *inode) { if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return; } @@ -252,7 +252,7 @@ static int __is_inode_hashed (inode_t *inode) { if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return 0; } @@ -267,7 +267,7 @@ __inode_hash (inode_t *inode) int hash = 0; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return; } @@ -286,7 +286,7 @@ __dentry_search_for_inode (inode_t *inode, ino_t par, const char *name) dentry_t *tmp = NULL; if (!inode || !name) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode || name not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode || name not found"); return NULL; } @@ -310,12 +310,12 @@ __inode_destroy (inode_t *inode) struct mem_pool *tmp_pool = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return; } if (!inode->_ctx) { - gf_log ("", GF_LOG_WARNING, "_ctx not found"); + gf_log (THIS->name, GF_LOG_WARNING, "_ctx not found"); goto noctx; } @@ -360,7 +360,7 @@ __inode_passivate (inode_t *inode) dentry_t *t = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return; } @@ -381,7 +381,7 @@ __inode_retire (inode_t *inode) dentry_t *t = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return; } @@ -486,7 +486,7 @@ __dentry_create (inode_t *inode, inode_t *parent, const char *name) dentry_t *newd = NULL; if (!inode || !parent || !name) { - gf_log_callingfn ("", GF_LOG_WARNING, + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode || parent || name not found"); return NULL; } @@ -523,7 +523,7 @@ __inode_create (inode_table_t *table) inode_t *newi = NULL; if (!table) { - gf_log_callingfn ("", GF_LOG_WARNING, "table not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "table not found"); return NULL; } @@ -567,7 +567,7 @@ inode_new (inode_table_t *table) inode_t *inode = NULL; if (!table) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return NULL; } @@ -643,7 +643,7 @@ inode_grep (inode_table_t *table, inode_t *parent, const char *name) dentry_t *dentry = NULL; if (!table || !parent || !name) { - gf_log_callingfn ("", GF_LOG_WARNING, + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "table || parent || name not found"); return NULL; } @@ -694,7 +694,7 @@ __inode_find (inode_table_t *table, uuid_t gfid) int hash = 0; if (!table) { - gf_log_callingfn ("", GF_LOG_WARNING, "table not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "table not found"); goto out; } @@ -721,7 +721,7 @@ inode_find (inode_table_t *table, uuid_t gfid) inode_t *inode = NULL; if (!table) { - gf_log_callingfn ("", GF_LOG_WARNING, "table not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "table not found"); return NULL; } @@ -805,7 +805,7 @@ inode_link (inode_t *inode, inode_t *parent, const char *name, inode_t *linked_inode = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return NULL; } @@ -832,7 +832,7 @@ inode_lookup (inode_t *inode) inode_table_t *table = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return -1; } @@ -854,7 +854,7 @@ inode_forget (inode_t *inode, uint64_t nlookup) inode_table_t *table = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return -1; } @@ -894,7 +894,7 @@ inode_unlink (inode_t *inode, inode_t *parent, const char *name) inode_table_t *table = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return; } @@ -916,7 +916,7 @@ inode_rename (inode_table_t *table, inode_t *srcdir, const char *srcname, struct iatt *iatt) { if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return -1; } @@ -970,7 +970,7 @@ inode_parent (inode_t *inode, ino_t par, const char *name) dentry_t *dentry = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return NULL; } @@ -1007,7 +1007,7 @@ __inode_path (inode_t *inode, const char *name, char **bufp) char *buf = NULL; if (!inode) { - gf_log_callingfn ("", GF_LOG_WARNING, "inode not found"); + gf_log_callingfn (THIS->name, GF_LOG_WARNING, "inode not found"); return -1; } @@ -1516,10 +1516,7 @@ inode_dump (inode_t *inode, char *prefix) INIT_LIST_HEAD (&fd_list); ret = TRY_LOCK(&inode->lock); - if (ret != 0) { - gf_log ("", GF_LOG_WARNING, "Unable to dump inode" - " errno: %s", strerror (errno)); return; } @@ -1610,8 +1607,6 @@ inode_table_dump (inode_table_t *itable, char *prefix) ret = pthread_mutex_trylock(&itable->lock); if (ret != 0) { - gf_log("", GF_LOG_WARNING, "Unable to dump inode table" - " errno: %s", strerror (errno)); return; } diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c index c5cb9ec66..8b6fddf5e 100644 --- a/libglusterfs/src/iobuf.c +++ b/libglusterfs/src/iobuf.c @@ -85,7 +85,7 @@ __iobuf_arena_destroy_iobufs (struct iobuf_arena *iobuf_arena) iobuf_cnt = arena_size / page_size; if (!iobuf_arena->iobufs) { - gf_log_callingfn ("", GF_LOG_DEBUG, "iobufs not found"); + gf_log_callingfn (THIS->name, GF_LOG_DEBUG, "iobufs not found"); return; } @@ -148,13 +148,13 @@ __iobuf_arena_alloc (struct iobuf_pool *iobuf_pool) iobuf_arena->mem_base = mmap (NULL, arena_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); if (iobuf_arena->mem_base == MAP_FAILED) { - gf_log ("", GF_LOG_WARNING, "maping failed"); + gf_log (THIS->name, GF_LOG_WARNING, "maping failed"); goto err; } __iobuf_arena_init_iobufs (iobuf_arena); if (!iobuf_arena->iobufs) { - gf_log ("", GF_LOG_DEBUG, "init failed"); + gf_log (THIS->name, GF_LOG_DEBUG, "init failed"); goto err; } @@ -202,7 +202,7 @@ __iobuf_pool_add_arena (struct iobuf_pool *iobuf_pool) iobuf_arena = __iobuf_arena_alloc (iobuf_pool); if (!iobuf_arena) { - gf_log ("", GF_LOG_WARNING, "arena not found"); + gf_log (THIS->name, GF_LOG_WARNING, "arena not found"); return NULL; } @@ -259,7 +259,7 @@ iobuf_pool_new (size_t arena_size, size_t page_size) struct iobuf_pool *iobuf_pool = NULL; if (arena_size < page_size) { - gf_log ("", GF_LOG_WARNING, + gf_log (THIS->name, GF_LOG_WARNING, "arena size (%zu) is less than page size(%zu)", arena_size, page_size); return NULL; @@ -415,13 +415,13 @@ iobuf_get (struct iobuf_pool *iobuf_pool) /* most eligible arena for picking an iobuf */ iobuf_arena = __iobuf_select_arena (iobuf_pool); if (!iobuf_arena) { - gf_log ("", GF_LOG_WARNING, "arena not found"); + gf_log (THIS->name, GF_LOG_WARNING, "arena not found"); goto unlock; } iobuf = __iobuf_get (iobuf_arena); if (!iobuf) { - gf_log ("", GF_LOG_WARNING, "iobuf not found"); + gf_log (THIS->name, GF_LOG_WARNING, "iobuf not found"); goto unlock; } @@ -475,13 +475,13 @@ iobuf_put (struct iobuf *iobuf) iobuf_arena = iobuf->iobuf_arena; if (!iobuf_arena) { - gf_log ("", GF_LOG_WARNING, "arena not found"); + gf_log (THIS->name, GF_LOG_WARNING, "arena not found"); return; } iobuf_pool = iobuf_arena->iobuf_pool; if (!iobuf_pool) { - gf_log ("", GF_LOG_WARNING, "iobuf pool not found"); + gf_log (THIS->name, GF_LOG_WARNING, "iobuf pool not found"); return; } @@ -694,12 +694,12 @@ iobuf_size (struct iobuf *iobuf) GF_VALIDATE_OR_GOTO ("iobuf", iobuf, out); if (!iobuf->iobuf_arena) { - gf_log ("", GF_LOG_WARNING, "arena not found"); + gf_log (THIS->name, GF_LOG_WARNING, "arena not found"); goto out; } if (!iobuf->iobuf_arena->iobuf_pool) { - gf_log ("", GF_LOG_WARNING, "pool not found"); + gf_log (THIS->name, GF_LOG_WARNING, "pool not found"); goto out; } @@ -743,8 +743,6 @@ iobuf_info_dump (struct iobuf *iobuf, const char *key_prefix) ret = TRY_LOCK(&iobuf->lock); if (ret) { - gf_log("", GF_LOG_WARNING, "Unable to dump iobuf" - " errno: %s", strerror (errno)); return; } memcpy(&my_iobuf, iobuf, sizeof(my_iobuf)); @@ -800,8 +798,6 @@ iobuf_stats_dump (struct iobuf_pool *iobuf_pool) ret = pthread_mutex_trylock(&iobuf_pool->mutex); if (ret) { - gf_log("", GF_LOG_WARNING, "Unable to dump iobuf pool" - " errno: %s", strerror (errno)); return; } gf_proc_dump_add_section("iobuf.global"); diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 16020c0d2..f35c25183 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -1501,11 +1501,11 @@ xlator_validate_rec (xlator_t *xlator, char **op_errstr) } if (xlator_dynload (xlator)) - gf_log ("", GF_LOG_DEBUG, "Did not load the symbols"); + gf_log (xlator->name, GF_LOG_DEBUG, "Did not load the symbols"); if (xlator->validate_options) { if (xlator->validate_options (xlator, op_errstr)) { - gf_log ("", GF_LOG_INFO, "%s", *op_errstr); + gf_log (xlator->name, GF_LOG_INFO, "%s", *op_errstr); goto out; } gf_log (xlator->name, GF_LOG_DEBUG, "Validated option"); @@ -1840,7 +1840,7 @@ glusterd_check_log_level (const char *value) } if (log_level == -1) - gf_log ("", GF_LOG_ERROR, "Invalid log-level. possible values " + gf_log (THIS->name, GF_LOG_ERROR, "Invalid log-level. possible values " "are DEBUG|WARNING|ERROR|CRITICAL|NONE|TRACE"); return log_level; |