summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-03-03 06:22:59 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-03-04 00:41:08 -0800
commit0066a093a258bfd1a9130134318c3df3571a091d (patch)
treebd71fc13339e25c032c334756d50cc7289d96b0b
parent8f132b363d41e7fe94a8712ed297a5f810e8ed56 (diff)
debug/trace: add logs for 'forget', 'release' and 'releasedir'
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2332 (update 'debug/trace' to log gfid instead of 'ia_ino') URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2332
-rw-r--r--xlators/debug/trace/src/trace.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index 2a0cea896c6..228a0166d4e 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -36,7 +36,6 @@
#include "common-utils.h"
-
struct {
char *name;
int enabled;
@@ -122,6 +121,9 @@ trace_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
GF_FREE (preparentstr);
if (postparentstr)
GF_FREE (postparentstr);
+
+ /* for 'release' log */
+ fd_ctx_set (fd, this, 0);
} else {
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (op_ret=%d, op_errno=%d)",
@@ -147,6 +149,10 @@ trace_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (frame->local), op_ret, op_errno, fd);
}
+ /* for 'release' log */
+ if (op_ret >= 0)
+ fd_ctx_set (fd, this, 0);
+
frame->local = NULL;
STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd);
return 0;
@@ -550,6 +556,9 @@ trace_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
GF_FREE (statstr);
if (postparentstr)
GF_FREE (postparentstr);
+
+ /* For 'forget' */
+ inode_ctx_put (inode, this, 0);
} else {
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d)",
@@ -774,6 +783,10 @@ trace_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
op_ret, op_errno, fd);
}
+ /* for 'releasedir' log */
+ if (op_ret >= 0)
+ fd_ctx_set (fd, this, 0);
+
frame->local = NULL;
STACK_UNWIND_STRICT (opendir, frame, op_ret, op_errno, fd);
return 0;
@@ -2195,6 +2208,42 @@ trace_lk (call_frame_t *frame, xlator_t *this, fd_t *fd,
return 0;
}
+int32_t
+trace_forget (xlator_t *this, inode_t *inode)
+{
+ /* If user want to understand when a lookup happens,
+ he should know about 'forget' too */
+ if (trace_fop_names[GF_FOP_LOOKUP].enabled) {
+ gf_log (this->name, GF_LOG_NORMAL,
+ "gfid=%s ino=%"PRIu64,
+ uuid_utoa (inode->gfid), inode->ino);
+ }
+ return 0;
+}
+
+
+int32_t
+trace_releasedir (xlator_t *this, fd_t *fd)
+{
+ if (trace_fop_names[GF_FOP_OPENDIR].enabled) {
+ gf_log (this->name, GF_LOG_NORMAL,
+ "gfid=%s fd=%p", uuid_utoa (fd->inode->gfid), fd);
+ }
+
+ return 0;
+}
+
+int32_t
+trace_release (xlator_t *this, fd_t *fd)
+{
+ if (trace_fop_names[GF_FOP_OPEN].enabled ||
+ trace_fop_names[GF_FOP_CREATE].enabled) {
+ gf_log (this->name, GF_LOG_NORMAL,
+ "gfid=%s fd=%p", uuid_utoa (fd->inode->gfid), fd);
+ }
+ return 0;
+}
+
void
@@ -2364,6 +2413,9 @@ struct xlator_fops fops = {
struct xlator_cbks cbks = {
+ .release = trace_release,
+ .releasedir = trace_releasedir,
+ .forget = trace_forget,
};
struct volume_options options[] = {