From: Tejun Heo <tj@kernel.org>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
chavey@google.com
Subject: [PATCH 1/2] vfs: make fcheck_files() an exported functions
Date: Wed, 9 Jan 2013 09:01:05 -0800 [thread overview]
Message-ID: <20130109170105.GM3926@htj.dyndns.org> (raw)
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 *);
next reply other threads:[~2013-01-09 17:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 17:01 Tejun Heo [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130109170105.GM3926@htj.dyndns.org \
--to=tj@kernel.org \
--cc=chavey@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).