Skip to content

Commit

Permalink
btrfs: remove unnecessary memory barrier in btrfs_direct_IO
Browse files Browse the repository at this point in the history
Commit 38851cc ("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 <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ enhance changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Nikolay Borisov authored and David Sterba committed Aug 21, 2017
1 parent b5d9071 commit dc59215
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc59215

Please sign in to comment.