]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
btrfs: Remove redundant memory barrier in dev stats
authorNikolay Borisov <nborisov@suse.com>
Fri, 20 Oct 2017 15:10:58 +0000 (18:10 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 22 Jan 2018 15:08:10 +0000 (16:08 +0100)
As per atomic_t.txt documentation :
 - RMW operations that have a return value are fully ordered;

atomic_xchg is one such operation so it already includes everything it
needs w.r.t memory ordering and add a comment to be more explicit about
that.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.h

index 38fd368ddfe745cd10f9aed3c29859d11181efe2..177814a7c7584777ceab0e824d3abb39e43be190 100644 (file)
@@ -519,7 +519,13 @@ static inline int btrfs_dev_stat_read_and_reset(struct btrfs_device *dev,
        int ret;
 
        ret = atomic_xchg(dev->dev_stat_values + index, 0);
-       smp_mb__before_atomic();
+       /*
+        * atomic_xchg implies a full memory barriers as per atomic_t.txt:
+        * - RMW operations that have a return value are fully ordered;
+        *
+        * This implicit memory barriers is paired with the smp_rmb in
+        * btrfs_run_dev_stats
+        */
        atomic_inc(&dev->dev_stats_ccnt);
        return ret;
 }