]> git.karo-electronics.de Git - linux-beck.git/commitdiff
btrfs: add barrier for waitqueue_active in clear_btree_io_tree
authorDavid Sterba <dsterba@suse.com>
Sat, 10 Oct 2015 16:24:48 +0000 (18:24 +0200)
committerDavid Sterba <dsterba@suse.com>
Sat, 10 Oct 2015 16:24:48 +0000 (18:24 +0200)
waitqueue_active should be preceded by a barrier, in this function we
don't need to call it all the time.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/transaction.c

index 74bc3338418be39badb2eb73160c20b3e2240c74..e8e5b5a107190a5aa82a4b9d187fbfde3f36f3f7 100644 (file)
@@ -82,6 +82,12 @@ void btrfs_put_transaction(struct btrfs_transaction *transaction)
 static void clear_btree_io_tree(struct extent_io_tree *tree)
 {
        spin_lock(&tree->lock);
+       /*
+        * Do a single barrier for the waitqueue_active check here, the state
+        * of the waitqueue should not change once clear_btree_io_tree is
+        * called.
+        */
+       smp_mb();
        while (!RB_EMPTY_ROOT(&tree->state)) {
                struct rb_node *node;
                struct extent_state *state;