| .. | .. |
|---|
| 45 | 45 | { |
|---|
| 46 | 46 | closure_put_after_sub(cl, atomic_sub_return(v, &cl->remaining)); |
|---|
| 47 | 47 | } |
|---|
| 48 | | -EXPORT_SYMBOL(closure_sub); |
|---|
| 49 | 48 | |
|---|
| 50 | 49 | /* |
|---|
| 51 | 50 | * closure_put - decrement a closure's refcount |
|---|
| .. | .. |
|---|
| 54 | 53 | { |
|---|
| 55 | 54 | closure_put_after_sub(cl, atomic_dec_return(&cl->remaining)); |
|---|
| 56 | 55 | } |
|---|
| 57 | | -EXPORT_SYMBOL(closure_put); |
|---|
| 58 | 56 | |
|---|
| 59 | 57 | /* |
|---|
| 60 | 58 | * closure_wake_up - wake up all closures on a wait list, without memory barrier |
|---|
| .. | .. |
|---|
| 76 | 74 | closure_sub(cl, CLOSURE_WAITING + 1); |
|---|
| 77 | 75 | } |
|---|
| 78 | 76 | } |
|---|
| 79 | | -EXPORT_SYMBOL(__closure_wake_up); |
|---|
| 80 | 77 | |
|---|
| 81 | 78 | /** |
|---|
| 82 | 79 | * closure_wait - add a closure to a waitlist |
|---|
| .. | .. |
|---|
| 96 | 93 | |
|---|
| 97 | 94 | return true; |
|---|
| 98 | 95 | } |
|---|
| 99 | | -EXPORT_SYMBOL(closure_wait); |
|---|
| 100 | 96 | |
|---|
| 101 | 97 | struct closure_syncer { |
|---|
| 102 | 98 | struct task_struct *task; |
|---|
| .. | .. |
|---|
| 131 | 127 | |
|---|
| 132 | 128 | __set_current_state(TASK_RUNNING); |
|---|
| 133 | 129 | } |
|---|
| 134 | | -EXPORT_SYMBOL(__closure_sync); |
|---|
| 135 | 130 | |
|---|
| 136 | 131 | #ifdef CONFIG_BCACHE_CLOSURES_DEBUG |
|---|
| 137 | 132 | |
|---|
| .. | .. |
|---|
| 149 | 144 | list_add(&cl->all, &closure_list); |
|---|
| 150 | 145 | spin_unlock_irqrestore(&closure_list_lock, flags); |
|---|
| 151 | 146 | } |
|---|
| 152 | | -EXPORT_SYMBOL(closure_debug_create); |
|---|
| 153 | 147 | |
|---|
| 154 | 148 | void closure_debug_destroy(struct closure *cl) |
|---|
| 155 | 149 | { |
|---|
| .. | .. |
|---|
| 162 | 156 | list_del(&cl->all); |
|---|
| 163 | 157 | spin_unlock_irqrestore(&closure_list_lock, flags); |
|---|
| 164 | 158 | } |
|---|
| 165 | | -EXPORT_SYMBOL(closure_debug_destroy); |
|---|
| 166 | 159 | |
|---|
| 167 | 160 | static struct dentry *closure_debug; |
|---|
| 168 | 161 | |
|---|
| 169 | | -static int debug_seq_show(struct seq_file *f, void *data) |
|---|
| 162 | +static int debug_show(struct seq_file *f, void *data) |
|---|
| 170 | 163 | { |
|---|
| 171 | 164 | struct closure *cl; |
|---|
| 172 | 165 | |
|---|
| .. | .. |
|---|
| 195 | 188 | return 0; |
|---|
| 196 | 189 | } |
|---|
| 197 | 190 | |
|---|
| 198 | | -static int debug_seq_open(struct inode *inode, struct file *file) |
|---|
| 199 | | -{ |
|---|
| 200 | | - return single_open(file, debug_seq_show, NULL); |
|---|
| 201 | | -} |
|---|
| 202 | | - |
|---|
| 203 | | -static const struct file_operations debug_ops = { |
|---|
| 204 | | - .owner = THIS_MODULE, |
|---|
| 205 | | - .open = debug_seq_open, |
|---|
| 206 | | - .read = seq_read, |
|---|
| 207 | | - .release = single_release |
|---|
| 208 | | -}; |
|---|
| 191 | +DEFINE_SHOW_ATTRIBUTE(debug); |
|---|
| 209 | 192 | |
|---|
| 210 | 193 | void __init closure_debug_init(void) |
|---|
| 211 | 194 | { |
|---|
| .. | .. |
|---|
| 216 | 199 | * about this. |
|---|
| 217 | 200 | */ |
|---|
| 218 | 201 | closure_debug = debugfs_create_file( |
|---|
| 219 | | - "closures", 0400, bcache_debug, NULL, &debug_ops); |
|---|
| 202 | + "closures", 0400, bcache_debug, NULL, &debug_fops); |
|---|
| 220 | 203 | } |
|---|
| 221 | 204 | #endif |
|---|
| 222 | 205 | |
|---|