linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] vfs: make fcheck_files() an exported functions
@ 2013-01-09 17:01 Tejun Heo
  2013-01-09 17:01 ` [PATCH 2/2] vfs: add fcheck tracepoint Tejun Heo
  2013-02-09 19:24 ` [PATCH 1/2] vfs: make fcheck_files() an exported functions Tejun Heo
  0 siblings, 2 replies; 11+ messages in thread
From: Tejun Heo @ 2013-01-09 17:01 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, Steven Rostedt, chavey

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@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
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 *);

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-02-12 21:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-09 17:01 [PATCH 1/2] vfs: make fcheck_files() an exported functions Tejun Heo
2013-01-09 17:01 ` [PATCH 2/2] vfs: add fcheck tracepoint Tejun Heo
2013-02-09 19:24 ` [PATCH 1/2] vfs: make fcheck_files() an exported functions Tejun Heo
2013-02-10  0:18   ` Al Viro
2013-02-12 17:41     ` Tejun Heo
2013-02-12 18:21       ` Steven Rostedt
2013-02-12 20:21         ` Steven Rostedt
2013-02-12 20:44           ` Al Viro
2013-02-12 20:57             ` Steven Rostedt
2013-02-12 20:43         ` Al Viro
2013-02-12 21:03           ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).