Blame patches.suse/btrfs-simplify-inode-locking-for-RWF_NOWAIT.patch
|
Goldwyn Rodrigues |
d0e4b4 |
From 9cf35f673583ccc9f3e2507498b3079d56614ad3 Mon Sep 17 00:00:00 2001
|
|
Goldwyn Rodrigues |
d0e4b4 |
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
|
Goldwyn Rodrigues |
d0e4b4 |
Date: Wed Sep 11 11:45:15 2019 -0500
|
|
Goldwyn Rodrigues |
d0e4b4 |
Subject: [PATCH] btrfs: simplify inode locking for RWF_NOWAIT
|
|
Goldwyn Rodrigues |
d0e4b4 |
Git-commit: 9cf35f673583ccc9f3e2507498b3079d56614ad3
|
|
Goldwyn Rodrigues |
d0e4b4 |
References: git-fixes
|
|
Goldwyn Rodrigues |
d0e4b4 |
Patch-mainline: v5.5-rc1
|
|
Goldwyn Rodrigues |
d0e4b4 |
|
|
Goldwyn Rodrigues |
d0e4b4 |
This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression"). Apparently
|
|
Goldwyn Rodrigues |
d0e4b4 |
our current rwsem code doesn't like doing the trylock, then lock for
|
|
Goldwyn Rodrigues |
d0e4b4 |
real scheme. This causes extra contention on the lock and can be
|
|
Goldwyn Rodrigues |
d0e4b4 |
measured eg. by AIM7 benchmark. So change our read/write methods to
|
|
Goldwyn Rodrigues |
d0e4b4 |
just do the trylock for the RWF_NOWAIT case.
|
|
Goldwyn Rodrigues |
d0e4b4 |
|
|
Goldwyn Rodrigues |
d0e4b4 |
Fixes: edf064e7c6fe ("btrfs: nowait aio support")
|
|
Goldwyn Rodrigues |
d0e4b4 |
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
|
Goldwyn Rodrigues |
d0e4b4 |
Reviewed-by: David Sterba <dsterba@suse.com>
|
|
Goldwyn Rodrigues |
d0e4b4 |
[ update changelog ]
|
|
Goldwyn Rodrigues |
d0e4b4 |
Signed-off-by: David Sterba <dsterba@suse.com>
|
|
Goldwyn Rodrigues |
d0e4b4 |
|
|
Goldwyn Rodrigues |
d0e4b4 |
---
|
|
Goldwyn Rodrigues |
d0e4b4 |
fs/btrfs/file.c | 5 +++--
|
|
Goldwyn Rodrigues |
d0e4b4 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
Goldwyn Rodrigues |
d0e4b4 |
|
|
Goldwyn Rodrigues |
d0e4b4 |
--- a/fs/btrfs/file.c
|
|
Goldwyn Rodrigues |
d0e4b4 |
+++ b/fs/btrfs/file.c
|
|
Goldwyn Rodrigues |
d0e4b4 |
@@ -1899,9 +1899,10 @@
|
|
Goldwyn Rodrigues |
d0e4b4 |
loff_t oldsize;
|
|
Goldwyn Rodrigues |
d0e4b4 |
int clean_page = 0;
|
|
Goldwyn Rodrigues |
d0e4b4 |
|
|
Goldwyn Rodrigues |
d0e4b4 |
- if (!inode_trylock(inode)) {
|
|
Goldwyn Rodrigues |
d0e4b4 |
- if (iocb->ki_flags & IOCB_NOWAIT)
|
|
Goldwyn Rodrigues |
d0e4b4 |
+ if (iocb->ki_flags & IOCB_NOWAIT) {
|
|
Goldwyn Rodrigues |
d0e4b4 |
+ if (!inode_trylock(inode))
|
|
Goldwyn Rodrigues |
d0e4b4 |
return -EAGAIN;
|
|
Goldwyn Rodrigues |
d0e4b4 |
+ } else {
|
|
Goldwyn Rodrigues |
d0e4b4 |
inode_lock(inode);
|
|
Goldwyn Rodrigues |
d0e4b4 |
}
|
|
Goldwyn Rodrigues |
d0e4b4 |
|