提交 a4f256ba 编写于 作者: H Hou Tao 提交者: Yang Yingliang

vfs: add bare tracepoints for vfs read and release

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4H3JT
CVE: NA

---------------------------

Add a writable bare tracepoint fs_file_read() and a bare
tracepoint fs_file_release().

A version field is added to fs_file_read() to support
extension of fs_file_read_ctx in future.

These two tracepoints need to be exported and will be
used by filesystem kernel module.
Signed-off-by: NHou Tao <houtao1@huawei.com>
Acked-by: Nfang wei <fangwei1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 abe15e31
......@@ -24,6 +24,8 @@
#include <linux/uaccess.h>
#include <asm/unistd.h>
#define CREATE_TRACE_POINTS
#include <trace/events/fs.h>
const struct file_operations generic_ro_fops = {
.llseek = generic_file_llseek,
......@@ -2164,3 +2166,6 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
return ret;
}
EXPORT_SYMBOL(vfs_dedupe_file_range);
EXPORT_TRACEPOINT_SYMBOL_GPL(fs_file_read);
EXPORT_TRACEPOINT_SYMBOL_GPL(fs_file_release);
......@@ -3585,4 +3585,21 @@ static inline struct sock *io_uring_get_socket(struct file *file)
}
#endif
struct fs_file_read_ctx {
const unsigned char *name;
unsigned int f_mode;
unsigned int rsvd;
/* clear from f_mode */
unsigned int clr_f_mode;
/* set into f_mode */
unsigned int set_f_mode;
unsigned long key;
/* file size */
long long i_size;
/* previous page index */
long long prev_index;
/* current page index */
long long index;
};
#endif /* _LINUX_FS_H */
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM fs
#if !defined(_TRACE_FS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_FS_H
#include <linux/types.h>
#include <linux/tracepoint.h>
#include <linux/fs.h>
#undef FS_DECLARE_TRACE
#ifdef DECLARE_TRACE_WRITABLE
#define FS_DECLARE_TRACE(call, proto, args, size) \
DECLARE_TRACE_WRITABLE(call, PARAMS(proto), PARAMS(args), size)
#else
#define FS_DECLARE_TRACE(call, proto, args, size) \
DECLARE_TRACE(call, PARAMS(proto), PARAMS(args))
#endif
FS_DECLARE_TRACE(fs_file_read,
TP_PROTO(struct fs_file_read_ctx *ctx, int version),
TP_ARGS(ctx, version),
sizeof(struct fs_file_read_ctx));
DECLARE_TRACE(fs_file_release,
TP_PROTO(struct inode *inode, struct file *filp),
TP_ARGS(inode, filp));
#endif /* _TRACE_FS_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册