@@ -8,4 +8,6 @@ obj-$(CONFIG_ORANGEFS_FS) += orangefs.o
orangefs-objs := acl.o file.o orangefs-cache.o orangefs-utils.o xattr.o \
dcache.o inode.o orangefs-sysfs.o orangefs-mod.o super.o \
devorangefs-req.o namei.o symlink.o dir.o orangefs-bufmap.o \
- orangefs-debugfs.o waitqueue.o
+ orangefs-debugfs.o waitqueue.o orangefs-trace.o
+
+CFLAGS_orangefs-trace.o += -I$(src)
@@ -41,8 +41,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
__LINE__,
get_interruptible_flag(parent_inode));
- err = service_operation(new_op, "orangefs_lookup",
- get_interruptible_flag(parent_inode));
+ err = service_operation(new_op, get_interruptible_flag(parent_inode));
/* Positive dentry: reject if error or not the same inode. */
if (inode) {
@@ -85,8 +85,7 @@ static int do_readdir(struct orangefs_inode_s *oi,
op->upcall.req.readdir.buf_index = bufi;
- r = service_operation(op, "orangefs_readdir",
- get_interruptible_flag(dentry->d_inode));
+ r = service_operation(op, get_interruptible_flag(dentry->d_inode));
orangefs_readdir_index_put(bufi);
@@ -30,8 +30,7 @@ static int flush_racache(struct inode *inode)
return -ENOMEM;
new_op->upcall.req.ra_cache_flush.refn = orangefs_inode->refn;
- ret = service_operation(new_op, "orangefs_flush_racache",
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
gossip_debug(GOSSIP_UTILS_DEBUG, "%s: got return value of %d\n",
__func__, ret);
@@ -110,11 +109,7 @@ static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inod
llu(new_op->tag));
/* Stage 2: Service the I/O operation */
- ret = service_operation(new_op,
- type == ORANGEFS_IO_WRITE ?
- "file_write" :
- "file_read",
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
/*
* If service_operation() returns -EAGAIN #and# the operation was
@@ -627,7 +622,6 @@ static int orangefs_fsync(struct file *file,
new_op->upcall.req.fsync.refn = orangefs_inode->refn;
ret = service_operation(new_op,
- "orangefs_fsync",
get_interruptible_flag(file_inode(file)));
gossip_debug(GOSSIP_FILE_DEBUG,
@@ -180,7 +180,7 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr)
new_op->upcall.req.truncate.refn = orangefs_inode->refn;
new_op->upcall.req.truncate.size = (__s64) iattr->ia_size;
- ret = service_operation(new_op, __func__,
+ ret = service_operation(new_op,
get_interruptible_flag(inode));
/*
@@ -42,7 +42,7 @@ static int orangefs_create(struct inode *dir,
strncpy(new_op->upcall.req.create.d_name,
dentry->d_name.name, ORANGEFS_NAME_MAX - 1);
- ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
+ ret = service_operation(new_op, get_interruptible_flag(dir));
gossip_debug(GOSSIP_NAME_DEBUG,
"%s: %pd: handle:%pU: fsid:%d: new_op:%p: ret:%d:\n",
@@ -150,7 +150,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
&new_op->upcall.req.lookup.parent_refn.khandle,
new_op->upcall.req.lookup.parent_refn.fs_id);
- ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
+ ret = service_operation(new_op, get_interruptible_flag(dir));
gossip_debug(GOSSIP_NAME_DEBUG,
"Lookup Got %pU, fsid %d (ret=%d)\n",
@@ -245,8 +245,7 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry)
strncpy(new_op->upcall.req.remove.d_name, dentry->d_name.name,
ORANGEFS_NAME_MAX - 1);
- ret = service_operation(new_op, "orangefs_unlink",
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
gossip_debug(GOSSIP_NAME_DEBUG,
"%s: service_operation returned:%d:\n",
@@ -302,7 +301,7 @@ static int orangefs_symlink(struct inode *dir,
ORANGEFS_NAME_MAX - 1);
strncpy(new_op->upcall.req.sym.target, symname, ORANGEFS_NAME_MAX - 1);
- ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
+ ret = service_operation(new_op, get_interruptible_flag(dir));
gossip_debug(GOSSIP_NAME_DEBUG,
"Symlink Got ORANGEFS handle %pU on fsid %d (ret=%d)\n",
@@ -373,7 +372,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
strncpy(new_op->upcall.req.mkdir.d_name,
dentry->d_name.name, ORANGEFS_NAME_MAX - 1);
- ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
+ ret = service_operation(new_op, get_interruptible_flag(dir));
gossip_debug(GOSSIP_NAME_DEBUG,
"Mkdir Got ORANGEFS handle %pU on fsid %d\n",
@@ -458,7 +457,6 @@ static int orangefs_rename(struct inode *old_dir,
ORANGEFS_NAME_MAX - 1);
ret = service_operation(new_op,
- "orangefs_rename",
get_interruptible_flag(old_dentry->d_inode));
gossip_debug(GOSSIP_NAME_DEBUG,
@@ -512,9 +512,7 @@ static ssize_t orangefs_debug_write(struct file *file,
c_mask.mask2);
/* service_operation returns 0 on success... */
- rc = service_operation(new_op,
- "orangefs_param",
- ORANGEFS_OP_INTERRUPTIBLE);
+ rc = service_operation(new_op, ORANGEFS_OP_INTERRUPTIBLE);
if (rc)
gossip_debug(GOSSIP_DEBUGFS_DEBUG,
@@ -439,9 +439,7 @@ extern const struct dentry_operations orangefs_dentry_operations;
#define ORANGEFS_OP_NO_MUTEX 8 /* don't acquire request_mutex */
#define ORANGEFS_OP_ASYNC 16 /* Queue it, but don't wait */
-int service_operation(struct orangefs_kernel_op_s *op,
- const char *op_name,
- int flags);
+int service_operation(struct orangefs_kernel_op_s *, int);
#define get_interruptible_flag(inode) \
((ORANGEFS_SB(inode->i_sb)->flags & ORANGEFS_OPT_INTR) ? \
@@ -303,7 +303,6 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj,
{
struct orangefs_kernel_op_s *new_op = NULL;
int rc = 0;
- char *ser_op_type = NULL;
__u32 op_alloc_type;
gossip_debug(GOSSIP_SYSFS_DEBUG,
@@ -461,17 +460,11 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj,
goto out;
}
-
- if (strcmp(kobj->name, PC_KOBJ_ID))
- ser_op_type = "orangefs_param";
- else
- ser_op_type = "orangefs_perf_count";
-
/*
* The service_operation will return an errno return code on
* error, and zero on success.
*/
- rc = service_operation(new_op, ser_op_type, ORANGEFS_OP_INTERRUPTIBLE);
+ rc = service_operation(new_op, ORANGEFS_OP_INTERRUPTIBLE);
out:
if (!rc) {
@@ -792,7 +785,7 @@ static ssize_t sysfs_service_op_store(struct kobject *kobj,
* The service_operation will return a errno return code on
* error, and zero on success.
*/
- rc = service_operation(new_op, "orangefs_param", ORANGEFS_OP_INTERRUPTIBLE);
+ rc = service_operation(new_op, ORANGEFS_OP_INTERRUPTIBLE);
if (rc < 0) {
gossip_err("sysfs_service_op_store: service op returned:%d:\n",
new file mode 100644
@@ -0,0 +1,3 @@
+#include "orangefs-kernel.h"
+#define CREATE_TRACE_POINTS
+#include "orangefs-trace.h"
new file mode 100644
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2018 Omnibond Systems, L.L.C.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM orangefs
+
+#if !defined(_TRACE_ORANGEFS_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_ORANGEFS_H
+
+#include <linux/tracepoint.h>
+
+#define OP_NAME_LEN 64
+
+TRACE_EVENT(orangefs_service_operation,
+ TP_PROTO(struct orangefs_kernel_op_s *op, int flags),
+ TP_ARGS(op, flags),
+ TP_STRUCT__entry(
+ __array(char, op_name, OP_NAME_LEN)
+ __field(int, flags)
+ __field(int, attempts)
+ ),
+ TP_fast_assign(
+ strlcpy(__entry->op_name, get_opname_string(op), OP_NAME_LEN);
+ __entry->flags = flags;
+ __entry->attempts = op->attempts;
+ ),
+ TP_printk(
+ "op_name=%s flags=%d attempts=%d", __entry->op_name, __entry->flags,
+ __entry->attempts
+ )
+);
+
+#endif
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE orangefs-trace
+/* This part must be outside protection */
+#include <trace/define_trace.h>
@@ -304,8 +304,7 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
new_op->upcall.req.getattr.mask =
ORANGEFS_ATTR_SYS_ALL_NOHINT & ~ORANGEFS_ATTR_SYS_SIZE;
- ret = service_operation(new_op, __func__,
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
if (ret != 0)
goto out;
@@ -419,8 +418,7 @@ int orangefs_inode_check_changed(struct inode *inode)
new_op->upcall.req.getattr.mask = ORANGEFS_ATTR_SYS_TYPE |
ORANGEFS_ATTR_SYS_LNK_TARGET;
- ret = service_operation(new_op, __func__,
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
if (ret != 0)
goto out;
@@ -451,8 +449,7 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr)
&new_op->upcall.req.setattr.attributes,
iattr);
if (ret >= 0) {
- ret = service_operation(new_op, __func__,
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
gossip_debug(GOSSIP_UTILS_DEBUG,
"orangefs_inode_setattr: returning %d\n",
@@ -176,7 +176,7 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf)
if (ORANGEFS_SB(sb)->flags & ORANGEFS_OPT_INTR)
flags = ORANGEFS_OP_INTERRUPTIBLE;
- ret = service_operation(new_op, "orangefs_statfs", flags);
+ ret = service_operation(new_op, flags);
if (new_op->downcall.status < 0)
goto out_op_release;
@@ -258,7 +258,7 @@ int orangefs_remount(struct orangefs_sb_info_s *orangefs_sb)
* request_mutex to prevent other operations from bypassing
* this one
*/
- ret = service_operation(new_op, "orangefs_remount",
+ ret = service_operation(new_op,
ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_MUTEX);
gossip_debug(GOSSIP_SUPER_DEBUG,
"orangefs_remount: mount got return value of %d\n",
@@ -280,7 +280,7 @@ int orangefs_remount(struct orangefs_sb_info_s *orangefs_sb)
if (!new_op)
return -ENOMEM;
new_op->upcall.req.features.features = 0;
- ret = service_operation(new_op, "orangefs_features",
+ ret = service_operation(new_op,
ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_MUTEX);
if (!ret)
orangefs_features =
@@ -392,7 +392,7 @@ static int orangefs_unmount(int id, __s32 fs_id, const char *devname)
op->upcall.req.fs_umount.fs_id = fs_id;
strncpy(op->upcall.req.fs_umount.orangefs_config_server,
devname, ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
- r = service_operation(op, "orangefs_fs_umount", 0);
+ r = service_operation(op, 0);
/* Not much to do about an error here. */
if (r)
gossip_err("orangefs_unmount: service_operation %d\n", r);
@@ -492,7 +492,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
"Attempting ORANGEFS Mount via host %s\n",
new_op->upcall.req.fs_mount.orangefs_config_server);
- ret = service_operation(new_op, "orangefs_mount", 0);
+ ret = service_operation(new_op, 0);
gossip_debug(GOSSIP_SUPER_DEBUG,
"orangefs_mount: mount got return value of %d\n", ret);
if (ret)
@@ -553,7 +553,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
if (!new_op)
return ERR_PTR(-ENOMEM);
new_op->upcall.req.features.features = 0;
- ret = service_operation(new_op, "orangefs_features", 0);
+ ret = service_operation(new_op, 0);
orangefs_features = new_op->downcall.resp.features.features;
op_release(new_op);
} else {
@@ -15,6 +15,7 @@
#include "orangefs-kernel.h"
#include "orangefs-bufmap.h"
+#include "orangefs-trace.h"
static int wait_for_matching_downcall(struct orangefs_kernel_op_s *, long, bool);
static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *);
@@ -57,9 +58,7 @@ void purge_waiting_ops(void)
*
* Returns contents of op->downcall.status for convenience
*/
-int service_operation(struct orangefs_kernel_op_s *op,
- const char *op_name,
- int flags)
+int service_operation(struct orangefs_kernel_op_s *op, int flags)
{
long timeout = MAX_SCHEDULE_TIMEOUT;
int ret = 0;
@@ -74,10 +73,11 @@ int service_operation(struct orangefs_kernel_op_s *op,
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: %s op:%p: process:%s: pid:%d:\n",
__func__,
- op_name,
+ get_opname_string(op),
op,
current->comm,
current->pid);
+ trace_orangefs_service_operation(op, flags);
/*
* If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
@@ -159,8 +159,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
/* failed to get matching downcall */
if (ret == -ETIMEDOUT) {
gossip_err("%s: %s -- wait timed out; aborting attempt.\n",
- __func__,
- op_name);
+ __func__, get_opname_string(op));
}
/*
@@ -178,7 +177,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
"orangefs: tag %llu (%s)"
" -- operation to be retried (%d attempt)\n",
llu(op->tag),
- op_name,
+ get_opname_string(op),
op->attempts);
/*
@@ -194,7 +193,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: %s returning: %d for %p.\n",
__func__,
- op_name,
+ get_opname_string(op),
ret,
op);
return ret;
@@ -158,8 +158,7 @@ ssize_t orangefs_inode_getxattr(struct inode *inode, const char *name,
*/
new_op->upcall.req.getxattr.key_sz = strlen(name) + 1;
- ret = service_operation(new_op, "orangefs_inode_getxattr",
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
if (ret != 0) {
if (ret == -ENOENT) {
ret = -ENODATA;
@@ -265,9 +264,7 @@ static int orangefs_inode_removexattr(struct inode *inode, const char *name,
(char *)new_op->upcall.req.removexattr.key,
(int)new_op->upcall.req.removexattr.key_sz);
- ret = service_operation(new_op,
- "orangefs_inode_removexattr",
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
if (ret == -ENOENT) {
/*
* Request to replace a non-existent attribute is an error.
@@ -363,9 +360,7 @@ int orangefs_inode_setxattr(struct inode *inode, const char *name,
(int)new_op->upcall.req.setxattr.keyval.key_sz,
size);
- ret = service_operation(new_op,
- "orangefs_inode_setxattr",
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
gossip_debug(GOSSIP_XATTR_DEBUG,
"orangefs_inode_setxattr: returning %d\n",
@@ -427,8 +422,7 @@ ssize_t orangefs_listxattr(struct dentry *dentry, char *buffer, size_t size)
new_op->upcall.req.listxattr.token = token;
new_op->upcall.req.listxattr.requested_count =
(size == 0) ? 0 : ORANGEFS_MAX_XATTR_LISTLEN;
- ret = service_operation(new_op, __func__,
- get_interruptible_flag(inode));
+ ret = service_operation(new_op, get_interruptible_flag(inode));
if (ret != 0)
goto done;
This is the first tracepoint for OrangeFS. Remove op_name argument to service_operation. It is only used for debug messages, and just as useful information can be extracted from the op. Signed-off-by: Martin Brandenburg <martin@omnibond.com> --- fs/orangefs/Makefile | 4 +++- fs/orangefs/dcache.c | 3 +-- fs/orangefs/dir.c | 3 +-- fs/orangefs/file.c | 10 ++-------- fs/orangefs/inode.c | 2 +- fs/orangefs/namei.c | 12 +++++------- fs/orangefs/orangefs-debugfs.c | 4 +--- fs/orangefs/orangefs-kernel.h | 4 +--- fs/orangefs/orangefs-sysfs.c | 11 ++--------- fs/orangefs/orangefs-trace.c | 3 +++ fs/orangefs/orangefs-trace.h | 41 +++++++++++++++++++++++++++++++++++++++++ fs/orangefs/orangefs-utils.c | 9 +++------ fs/orangefs/super.c | 12 ++++++------ fs/orangefs/waitqueue.c | 15 +++++++-------- fs/orangefs/xattr.c | 14 ++++---------- 15 files changed, 81 insertions(+), 66 deletions(-) create mode 100644 fs/orangefs/orangefs-trace.c create mode 100644 fs/orangefs/orangefs-trace.h