btrfs: comment waitqueue_active implied by locks
authorDavid Sterba <dsterba@suse.com>
Sat, 10 Oct 2015 16:35:10 +0000 (18:35 +0200)
committerDavid Sterba <dsterba@suse.com>
Sat, 10 Oct 2015 16:35:10 +0000 (18:35 +0200)
Suggested-by: Chris Mason <clm@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c
fs/btrfs/tree-log.c

index fcf7265ca46fd84a65b647619f4e07ba996d7a9f..1a33d3eb36de184e4cbcf72efb26687857c70051 100644 (file)
@@ -810,7 +810,11 @@ static noinline void unlock_stripe(struct btrfs_raid_bio *rbio)
                        }
 
                        goto done_nolock;
-               } else  if (waitqueue_active(&h->wait)) {
+                       /*
+                        * The barrier for this waitqueue_active is not needed,
+                        * we're protected by h->lock and can't miss a wakeup.
+                        */
+               } else if (waitqueue_active(&h->wait)) {
                        spin_unlock(&rbio->bio_list_lock);
                        spin_unlock_irqrestore(&h->lock, flags);
                        wake_up(&h->wait);
index 1bbaace733838e6fc70dba1babafb6f9265c00f9..d0deb4643502589145e3802cc30bd383d6702217 100644 (file)
@@ -2950,6 +2950,9 @@ out_wake_log_root:
        atomic_set(&log_root_tree->log_commit[index2], 0);
        mutex_unlock(&log_root_tree->log_mutex);
 
+       /*
+        * The barrier before waitqueue_active is implied by mutex_unlock
+        */
        if (waitqueue_active(&log_root_tree->log_commit_wait[index2]))
                wake_up(&log_root_tree->log_commit_wait[index2]);
 out:
@@ -2961,6 +2964,9 @@ out:
        atomic_set(&root->log_commit[index1], 0);
        mutex_unlock(&root->log_mutex);
 
+       /*
+        * The barrier before waitqueue_active is implied by mutex_unlock
+        */
        if (waitqueue_active(&root->log_commit_wait[index1]))
                wake_up(&root->log_commit_wait[index1]);
        return ret;