[Devel] [PATCH vz7 04/46] fuse: account as waiting before queuing for background
Maxim Patlasov
mpatlasov at virtuozzo.com
Fri Mar 24 19:13:28 PDT 2017
Backport from ml:
commit 5437f2417225dc89c785867f4790012668006abc
Author: Miklos Szeredi <mszeredi at suse.cz>
Date: Wed Jul 1 16:25:56 2015 +0200
fuse: account as waiting before queuing for background
Move accounting of fc->num_waiting to the point where the request actually
starts waiting. This is earlier than the current queue_request() for
background requests, since they might be waiting on the fc->bg_queue before
being queued on fc->pending.
Signed-off-by: Miklos Szeredi <mszeredi at suse.cz>
Reviewed-by: Ashish Samant <ashish.samant at oracle.com>
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
fs/fuse/dev.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 92ec220..1dd88a9 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -299,10 +299,6 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
list_add_tail(&req->list, &fc->pending);
req->state = FUSE_REQ_PENDING;
- if (!req->waiting) {
- req->waiting = 1;
- atomic_inc(&fc->num_waiting);
- }
wake_up(&fc->waitq);
kill_fasync(&fc->fasync, SIGIO, POLL_IN);
}
@@ -504,6 +500,10 @@ void fuse_request_check_and_send(struct fuse_conn *fc, struct fuse_req *req,
struct fuse_file *ff)
{
req->isreply = 1;
+ if (!req->waiting) {
+ req->waiting = 1;
+ atomic_inc(&fc->num_waiting);
+ }
__fuse_request_send(fc, req, ff);
}
@@ -517,6 +517,10 @@ static void fuse_request_send_nowait_locked(struct fuse_conn *fc,
struct fuse_req *req)
{
BUG_ON(!req->background);
+ if (!req->waiting) {
+ req->waiting = 1;
+ atomic_inc(&fc->num_waiting);
+ }
fc->num_background++;
if (fc->num_background == fc->max_background)
fc->blocked = 1;
More information about the Devel
mailing list