diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2013-11-14 22:57:29 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-11-20 20:44:47 -0500 |
commit | 4cd8587ce8fb79e49d1d6d1fc065f056188fb86a (patch) | |
tree | 3139157ec70bf16dcc5a436eccd743d41397dc5e /fs/btrfs | |
parent | 52a157592140ac76d9f15637543aecc2100f95cb (diff) | |
download | op-kernel-dev-4cd8587ce8fb79e49d1d6d1fc065f056188fb86a.zip op-kernel-dev-4cd8587ce8fb79e49d1d6d1fc065f056188fb86a.tar.gz |
btrfs: Use trace condition for get_extent tracepoint
Doing an if statement to test some condition to know if we should
trigger a tracepoint is pointless when tracing is disabled. This just
adds overhead and wastes a branch prediction. This is why the
TRACE_EVENT_CONDITION() was created. It places the check inside the jump
label so that the branch does not happen unless tracing is enabled.
That is, instead of doing:
if (em)
trace_btrfs_get_extent(root, em);
Which is basically this:
if (em)
if (static_key(trace_btrfs_get_extent)) {
Using a TRACE_EVENT_CONDITION() we can just do:
trace_btrfs_get_extent(root, em);
And the condition trace event will do:
if (static_key(trace_btrfs_get_extent)) {
if (em) {
...
The static key is a non conditional jump (or nop) that is faster than
having to check if em is NULL or not.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index fd67b34e..f1a7744 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6187,8 +6187,7 @@ insert: write_unlock(&em_tree->lock); out: - if (em) - trace_btrfs_get_extent(root, em); + trace_btrfs_get_extent(root, em); if (path) btrfs_free_path(path); |