summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/trace.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-01-07 14:07:36 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2015-01-09 17:02:28 -0800
commitc05086506f2204bcf02c9d3eb7950cdf0d8a3bef (patch)
tree497cac2c9e686e280d83e499cf4577c634f8eabe /fs/f2fs/trace.c
parentdd4e4b59b1a4a7e69083e7dc2abbedb5186fd850 (diff)
downloadlinux-c05086506f2204bcf02c9d3eb7950cdf0d8a3bef.tar.bz2
f2fs: add spin_lock to cover radix operations in IO tracer
This patch adds spin_lock to cover radix tree operations in IO tracer. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/trace.c')
-rw-r--r--fs/f2fs/trace.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/f2fs/trace.c b/fs/f2fs/trace.c
index 19f5216b9b9c..92fa38a47e63 100644
--- a/fs/f2fs/trace.c
+++ b/fs/f2fs/trace.c
@@ -15,7 +15,8 @@
#include "f2fs.h"
#include "trace.h"
-RADIX_TREE(pids, GFP_NOIO);
+RADIX_TREE(pids, GFP_ATOMIC);
+spinlock_t pids_lock;
struct last_io_info last_io;
static inline void __print_last_io(void)
@@ -58,9 +59,13 @@ void f2fs_trace_pid(struct page *page)
page->private = pid;
+ if (radix_tree_preload(GFP_NOFS))
+ return;
+
+ spin_lock(&pids_lock);
p = radix_tree_lookup(&pids, pid);
if (p == current)
- return;
+ goto out;
if (p)
radix_tree_delete(&pids, pid);
@@ -69,7 +74,9 @@ void f2fs_trace_pid(struct page *page)
trace_printk("%3x:%3x %4x %-16s\n",
MAJOR(inode->i_sb->s_dev), MINOR(inode->i_sb->s_dev),
pid, current->comm);
-
+out:
+ spin_unlock(&pids_lock);
+ radix_tree_preload_end();
}
void f2fs_trace_ios(struct page *page, struct f2fs_io_info *fio, int flush)
@@ -108,3 +115,8 @@ void f2fs_trace_ios(struct page *page, struct f2fs_io_info *fio, int flush)
last_io.len = 1;
return;
}
+
+void f2fs_build_trace_ios(void)
+{
+ spin_lock_init(&pids_lock);
+}