From: Chirantan Ekbote <chirantan@chromium.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Vivek Goyal <vgoyal@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
linux-fsdevel@vger.kernel.org, virtio-fs@redhat.com,
Dylan Reid <dgreid@chromium.org>,
Suleiman Souhlal <suleiman@chromium.org>,
Chirantan Ekbote <chirantan@chromium.org>
Subject: [PATCH 2/2] fuse: virtiofs: Add basic multiqueue support
Date: Fri, 24 Apr 2020 15:25:40 +0900 [thread overview]
Message-ID: <20200424062540.23679-2-chirantan@chromium.org> (raw)
In-Reply-To: <20200424062540.23679-1-chirantan@chromium.org>
Use simple round-robin scheduling based on the `unique` field of the
fuse request to spread requests across multiple queues, if supported by
the device.
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
---
fs/fuse/dev.c | 4 ----
fs/fuse/fuse_i.h | 4 ++++
fs/fuse/virtio_fs.c | 4 +++-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 97eec7522bf20..cad9f76c2519c 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -25,10 +25,6 @@
MODULE_ALIAS_MISCDEV(FUSE_MINOR);
MODULE_ALIAS("devname:fuse");
-/* Ordinary requests have even IDs, while interrupts IDs are odd */
-#define FUSE_INT_REQ_BIT (1ULL << 0)
-#define FUSE_REQ_ID_STEP (1ULL << 1)
-
static struct kmem_cache *fuse_req_cachep;
static struct fuse_dev *fuse_get_dev(struct file *file)
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index ca344bf714045..110b917d950a8 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -47,6 +47,10 @@
/** Number of dentries for each connection in the control filesystem */
#define FUSE_CTL_NUM_DENTRIES 5
+/* Ordinary requests have even IDs, while interrupts IDs are odd */
+#define FUSE_INT_REQ_BIT (1ULL << 0)
+#define FUSE_REQ_ID_STEP (1ULL << 1)
+
/** List of active connections */
extern struct list_head fuse_conn_list;
diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index d3c38222a7e4e..c5129fd27930c 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -980,7 +980,7 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
static void virtio_fs_wake_pending_and_unlock(struct fuse_iqueue *fiq)
__releases(fiq->lock)
{
- unsigned int queue_id = VQ_REQUEST; /* TODO multiqueue */
+ unsigned int queue_id;
struct virtio_fs *fs;
struct fuse_req *req;
struct virtio_fs_vq *fsvq;
@@ -994,6 +994,8 @@ __releases(fiq->lock)
spin_unlock(&fiq->lock);
fs = fiq->priv;
+ queue_id = ((req->in.h.unique / FUSE_REQ_ID_STEP) %
+ (uint64_t)fs->num_request_queues) + VQ_REQUEST;
pr_debug("%s: opcode %u unique %#llx nodeid %#llx in.len %u out.len %u\n",
__func__, req->in.h.opcode, req->in.h.unique,
--
2.26.2.303.gf8c07b1a785-goog
next prev parent reply other threads:[~2020-04-24 6:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 6:25 [PATCH 1/2] fuse: virtiofs: Fix nullptr dereference Chirantan Ekbote
2020-04-24 6:25 ` Chirantan Ekbote [this message]
2020-04-27 15:19 ` [PATCH 2/2] fuse: virtiofs: Add basic multiqueue support Stefan Hajnoczi
2020-04-27 15:22 ` Stefan Hajnoczi
2020-05-01 7:14 ` Chirantan Ekbote
2020-05-01 15:47 ` Stefan Hajnoczi
2020-05-07 8:10 ` Chirantan Ekbote
2020-06-02 9:29 ` Stefan Hajnoczi
2020-04-27 14:38 ` [PATCH 1/2] fuse: virtiofs: Fix nullptr dereference Stefan Hajnoczi
2020-04-27 17:58 ` Vivek Goyal
2020-04-28 8:53 ` Stefan Hajnoczi
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=20200424062540.23679-2-chirantan@chromium.org \
--to=chirantan@chromium.org \
--cc=dgreid@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=stefanha@redhat.com \
--cc=suleiman@chromium.org \
--cc=vgoyal@redhat.com \
--cc=virtio-fs@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).