btrfs: simplify inode locking for RWF_NOWAIT
authorGoldwyn Rodrigues <rgoldwyn@suse.com>
Wed, 11 Sep 2019 16:45:15 +0000 (11:45 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2020 18:47:02 +0000 (19:47 +0100)
commit60dc79d678541a055076ac2cbef571e5d881334c
tree6870efd8da21295cb190a3e858db94f9d5384742
parent8c2cdfb2c81bb533b9e6a3874ee5399102c4c580
btrfs: simplify inode locking for RWF_NOWAIT

commit 9cf35f673583ccc9f3e2507498b3079d56614ad3 upstream.

This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression"). Apparently
our current rwsem code doesn't like doing the trylock, then lock for
real scheme. This causes extra contention on the lock and can be
measured eg. by AIM7 benchmark.  So change our read/write methods to
just do the trylock for the RWF_NOWAIT case.

Fixes: edf064e7c6fe ("btrfs: nowait aio support")
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/file.c