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>
This commit is contained in:
parent
0a20e56d07
commit
66b8462719
@ -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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user