diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-02-14 09:53:36 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-03-26 15:09:40 +0200 |
commit | de224b7c56baa335bde9afcb4aa68f03c38f5f42 (patch) | |
tree | 638c272a174b666c8bd4b8c7cf836e3d53cdef19 /fs/btrfs/inode.c | |
parent | btrfs: remove assert in btrfs_init_dev_replace_tgtdev() (diff) | |
download | linux-de224b7c56baa335bde9afcb4aa68f03c38f5f42.tar.xz linux-de224b7c56baa335bde9afcb4aa68f03c38f5f42.zip |
btrfs: Remove redundant memory barriers around dio_private error status
Using any kind of memory barriers around atomic operations which have
a return value is redundant, since those operations themselves are
fully ordered. atomic_t.txt states:
- RMW operations that have a return value are fully ordered;
Fully ordered primitives are ordered against everything prior and
everything subsequent. Therefore a fully ordered primitive is like
having an smp_mb() before and an smp_mb() after the primitive.
Given this let's replace the extra memory barriers with comments.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to '')
-rw-r--r-- | fs/btrfs/inode.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index bb5de52cbc09..be167f5ec433 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8322,13 +8322,13 @@ static void btrfs_end_dio_bio(struct bio *bio) err = dip->subio_endio(dip->inode, btrfs_io_bio(bio), err); if (err) { - dip->errors = 1; - /* - * before atomic variable goto zero, we must make sure - * dip->errors is perceived to be set. + * We want to perceive the errors flag being set before + * decrementing the reference count. We don't need a barrier + * since atomic operations with a return value are fully + * ordered as per atomic_t.txt */ - smp_mb__before_atomic(); + dip->errors = 1; } /* if there are more bios still pending for this dio, just exit */ @@ -8516,10 +8516,11 @@ submit: out_err: dip->errors = 1; /* - * before atomic variable goto zero, we must - * make sure dip->errors is perceived to be set. + * Before atomic variable goto zero, we must make sure dip->errors is + * perceived to be set. This ordering is ensured by the fact that an + * atomic operations with a return value are fully ordered as per + * atomic_t.txt */ - smp_mb__before_atomic(); if (atomic_dec_and_test(&dip->pending_bios)) bio_io_error(dip->orig_bio); |