We want to add a trace point to fcheck_files() but macros and inline functions defined in header files can't have tracing points. Move fcheck_files() to fs/file.c and make it a proper function. A lot of high-frequency fcheck*() users are inside fs/file.c, and, to reduce the effect of this change, the new exported function is also declared inline. Signed-off-by: Tejun Heo <tj@xxxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> --- These two patches add vfs_fcheck tracepoint. Making fcheck_files() a function isn't optimal but given the tracepoint restriction I can't think of a better way. The TP is currently in use in google to allow ioblame to track who's accessing which file which in turn is used to approximately associate IOs with files. I'm working to upstream the rest of ioblame. Thanks. fs/file.c | 11 +++++++++++ include/linux/fdtable.h | 11 +---------- 2 files changed, 12 insertions(+), 10 deletions(-) --- a/fs/file.c +++ b/fs/file.c @@ -709,6 +709,17 @@ void do_close_on_exec(struct files_struc spin_unlock(&files->file_lock); } +inline struct file *fcheck_files(struct files_struct *files, unsigned int fd) +{ + struct file * file = NULL; + struct fdtable *fdt = files_fdtable(files); + + if (fd < fdt->max_fds) + file = rcu_dereference_check_fdtable(files, fdt->fd[fd]); + return file; +} +EXPORT_SYMBOL(fcheck_files); + struct file *fget(unsigned int fd) { struct file *file; --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h @@ -75,16 +75,6 @@ struct dentry; extern void __init files_defer_init(void); -static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) -{ - struct file * file = NULL; - struct fdtable *fdt = files_fdtable(files); - - if (fd < fdt->max_fds) - file = rcu_dereference_check_fdtable(files, fdt->fd[fd]); - return file; -} - /* * Check whether the specified fd has an open file. */ @@ -92,6 +82,7 @@ static inline struct file * fcheck_files struct task_struct; +struct file *fcheck_files(struct files_struct *files, unsigned int fd); struct files_struct *get_files_struct(struct task_struct *); void put_files_struct(struct files_struct *fs); void reset_files_struct(struct files_struct *); -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html