summaryrefslogtreecommitdiffstats
path: root/booster/src/booster-fd.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-09-08 23:39:13 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-09 06:38:35 -0700
commitc4feaddee1120985422346eb0ffdfb62c796ad1b (patch)
tree38185f93dac0577953311f16b4d362f5fc4e034b /booster/src/booster-fd.c
parentb1cb5fce13eb1a31e694f0fcb81002d48455b750 (diff)
booster: Enhance booster logging
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 210 (libglusterfsclient: Enhance logging) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=210
Diffstat (limited to 'booster/src/booster-fd.c')
-rw-r--r--booster/src/booster-fd.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/booster/src/booster-fd.c b/booster/src/booster-fd.c
index b74bd6fa6e4..5e83384ffb8 100644
--- a/booster/src/booster-fd.c
+++ b/booster/src/booster-fd.c
@@ -44,9 +44,7 @@ gf_roundup_power_of_two (uint nr)
uint result = 1;
if (nr < 0) {
- gf_log ("server-protocol/fd",
- GF_LOG_ERROR,
- "Negative number passed");
+ gf_log ("booster-fd", GF_LOG_ERROR, "Negative number passed");
return -1;
}
@@ -65,7 +63,7 @@ booster_fdtable_expand (booster_fdtable_t *fdtable, uint nr)
int32_t ret = -1;
if (fdtable == NULL || nr < 0) {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_log ("booster-fd", GF_LOG_ERROR, "Invalid argument");
errno = EINVAL;
ret = -1;
goto out;
@@ -80,6 +78,7 @@ booster_fdtable_expand (booster_fdtable_t *fdtable, uint nr)
fdtable->fds = CALLOC (nr, sizeof (fd_t *));
if (fdtable->fds == NULL) {
+ gf_log ("booster-fd", GF_LOG_ERROR, "Memory allocation failed");
fdtable->fds = oldfds;
oldfds = NULL;
ret = -1;
@@ -93,6 +92,8 @@ booster_fdtable_expand (booster_fdtable_t *fdtable, uint nr)
memcpy (fdtable->fds, oldfds, cpy);
}
+ gf_log ("booster-fd", GF_LOG_DEBUG, "FD-table expanded: Old: %d,New: %d"
+ , oldmax_fds, nr);
ret = 0;
out:
FREE (oldfds);
@@ -118,6 +119,8 @@ booster_fdtable_alloc (void)
UNLOCK (&fdtable->lock);
if (ret == -1) {
+ gf_log ("booster-fd", GF_LOG_ERROR, "FD-table allocation "
+ "failed");
FREE (fdtable);
fdtable = NULL;
}
@@ -197,11 +200,12 @@ booster_fd_unused_get (booster_fdtable_t *fdtable, fd_t *fdptr, int fd)
int error = 0;
if (fdtable == NULL || fdptr == NULL || fd < 0) {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_log ("booster-fd", GF_LOG_ERROR, "invalid argument");
errno = EINVAL;
return -1;
}
+ gf_log ("booster-fd", GF_LOG_DEBUG, "Requested fd: %d", fd);
LOCK (&fdtable->lock);
{
while (fdtable->max_fds < fd) {
@@ -239,8 +243,10 @@ booster_fd_put (booster_fdtable_t *fdtable, int fd)
return;
}
+ gf_log ("booster-fd", GF_LOG_DEBUG, "FD put: %d", fd);
if (!(fd < fdtable->max_fds)) {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ gf_log ("booster-fd", GF_LOG_ERROR, "FD not in booster fd"
+ " table");
return;
}
@@ -266,8 +272,10 @@ booster_fdptr_get (booster_fdtable_t *fdtable, int fd)
return NULL;
}
+ gf_log ("booster-fd", GF_LOG_DEBUG, "FD ptr request: %d", fd);
if (!(fd < fdtable->max_fds)) {
- gf_log ("booster-fd", GF_LOG_ERROR, "invalid argument");
+ gf_log ("booster-fd", GF_LOG_ERROR, "FD not in booster fd"
+ " table");
errno = EINVAL;
return NULL;
}