[Virtio-fs] [PATCH 3/6] fuse: Do cond_resched() if we can't get inode lock

Vivek Goyal vgoyal at redhat.com
Tue Jul 16 21:00:48 UTC 2019


cond_resched() might be better as opposed

Signed-off-by: Vivek Goyal <vgoyal at redhat.com>
---
 fs/fuse/file.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6e351fed6d65..fc40e0f44578 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -4167,7 +4167,7 @@ static int try_to_free_dmap_chunks(struct fuse_conn *fc,
 				   unsigned long nr_to_free)
 {
 	struct fuse_dax_mapping *dmap, *pos, *temp;
-	int ret, nr_freed = 0, nr_eagain = 0;
+	int ret, nr_freed = 0;
 	u64 dmap_start = 0, window_offset = 0;
 	struct inode *inode = NULL;
 
@@ -4176,12 +4176,6 @@ static int try_to_free_dmap_chunks(struct fuse_conn *fc,
 		if (nr_freed >= nr_to_free)
 			break;
 
-		if (nr_eagain > 20) {
-			queue_delayed_work(system_long_wq, &fc->dax_free_work,
-						msecs_to_jiffies(10));
-			return 0;
-		}
-
 		dmap = NULL;
 		spin_lock(&fc->lock);
 
@@ -4225,7 +4219,7 @@ static int try_to_free_dmap_chunks(struct fuse_conn *fc,
 
 		/* Could not get inode lock. Try next element */
 		if (ret == -EAGAIN) {
-			nr_eagain++;
+			cond_resched();
 			continue;
 		}
 		nr_freed++;
-- 
2.20.1




More information about the Virtio-fs mailing list