summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 2009cea65d89..f8220ec02036 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -222,11 +222,8 @@ int btrfs_pin_log_trans(struct btrfs_root *root)
222void btrfs_end_log_trans(struct btrfs_root *root) 222void btrfs_end_log_trans(struct btrfs_root *root)
223{ 223{
224 if (atomic_dec_and_test(&root->log_writers)) { 224 if (atomic_dec_and_test(&root->log_writers)) {
225 /* 225 /* atomic_dec_and_test implies a barrier */
226 * Implicit memory barrier after atomic_dec_and_test 226 cond_wake_up_nomb(&root->log_writer_wait);
227 */
228 if (waitqueue_active(&root->log_writer_wait))
229 wake_up(&root->log_writer_wait);
230 } 227 }
231} 228}
232 229
@@ -2988,11 +2985,8 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2988 2985
2989 mutex_lock(&log_root_tree->log_mutex); 2986 mutex_lock(&log_root_tree->log_mutex);
2990 if (atomic_dec_and_test(&log_root_tree->log_writers)) { 2987 if (atomic_dec_and_test(&log_root_tree->log_writers)) {
2991 /* 2988 /* atomic_dec_and_test implies a barrier */
2992 * Implicit memory barrier after atomic_dec_and_test 2989 cond_wake_up_nomb(&log_root_tree->log_writer_wait);
2993 */
2994 if (waitqueue_active(&log_root_tree->log_writer_wait))
2995 wake_up(&log_root_tree->log_writer_wait);
2996 } 2990 }
2997 2991
2998 if (ret) { 2992 if (ret) {
@@ -3116,13 +3110,11 @@ out_wake_log_root:
3116 mutex_unlock(&log_root_tree->log_mutex); 3110 mutex_unlock(&log_root_tree->log_mutex);
3117 3111
3118 /* 3112 /*
3119 * The barrier before waitqueue_active is needed so all the updates 3113 * The barrier before waitqueue_active (in cond_wake_up) is needed so
3120 * above are seen by the woken threads. It might not be necessary, but 3114 * all the updates above are seen by the woken threads. It might not be
3121 * proving that seems to be hard. 3115 * necessary, but proving that seems to be hard.
3122 */ 3116 */
3123 smp_mb(); 3117 cond_wake_up(&log_root_tree->log_commit_wait[index2]);
3124 if (waitqueue_active(&log_root_tree->log_commit_wait[index2]))
3125 wake_up(&log_root_tree->log_commit_wait[index2]);
3126out: 3118out:
3127 mutex_lock(&root->log_mutex); 3119 mutex_lock(&root->log_mutex);
3128 btrfs_remove_all_log_ctxs(root, index1, ret); 3120 btrfs_remove_all_log_ctxs(root, index1, ret);
@@ -3131,13 +3123,11 @@ out:
3131 mutex_unlock(&root->log_mutex); 3123 mutex_unlock(&root->log_mutex);
3132 3124
3133 /* 3125 /*
3134 * The barrier before waitqueue_active is needed so all the updates 3126 * The barrier before waitqueue_active (in cond_wake_up) is needed so
3135 * above are seen by the woken threads. It might not be necessary, but 3127 * all the updates above are seen by the woken threads. It might not be
3136 * proving that seems to be hard. 3128 * necessary, but proving that seems to be hard.
3137 */ 3129 */
3138 smp_mb(); 3130 cond_wake_up(&root->log_commit_wait[index1]);
3139 if (waitqueue_active(&root->log_commit_wait[index1]))
3140 wake_up(&root->log_commit_wait[index1]);
3141 return ret; 3131 return ret;
3142} 3132}
3143 3133