From: Nikolay Borisov Date: Tue, 1 Aug 2017 15:25:56 +0000 (+0300) Subject: btrfs: remove unnecessary memory barrier in btrfs_direct_IO X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dc59215d4f42084ee13654bafe3e5130b146aeb7;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git btrfs: remove unnecessary memory barrier in btrfs_direct_IO Commit 38851cc19adb ("Btrfs: implement unlocked dio write") implemented unlocked dio write, allowing multiple dio writers to write to non-overlapping, and non-eof-extending regions. In doing so it also introduced a broken memory barrier. It is broken due to 2 things: 1. Memory barriers _MUST_ always be paired, this is clearly not the case here 2. Checkpatch actually produces a warning if a memory barrier is introduced that doesn't have a comment explaining how it's being paired. Specifically for inode::i_dio_count that's wrapped inside inode_dio_begin, there is no explicit barrier semantics attached, so removing is fine as the atomic is used in common the waiter/wakeup pattern. Signed-off-by: Nikolay Borisov Reviewed-by: David Sterba [ enhance changelog ] Signed-off-by: David Sterba --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 61f1ad89e97a..d184a46e46c4 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8815,7 +8815,6 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) return 0; inode_dio_begin(inode); - smp_mb__after_atomic(); /* * The generic stuff only does filemap_write_and_wait_range, which