aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/trace.c')
-rw-r--r--fs/f2fs/trace.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/f2fs/trace.c b/fs/f2fs/trace.c
index ce2a5eb210b6..d0ab533a9ce8 100644
--- a/fs/f2fs/trace.c
+++ b/fs/f2fs/trace.c
@@ -14,7 +14,7 @@
14#include "trace.h" 14#include "trace.h"
15 15
16static RADIX_TREE(pids, GFP_ATOMIC); 16static RADIX_TREE(pids, GFP_ATOMIC);
17static struct mutex pids_lock; 17static spinlock_t pids_lock;
18static struct last_io_info last_io; 18static struct last_io_info last_io;
19 19
20static inline void __print_last_io(void) 20static inline void __print_last_io(void)
@@ -58,23 +58,29 @@ void f2fs_trace_pid(struct page *page)
58 58
59 set_page_private(page, (unsigned long)pid); 59 set_page_private(page, (unsigned long)pid);
60 60
61retry:
61 if (radix_tree_preload(GFP_NOFS)) 62 if (radix_tree_preload(GFP_NOFS))
62 return; 63 return;
63 64
64 mutex_lock(&pids_lock); 65 spin_lock(&pids_lock);
65 p = radix_tree_lookup(&pids, pid); 66 p = radix_tree_lookup(&pids, pid);
66 if (p == current) 67 if (p == current)
67 goto out; 68 goto out;
68 if (p) 69 if (p)
69 radix_tree_delete(&pids, pid); 70 radix_tree_delete(&pids, pid);
70 71
71 f2fs_radix_tree_insert(&pids, pid, current); 72 if (radix_tree_insert(&pids, pid, current)) {
73 spin_unlock(&pids_lock);
74 radix_tree_preload_end();
75 cond_resched();
76 goto retry;
77 }
72 78
73 trace_printk("%3x:%3x %4x %-16s\n", 79 trace_printk("%3x:%3x %4x %-16s\n",
74 MAJOR(inode->i_sb->s_dev), MINOR(inode->i_sb->s_dev), 80 MAJOR(inode->i_sb->s_dev), MINOR(inode->i_sb->s_dev),
75 pid, current->comm); 81 pid, current->comm);
76out: 82out:
77 mutex_unlock(&pids_lock); 83 spin_unlock(&pids_lock);
78 radix_tree_preload_end(); 84 radix_tree_preload_end();
79} 85}
80 86
@@ -119,7 +125,7 @@ void f2fs_trace_ios(struct f2fs_io_info *fio, int flush)
119 125
120void f2fs_build_trace_ios(void) 126void f2fs_build_trace_ios(void)
121{ 127{
122 mutex_init(&pids_lock); 128 spin_lock_init(&pids_lock);
123} 129}
124 130
125#define PIDVEC_SIZE 128 131#define PIDVEC_SIZE 128
@@ -147,7 +153,7 @@ void f2fs_destroy_trace_ios(void)
147 pid_t next_pid = 0; 153 pid_t next_pid = 0;
148 unsigned int found; 154 unsigned int found;
149 155
150 mutex_lock(&pids_lock); 156 spin_lock(&pids_lock);
151 while ((found = gang_lookup_pids(pid, next_pid, PIDVEC_SIZE))) { 157 while ((found = gang_lookup_pids(pid, next_pid, PIDVEC_SIZE))) {
152 unsigned idx; 158 unsigned idx;
153 159
@@ -155,5 +161,5 @@ void f2fs_destroy_trace_ios(void)
155 for (idx = 0; idx < found; idx++) 161 for (idx = 0; idx < found; idx++)
156 radix_tree_delete(&pids, pid[idx]); 162 radix_tree_delete(&pids, pid[idx]);
157 } 163 }
158 mutex_unlock(&pids_lock); 164 spin_unlock(&pids_lock);
159} 165}