summaryrefslogtreecommitdiffstats
path: root/xlators/debug/trace
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2017-05-30 18:01:26 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-06-09 07:20:37 +0000
commit66b8462719bee337db85abc5b2ed8657b71f073c (patch)
tree2776e535ad91043208db8cf213726214a216be59 /xlators/debug/trace
parent0a20e56d07de3e467e09da885a6b71cdc165de17 (diff)
debug/trace: Implement seek fop
Change-Id: Idd1b92201348a76a6145b38799a3a46cab730540 BUG: 1458193 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: https://review.gluster.org/17437 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/debug/trace')
-rw-r--r--xlators/debug/trace/src/trace.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index 555147a..451ef9a 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -2168,6 +2168,51 @@ out:
return 0;
}
+static int
+trace_seek_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, off_t offset, dict_t *xdata)
+{
+ trace_conf_t *conf = this->private;
+
+ if (!conf->log_file && !conf->log_history)
+ goto out;
+ if (trace_fop_names[GF_FOP_SEEK].enabled) {
+ char string[4096] = {0,};
+ snprintf (string, sizeof (string),
+ "%"PRId64": gfid=%s op_ret=%d op_errno=%d, "
+ "offset=%"PRId64"", frame->root->unique,
+ uuid_utoa (frame->local), op_ret, op_errno, offset);
+ LOG_ELEMENT (conf, string);
+ }
+out:
+ TRACE_STACK_UNWIND (seek, frame, op_ret, op_errno, offset, xdata);
+ return 0;
+}
+
+static int
+trace_seek (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ off_t offset, gf_seek_what_t what, dict_t *xdata)
+{
+ trace_conf_t *conf = this->private;
+
+ if (!conf->log_file && !conf->log_history)
+ goto out;
+ if (trace_fop_names[GF_FOP_SEEK].enabled) {
+ char string[4096] = {0,};
+ snprintf (string, sizeof (string), "%"PRId64": gfid=%s fd=%p "
+ "offset=%"PRId64" what=%d", frame->root->unique,
+ uuid_utoa (fd->inode->gfid), fd, offset, what);
+
+ frame->local = fd->inode->gfid;
+ LOG_ELEMENT (conf, string);
+ }
+out:
+ STACK_WIND (frame, trace_seek_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->seek, fd, offset, what, xdata);
+
+ return 0;
+}
+
int
trace_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
off_t offset, dict_t *xdata)
@@ -3280,6 +3325,7 @@ struct xlator_fops fops = {
.fxattrop = trace_fxattrop,
.setattr = trace_setattr,
.fsetattr = trace_fsetattr,
+ .seek = trace_seek,
};
struct xlator_cbks cbks = {