Skip to content

Commit

Permalink
btrfs: update barrier in should_cow_block
Browse files Browse the repository at this point in the history
Once there was a simple int force_cow that was used with the plain
barriers, and then converted to a bit, so we should use the appropriate
barrier helper.

Other variables in the complex if condition do not depend on a barrier,
so we should be fine in case the atomic barrier becomes a no-op.

Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
David Sterba committed Mar 31, 2018
1 parent a32bf9a commit d198013
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,8 +1441,8 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans,
if (btrfs_is_testing(root->fs_info))
return 0;

/* ensure we can see the force_cow */
smp_rmb();
/* Ensure we can see the FORCE_COW bit */
smp_mb__before_atomic();

/*
* We do not need to cow a block if
Expand Down

0 comments on commit d198013

Please sign in to comment.