📄 trace.c
字号:
{ char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_SYMLINK].enabled) { if (op_ret >= 0) { strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, inode=%p, *buf=%p {st_dev=%lld, st_ino=%lld, st_mode=%d, st_nlink=%d, st_uid=%d, st_gid=%d, st_rdev=%llx, st_size=%lld, st_blksize=%ld, st_blocks=%lld, st_atime=%s, st_mtime=%s, st_ctime=%s})", this, op_ret, op_errno, inode, buf, buf->st_dev, buf->st_ino, buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, buf->st_rdev, buf->st_size, buf->st_blksize, buf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0;}int32_t trace_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct stat *buf){ char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_MKNOD].enabled) { if (op_ret >= 0) { strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, inode=%p, *buf=%p {st_dev=%lld, st_ino=%lld, st_mode=%d, st_nlink=%d, st_uid=%d, st_gid=%d, st_rdev=%llx, st_size=%lld, st_blksize=%ld, st_blocks=%lld, st_atime=%s, st_mtime=%s, st_ctime=%s})", this, op_ret, op_errno, inode, buf, buf->st_dev, buf->st_ino, buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, buf->st_rdev, buf->st_size, buf->st_blksize, buf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0;} int32_t trace_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct stat *buf){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_MKDIR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, inode=%p", this, op_ret, op_errno, inode); } STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0;} int32_t trace_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct stat *buf){ char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_LINK].enabled) { if (op_ret >= 0) { strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, inode=%p, *buf=%p {st_dev=%lld, st_ino=%lld, st_mode=%d, st_nlink=%d, st_uid=%d, st_gid=%d, st_rdev=%llx, st_size=%lld, st_blksize=%ld, st_blocks=%lld, st_atime=%s, st_mtime=%s, st_ctime=%s})", this, op_ret, op_errno, inode, buf, buf->st_dev, buf->st_ino, buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, buf->st_rdev, buf->st_size, buf->st_blksize, buf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0;}int32_t trace_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_FLUSH].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_close_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_CLOSE].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_OPENDIR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, fd=%p)", this, op_ret, op_errno, fd); } STACK_UNWIND (frame, op_ret, op_errno, fd); return 0;}int32_t trace_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_RMDIR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct stat *buf){ char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_TRUNCATE].enabled) { if (op_ret >= 0) { strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, *buf=%p {st_dev=%lld, st_ino=%lld, st_mode=%d, st_nlink=%d, st_uid=%d, st_gid=%d, st_rdev=%llx, st_size=%lld, st_blksize=%ld, st_blocks=%lld, st_atime=%s, st_mtime=%s, st_ctime=%s})", this, op_ret, op_errno, buf, buf->st_dev, buf->st_ino, buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, buf->st_rdev, buf->st_size, buf->st_blksize, buf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, buf); return 0;}int32_t trace_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct stat *buf){ char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_UTIMENS].enabled) { if (op_ret >= 0) { strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, *buf=%p {st_dev=%lld, st_ino=%lld, st_mode=%d, st_nlink=%d, st_uid=%d, st_gid=%d, st_rdev=%llx, st_size=%lld, st_blksize=%ld, st_blocks=%lld, st_atime=%s, st_mtime=%s, st_ctime=%s})", this, op_ret, op_errno, buf, buf->st_dev, buf->st_ino, buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, buf->st_rdev, buf->st_size, buf->st_blksize, buf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, buf); return 0;}int32_t trace_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct statvfs *buf){ ERR_EINVAL_NORETURN (!this); if (fop_names[GF_FOP_STATFS].enabled) { if (op_ret >= 0) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, *buf=%p {f_bsize=%u, f_frsize=%u, f_blocks=%lu, f_bfree=%lu, f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_favail=%lu, f_fsid=%u, f_flag=%u, f_namemax=%u}) => ret=%d, errno=%d", this, buf, buf->f_bsize, buf->f_frsize, buf->f_blocks, buf->f_bfree, buf->f_bavail, buf->f_files, buf->f_ffree, buf->f_favail, buf->f_fsid, buf->f_flag, buf->f_namemax, op_ret, op_errno); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, buf); return 0;}int32_t trace_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_SETXATTR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *dict){ ERR_EINVAL_NORETURN (!this || !dict); if (fop_names[GF_FOP_GETXATTR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, dict=%p)", this, op_ret, op_errno, dict); } STACK_UNWIND (frame, op_ret, op_errno, dict); return 0;}int32_t trace_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_REMOVEXATTR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_closedir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_CLOSEDIR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_FSYNCDIR].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_ACCESS].enabled) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct stat *buf){ char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_FTRUNCATE].enabled) { if (op_ret >= 0) { strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, *buf=%p {st_dev=%lld, st_ino=%lld, st_mode=%d, st_nlink=%d, st_uid=%d, st_gid=%d, st_rdev=%llx, st_size=%lld, st_blksize=%ld, st_blocks=%lld, st_atime=%s, st_mtime=%s, st_ctime=%s})", this, op_ret, op_errno, buf, buf->st_dev, buf->st_ino, buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, buf->st_rdev, buf->st_size, buf->st_blksize, buf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, buf); return 0;}int32_t trace_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct stat *buf){ char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_FSTAT].enabled) { if (op_ret >= 0) { strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, *buf=%p {st_dev=%lld, st_ino=%lld, st_mode=%d, st_nlink=%d, st_uid=%d, st_gid=%d, st_rdev=%llx, st_size=%lld, st_blksize=%ld, st_blocks=%lld, st_atime=%s, st_mtime=%s, st_ctime=%s})", this, op_ret, op_errno, buf, buf->st_dev, buf->st_ino, buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid, buf->st_rdev, buf->st_size, buf->st_blksize, buf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, buf); return 0;}int32_t trace_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct flock *lock){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_LK].enabled) { if (op_ret >= 0) { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d, *lock=%p {l_type=%d, l_whence=%d, l_start=%lld, l_len=%lld, l_pid=%ld})", this, op_ret, op_errno, lock, lock->l_type, lock->l_whence, lock->l_start, lock->l_len, lock->l_pid); } else { gf_log (this->name, GF_LOG_NORMAL, "(*this=%p, op_ret=%d, op_errno=%d)", this, op_ret, op_errno); } } STACK_UNWIND (frame, op_ret, op_errno, lock); return 0;}int32_t trace_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno){ ERR_EINVAL_NORETURN (!this ); if (fop_names[GF_FOP_SETDENTS].enabled) { gf_log (this->name, GF_LOG_NORMAL, "*this=%p, op_ret=%d, op_errno=%d", this, op_ret, op_errno); } STACK_UNWIND (frame, op_ret, op_errno); return 0;}int32_t trace_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t need_xattr){ ERR_EINVAL_NORETURN (!this || !loc); if (fop_names[GF_FOP_LOOKUP].enabled) { gf_log (this->name, GF_LOG_NORMAL, "callid: %lld (*this=%p, loc=%p {path=%s, inode=%p} )", (long long) frame->root->unique, this, loc, loc->path, loc->inode, need_xattr); } STACK_WIND (frame, trace_lookup_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lookup, loc, need_xattr); return 0;}int32_t trace_forget (call_frame_t *frame, xlator_t *this, inode_t *inode){ ERR_EINVAL_NORETURN (!this || !inode); if (fop_names[GF_FOP_FORGET].enabled) { gf_log (this->name, GF_LOG_NORMAL, "callid: %lld (*this=%p, inode=%p})", (long long) frame->root->unique, this, inode); } STACK_WIND (frame, trace_forget_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->forget, inode); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -