📄 trace.c
字号:
int32_t trace_stat (call_frame_t *frame, xlator_t *this, loc_t *loc){ ERR_EINVAL_NORETURN (!this || !loc );#if 0 dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ mode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of owner */ gid_t st_gid; /* group ID of owner */ dev_t st_rdev; /* device ID (if special file) */ off_t st_size; /* total size, in bytes */ blksize_t st_blksize; /* blocksize for filesystem I/O */ blkcnt_t st_blocks; /* number of blocks allocated */ time_t st_atime; /* time of last access */ time_t st_mtime; /* time of last modification */ time_t st_ctime; /* time of last status change */#endif if (fop_names[GF_FOP_STAT].enabled) { gf_log (this->name, GF_LOG_NORMAL, "callid: %lld (*this=%p, loc=%p {path=%s, inode=%p})\n", (long long) frame->root->unique, this, loc, loc->path, loc->inode); } STACK_WIND (frame, trace_stat_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->stat, loc); return 0;}int32_t trace_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size){ ERR_EINVAL_NORETURN (!this || !loc || (size < 1)); if (fop_names[GF_FOP_READLINK].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, size=%d)", this, loc, loc->path, loc->inode, size); } STACK_WIND (frame, trace_readlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readlink, loc, size); return 0;}int32_t trace_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, dev_t dev){ ERR_EINVAL_NORETURN (!this || !loc->path); if (fop_names[GF_FOP_MKNOD].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, mode=%d, dev=%lld)", this, loc, loc->path, loc->inode, mode, dev); } STACK_WIND (frame, trace_mknod_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod, loc, mode, dev); return 0;}int32_t trace_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode){ ERR_EINVAL_NORETURN (!this || !loc->path); if (fop_names[GF_FOP_MKDIR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, path=%s, loc=%p {path=%s, inode=%p}, mode=%d)", this, loc->path, loc, loc->inode, mode); } STACK_WIND (frame, trace_mkdir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mkdir, loc, mode); return 0;}int32_t trace_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_UNLINK].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p{path=%s, inode=%p})", this, loc, loc->path, loc->inode); } STACK_WIND (frame, trace_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc); return 0;}int32_t trace_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_RMDIR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p})", this, loc, loc->path, loc->inode); } STACK_WIND (frame, trace_rmdir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir, loc); return 0;}int32_t trace_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, loc_t *loc){ ERR_EINVAL_NORETURN (!this || !linkpath || !loc->path); if (fop_names[GF_FOP_SYMLINK].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, linkpath=%s, loc=%p {path=%s, inode=%p})", this, linkpath, loc, loc->path, loc->inode); } STACK_WIND (frame, trace_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, linkpath, loc); return 0;}int32_t trace_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc){ ERR_EINVAL_NORETURN (!this || !oldloc || !newloc); if (fop_names[GF_FOP_RENAME].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(oldloc=%p{path=%s, inode=%p, ino=%lld}, newloc=%p{path=%s, inode=%p, ino=%lld})", oldloc, oldloc->path, oldloc->inode, oldloc->ino, newloc, newloc->path, newloc->inode, newloc->ino); } STACK_WIND (frame, trace_rename_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, newloc); return 0;}int32_t trace_link (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *newpath){ ERR_EINVAL_NORETURN (!this || !loc || !newpath); if (fop_names[GF_FOP_LINK].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, newpath=%s)", this, loc, loc->path, loc->inode, newpath); } STACK_WIND (frame, trace_link_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->link, loc, newpath); return 0;}int32_t trace_chmod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_CHMOD].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, mode=%o)", this, loc, loc->path, loc->inode, mode); } STACK_WIND (frame, trace_chmod_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->chmod, loc, mode); return 0;}int32_t trace_chown (call_frame_t *frame, xlator_t *this, loc_t *loc, uid_t uid, gid_t gid){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_CHOWN].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, uid=%d, gid=%d)", this, loc, loc->path, loc->inode, uid, gid); } STACK_WIND (frame, trace_chown_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->chown, loc, uid, gid); return 0;}int32_t trace_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_TRUNCATE].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, offset=%lld)", this, loc, loc->path, loc->inode, offset); } STACK_WIND (frame, trace_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, offset); return 0;}int32_t trace_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc, struct timespec tv[2]){ char actime_str[256]; char modtime_str[256]; ERR_EINVAL_NORETURN (!this || !loc || !tv); if (fop_names[GF_FOP_UTIMENS].enabled) { strftime (actime_str, 256, "[%b %d %H:%M:%S]", localtime (&tv[0].tv_sec)); strftime (modtime_str, 256, "[%b %d %H:%M:%S]", localtime (&tv[1].tv_sec)); gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, *tv=%p {actime=%s, modtime=%s})", this, loc, loc->path, loc->inode, tv, actime_str, modtime_str); } STACK_WIND (frame, trace_utimens_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->utimens, loc, tv); return 0;}int32_t trace_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, fd_t *fd){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_OPEN].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, flags=%d, fd=%p)", this, loc, loc->path, loc->inode, flags, fd); } STACK_WIND (frame, trace_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, loc, flags, fd); return 0;}int32_t trace_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, mode_t mode, fd_t *fd){ ERR_EINVAL_NORETURN (!this || !loc->path); if (fop_names[GF_FOP_CREATE].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, flags=0%o mode=0%o)", this, loc, loc->path, loc->inode, flags, mode); } STACK_WIND (frame, trace_create_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, loc, flags, mode, fd); return 0;}int32_t trace_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset){ ERR_EINVAL_NORETURN (!this || !fd || (size < 1)); if (fop_names[GF_FOP_READ].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, *fd=%p, size=%d, offset=%lld)", this, fd, size, offset); } STACK_WIND (frame, trace_readv_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv, fd, size, offset); return 0;}int32_t trace_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t offset){ ERR_EINVAL_NORETURN (!this || !fd || !vector || (count < 1)); if (fop_names[GF_FOP_WRITE].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, *fd=%p, *vector=%p, count=%d, offset=%lld)", this, fd, vector, count, offset); } STACK_WIND (frame, trace_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, offset); return 0;}int32_t trace_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_STATFS].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p})", this, loc, loc->path, loc->inode); } STACK_WIND (frame, trace_statfs_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->statfs, loc); return 0; }int32_t trace_flush (call_frame_t *frame, xlator_t *this, fd_t *fd){ ERR_EINVAL_NORETURN (!this || !fd); if (fop_names[GF_FOP_FLUSH].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, *fd=%p)", this, fd); } STACK_WIND (frame, trace_flush_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->flush, fd); return 0;}int32_t trace_close (call_frame_t *frame, xlator_t *this, fd_t *fd){ ERR_EINVAL_NORETURN (!this || !fd); if (fop_names[GF_FOP_CLOSE].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, *fd=%p)", this, fd); } STACK_WIND (frame, trace_close_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->close, fd); return 0;}int32_t trace_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags){ ERR_EINVAL_NORETURN (!this || !fd); if (fop_names[GF_FOP_FSYNC].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, flags=%d, *fd=%p)", this, flags, fd); } STACK_WIND (frame, trace_fsync_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync, fd, flags); return 0;}int32_t trace_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, int32_t flags){ ERR_EINVAL_NORETURN (!this || !loc || !dict); if (fop_names[GF_FOP_SETXATTR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p}, dict=%p, flags=%d)", this, loc, loc->path, loc->inode, dict, flags); } STACK_WIND (frame, trace_setxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr, loc, dict, flags); return 0;}int32_t trace_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_GETXATTR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, loc=%p {path=%s, inode=%p})",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -