summaryrefslogtreecommitdiffstats
path: root/xlators/performance/io-cache/src/page.c
diff options
context:
space:
mode:
authorarao <arao@redhat.com>2015-06-22 11:10:05 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-06-27 02:29:27 -0700
commit3741804bec65a33d400af38dcc80700c8a668b81 (patch)
treea10008485e263087a52764d2d1ae413bf58c9240 /xlators/performance/io-cache/src/page.c
parent911e9228f31e89fe5df6e2282ce449b2a94c42b1 (diff)
Logging: Porting the performance translator
logs to new logging framework. Change-Id: Ie6aaf8d30bd4457bb73c48e23e6b1dea27598644 BUG: 1194640 Signed-off-by: arao <arao@redhat.com> Reviewed-on: http://review.gluster.org/9822 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> Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/performance/io-cache/src/page.c')
-rw-r--r--xlators/performance/io-cache/src/page.c103
1 files changed, 54 insertions, 49 deletions
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c
index dce883fbd94..a0f01da6d2e 100644
--- a/xlators/performance/io-cache/src/page.c
+++ b/xlators/performance/io-cache/src/page.c
@@ -16,7 +16,7 @@
#include "ioc-mem-types.h"
#include <assert.h>
#include <sys/time.h>
-
+#include "io-cache-messages.h"
char
ioc_empty (struct ioc_cache *cache)
{
@@ -103,10 +103,10 @@ __ioc_page_destroy (ioc_page_t *page)
sizeof (page->offset));
list_del (&page->page_lru);
- gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
- "destroying page = %p, offset = %"PRId64" "
- "&& inode = %p",
- page, page->offset, page->inode);
+ gf_msg_trace (page->inode->table->xl->name, 0,
+ "destroying page = %p, offset = %"PRId64" "
+ "&& inode = %p",
+ page, page->offset, page->inode);
if (page->vector){
iobref_unref (page->iobref);
@@ -169,10 +169,11 @@ __ioc_inode_prune (ioc_inode_t *curr, uint64_t *size_pruned,
if (ret != -1)
table->cache_used -= ret;
- gf_log (table->xl->name, GF_LOG_TRACE,
- "index = %d && table->cache_used = %"PRIu64" && table->"
- "cache_size = %"PRIu64, index, table->cache_used,
- table->cache_size);
+ gf_msg_trace (table->xl->name, 0,
+ "index = %d && "
+ "table->cache_used = %"PRIu64" && table->"
+ "cache_size = %"PRIu64, index, table->cache_used,
+ table->cache_size);
if ((*size_pruned) >= size_to_prune)
break;
@@ -279,8 +280,8 @@ __ioc_page_create (ioc_inode_t *ioc_inode, off_t offset)
page = newpage;
- gf_log ("io-cache", GF_LOG_TRACE,
- "returning new page %p", page);
+ gf_msg_trace ("io-cache", 0,
+ "returning new page %p", page);
out:
return page;
@@ -310,7 +311,8 @@ __ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset,
if (page == NULL) {
local->op_ret = -1;
local->op_errno = ENOMEM;
- gf_log (frame->this->name, GF_LOG_WARNING,
+ gf_msg (frame->this->name, GF_LOG_WARNING,
+ 0, IO_CACHE_MSG_NO_MEMORY,
"asked to wait on a NULL page");
goto out;
}
@@ -322,10 +324,10 @@ __ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset,
goto out;
}
- gf_log (frame->this->name, GF_LOG_TRACE,
- "frame(%p) waiting on page = %p, offset=%"PRId64", "
- "size=%"GF_PRI_SIZET"",
- frame, page, offset, size);
+ gf_msg_trace (frame->this->name, 0,
+ "frame(%p) waiting on page = %p, offset=%"PRId64", "
+ "size=%"GF_PRI_SIZET"",
+ frame, page, offset, size);
waitq->data = frame;
waitq->next = page->waitq;
@@ -439,9 +441,9 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1 || !(zero_filled ||
ioc_cache_still_valid(ioc_inode,
stbuf))) {
- gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE,
- "cache for inode(%p) is invalid. flushing "
- "all pages", ioc_inode);
+ gf_msg_trace (ioc_inode->table->xl->name, 0,
+ "cache for inode(%p) is invalid. flushing "
+ "all pages", ioc_inode);
destroy_size = __ioc_inode_flush (ioc_inode);
}
@@ -459,8 +461,8 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
waitq = __ioc_page_error (page, op_ret,
op_errno);
} else {
- gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE,
- "op_ret = %d", op_ret);
+ gf_msg_trace (ioc_inode->table->xl->name, 0,
+ "op_ret = %d", op_ret);
page = __ioc_page_get (ioc_inode, offset);
if (!page) {
/* page was flushed */
@@ -495,8 +497,9 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
} else {
/* TODO: we have got a response to
* our request and no data */
- gf_log (frame->this->name,
+ gf_msg (frame->this->name,
GF_LOG_CRITICAL,
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
"frame>root>rsp_refs is null");
} /* if(frame->root->rsp_refs) */
@@ -548,8 +551,8 @@ unlock:
ioc_prune (ioc_inode->table);
}
- gf_log (frame->this->name, GF_LOG_TRACE, "fault frame %p returned",
- frame);
+ gf_msg_trace (frame->this->name, 0, "fault frame %p returned",
+ frame);
pthread_mutex_destroy (&local->local_lock);
fd_unref (local->fd);
@@ -583,7 +586,8 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
if (frame == NULL) {
op_ret = -1;
op_errno = EINVAL;
- gf_log ("io-cache", GF_LOG_WARNING,
+ gf_msg ("io-cache", GF_LOG_WARNING,
+ EINVAL, IO_CACHE_MSG_ENFORCEMENT_FAILED,
"page fault on a NULL frame");
goto err;
}
@@ -617,9 +621,9 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
fault_local->pending_size = table->page_size;
fault_local->inode = ioc_inode;
- gf_log (frame->this->name, GF_LOG_TRACE,
- "stack winding page fault for offset = %"PRId64" with "
- "frame %p", offset, fault_frame);
+ gf_msg_trace (frame->this->name, 0,
+ "stack winding page fault for offset = %"PRId64" with "
+ "frame %p", offset, fault_frame);
STACK_WIND (fault_frame, ioc_fault_cbk, FIRST_CHILD(fault_frame->this),
FIRST_CHILD(fault_frame->this)->fops->readv, fd,
@@ -662,7 +666,8 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
GF_VALIDATE_OR_GOTO (frame->this->name, local, out);
if (page == NULL) {
- gf_log (frame->this->name, GF_LOG_WARNING,
+ gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+ IO_CACHE_MSG_ENFORCEMENT_FAILED,
"NULL page has been provided to serve read request");
local->op_ret = -1;
local->op_errno = EINVAL;
@@ -671,10 +676,10 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
ioc_inode = page->inode;
- gf_log (frame->this->name, GF_LOG_TRACE,
- "frame (%p) offset = %"PRId64" && size = %"GF_PRI_SIZET" "
- "&& page->size = %"GF_PRI_SIZET" && wait_count = %d",
- frame, offset, size, page->size, local->wait_count);
+ gf_msg_trace (frame->this->name, 0,
+ "frame (%p) offset = %"PRId64" && size = %"GF_PRI_SIZET" "
+ "&& page->size = %"GF_PRI_SIZET" && wait_count = %d",
+ frame, offset, size, page->size, local->wait_count);
/* immediately move this page to the end of the page_lru list */
list_move_tail (&page->page_lru, &ioc_inode->cache.page_lru);
@@ -708,10 +713,10 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
copy_size = src_offset = 0;
}
- gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
- "copy_size = %"GF_PRI_SIZET" && src_offset = "
- "%"PRId64" && dst_offset = %"PRId64"",
- copy_size, src_offset, dst_offset);
+ gf_msg_trace (page->inode->table->xl->name, 0,
+ "copy_size = %"GF_PRI_SIZET" && src_offset = "
+ "%"PRId64" && dst_offset = %"PRId64"",
+ copy_size, src_offset, dst_offset);
{
new = GF_CALLOC (1, sizeof (*new),
@@ -809,8 +814,8 @@ ioc_frame_unwind (call_frame_t *frame)
local = frame->local;
if (local == NULL) {
- gf_log (frame->this->name, GF_LOG_WARNING,
- "local is NULL");
+ gf_msg (frame->this->name, GF_LOG_WARNING, ENOMEM,
+ IO_CACHE_MSG_NO_MEMORY, "local is NULL");
op_ret = -1;
op_errno = ENOMEM;
goto unwind;
@@ -830,10 +835,10 @@ ioc_frame_unwind (call_frame_t *frame)
}
if (list_empty (&local->fill_list)) {
- gf_log (frame->this->name, GF_LOG_TRACE,
- "frame(%p) has 0 entries in local->fill_list "
- "(offset = %"PRId64" && size = %"GF_PRI_SIZET")",
- frame, local->offset, local->size);
+ gf_msg_trace (frame->this->name, 0,
+ "frame(%p) has 0 entries in local->fill_list "
+ "(offset = %"PRId64" && size = %"GF_PRI_SIZET")",
+ frame, local->offset, local->size);
}
list_for_each_entry (fill, &local->fill_list, list) {
@@ -871,8 +876,8 @@ ioc_frame_unwind (call_frame_t *frame)
}
unwind:
- gf_log (frame->this->name, GF_LOG_TRACE,
- "frame(%p) unwinding with op_ret=%d", frame, op_ret);
+ gf_msg_trace (frame->this->name, 0,
+ "frame(%p) unwinding with op_ret=%d", frame, op_ret);
// ioc_local_unlock (local);
@@ -946,8 +951,8 @@ __ioc_page_wakeup (ioc_page_t *page, int32_t op_errno)
page->ready = 1;
- gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
- "page is %p && waitq = %p", page, waitq);
+ gf_msg_trace (page->inode->table->xl->name, 0,
+ "page is %p && waitq = %p", page, waitq);
for (trav = waitq; trav; trav = trav->next) {
frame = trav->data;
@@ -989,8 +994,8 @@ __ioc_page_error (ioc_page_t *page, int32_t op_ret, int32_t op_errno)
waitq = page->waitq;
page->waitq = NULL;
- gf_log (page->inode->table->xl->name, GF_LOG_DEBUG,
- "page error for page = %p & waitq = %p", page, waitq);
+ gf_msg_debug (page->inode->table->xl->name, 0,
+ "page error for page = %p & waitq = %p", page, waitq);
for (trav = waitq; trav; trav = trav->next) {