Skip to content

Commit

Permalink
btrfs: remove extra barrier before waitqueue_active
Browse files Browse the repository at this point in the history
Removing barriers is scary, but a call to atomic_dec_and_test implies
a barrier, so we don't need to issue another one.

Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
David Sterba committed Oct 10, 2015
1 parent a83342a commit 779adf0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ int btrfs_pin_log_trans(struct btrfs_root *root)
void btrfs_end_log_trans(struct btrfs_root *root)
{
if (atomic_dec_and_test(&root->log_writers)) {
smp_mb();
/*
* Implicit memory barrier after atomic_dec_and_test
*/
if (waitqueue_active(&root->log_writer_wait))
wake_up(&root->log_writer_wait);
}
Expand Down Expand Up @@ -2820,7 +2822,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,

mutex_lock(&log_root_tree->log_mutex);
if (atomic_dec_and_test(&log_root_tree->log_writers)) {
smp_mb();
/*
* Implicit memory barrier after atomic_dec_and_test
*/
if (waitqueue_active(&log_root_tree->log_writer_wait))
wake_up(&log_root_tree->log_writer_wait);
}
Expand Down

0 comments on commit 779adf0

Please sign in to comment.