Linux filesystem development
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org
Subject: [PATCH 7/7] fuse: Kill fuse_pqueue::io list and avoid taking fpq->lock on hot paths
Date: Tue, 15 Jan 2019 13:19:53 +0300	[thread overview]
Message-ID: <154754759346.4244.16770136881400272907.stgit@localhost.localdomain> (raw)
In-Reply-To: <154754701031.4244.8089449938935364463.stgit@localhost.localdomain>

This list was used to make fuse_abort_conn() end some
of requests under io. But it is not used anymore.
This allows to avoid taking unneeded fpq->lock in two
hot paths: fuse_dev_do_write() and fuse_dev_do_read().

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/fuse/dev.c    |   16 +++-------------
 fs/fuse/fuse_i.h |    3 ---
 fs/fuse/inode.c  |    1 -
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index c3bacf9191a6..b4ce37dda353 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1339,9 +1339,6 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
 		request_end(fc, req);
 		goto restart;
 	}
-	spin_lock(&fpq->lock);
-	list_add(&req->list, &fpq->io);
-	spin_unlock(&fpq->lock);
 	cs->req = req;
 	err = fuse_copy_one(cs, &in->h, sizeof(in->h));
 	if (!err)
@@ -1362,7 +1359,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
 		goto out_end;
 	}
 	hash = fuse_req_hash(req->in.h.unique);
-	list_move_tail(&req->list, &fpq->processing[hash]);
+	list_add_tail(&req->list, &fpq->processing[hash]);
 	__fuse_get_request(req);
 	set_bit(FR_SENT, &req->flags);
 	spin_unlock(&fpq->lock);
@@ -1375,7 +1372,6 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
 	return reqsize;
 
 out_end:
-	list_del_init(&req->list);
 	spin_unlock(&fpq->lock);
 	request_end(fc, req);
 	return err;
@@ -1951,7 +1947,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
 	}
 
 	clear_bit(FR_SENT, &req->flags);
-	list_move(&req->list, &fpq->io);
+	list_del_init(&req->list);
 	req->out.h = oh;
 	spin_unlock(&fpq->lock);
 	cs->req = req;
@@ -1961,13 +1957,8 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
 	err = copy_out_args(cs, &req->out, nbytes);
 	fuse_copy_finish(cs);
 
-	spin_lock(&fpq->lock);
-	if (!fpq->connected)
-		err = -ENOENT;
-	else if (err)
+	if (err)
 		req->out.h.error = -EIO;
-	list_del_init(&req->list);
-	spin_unlock(&fpq->lock);
 
 	request_end(fc, req);
 out:
@@ -2217,7 +2208,6 @@ int fuse_dev_release(struct inode *inode, struct file *file)
 		unsigned int i;
 
 		spin_lock(&fpq->lock);
-		WARN_ON(!list_empty(&fpq->io));
 		for (i = 0; i < FUSE_PQ_HASH_SIZE; i++)
 			list_splice_init(&fpq->processing[i], &to_end);
 		spin_unlock(&fpq->lock);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 09ea5773ad81..e6b7087fd6b1 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -469,9 +469,6 @@ struct fuse_pqueue {
 
 	/** Hash table of requests being processed */
 	struct list_head *processing;
-
-	/** The list of requests under I/O */
-	struct list_head io;
 };
 
 /**
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 0361a3d62356..a36d2675471f 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -601,7 +601,6 @@ static void fuse_pqueue_init(struct fuse_pqueue *fpq)
 	spin_lock_init(&fpq->lock);
 	for (i = 0; i < FUSE_PQ_HASH_SIZE; i++)
 		INIT_LIST_HEAD(&fpq->processing[i]);
-	INIT_LIST_HEAD(&fpq->io);
 	fpq->connected = 1;
 }
 


      parent reply	other threads:[~2019-01-15 10:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 10:19 [PATCH 0/7] fuse: Improve disconnect scheme and avoid taking fpq->lock on hot paths Kirill Tkhai
2019-01-15 10:19 ` [PATCH 1/7] fuse: Check for fc->connected in fuse_dev_alloc() Kirill Tkhai
2019-01-18 12:07   ` Miklos Szeredi
2019-01-18 12:28     ` Kirill Tkhai
2019-01-23  9:45       ` Miklos Szeredi
2019-01-23  9:55         ` Kirill Tkhai
2019-01-23 10:24           ` Miklos Szeredi
2019-01-15 10:19 ` [PATCH 2/7] fuse: Move flush_bg_queue() up in fuse_abort_conn() Kirill Tkhai
2019-01-15 10:19 ` [PATCH 3/7] fuse: Drop and reacquire fc->lock in middle of fuse_abort_conn() Kirill Tkhai
2019-01-15 10:19 ` [PATCH 4/7] fuse: Add fud pointer to struct fuse_copy_state Kirill Tkhai
2019-01-15 10:19 ` [PATCH 5/7] fuse: Introduce generic fuse_copy_aborted() Kirill Tkhai
2019-01-17  9:48   ` Miklos Szeredi
2019-01-15 10:19 ` [PATCH 6/7] fuse: Kill unused FR_ABORTED, FR_LOCKED and FR_PRIVATE flags Kirill Tkhai
2019-01-15 10:19 ` Kirill Tkhai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=154754759346.4244.16770136881400272907.stgit@localhost.localdomain \
    --to=ktkhai@virtuozzo.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox