virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Wei Gong <gongwei833x@gmail.com>
To: vgoyal@redhat.com, stefanha@redhat.com, miklos@szeredi.hu
Cc: virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org,
	Wei Gong <gongwei09@baidu.com>
Subject: [PATCH] virtiofs: remove max_pages_limit in indirect descriptor mode
Date: Sat, 11 Oct 2025 11:30:18 +0800	[thread overview]
Message-ID: <20251011033018.75985-1-gongwei833x@gmail.com> (raw)

From: Wei Gong <gongwei09@baidu.com>

Currently, indirect descriptor mode unnecessarily restricts the maximum
IO size based on virtqueue vringsize. However, the indirect descriptor
mechanism inherently supports larger IO operations by chaining descriptors.

This patch removes the artificial constraint, allowing indirect descriptor
mode to utilize its full potential without being limited by vringsize.
The maximum supported descriptors per IO is now determined by the indirect
descriptor capability rather than the virtqueue size.

Signed-off-by: Wei Gong <gongwei09@baidu.com>
---
 fs/fuse/virtio_fs.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 76c8fd0bfc75..c0d5db7d7504 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -12,6 +12,7 @@
 #include <linux/memremap.h>
 #include <linux/module.h>
 #include <linux/virtio.h>
+#include <linux/virtio_ring.h>
 #include <linux/virtio_fs.h>
 #include <linux/delay.h>
 #include <linux/fs_context.h>
@@ -1701,9 +1702,11 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
 	fc->sync_fs = true;
 	fc->use_pages_for_kvec_io = true;
 
-	/* Tell FUSE to split requests that exceed the virtqueue's size */
-	fc->max_pages_limit = min_t(unsigned int, fc->max_pages_limit,
-				    virtqueue_size - FUSE_HEADER_OVERHEAD);
+	if (!virtio_has_feature(fs->vqs[VQ_REQUEST].vq->vdev, VIRTIO_RING_F_INDIRECT_DESC)) {
+		/* Tell FUSE to split requests that exceed the virtqueue's size */
+		fc->max_pages_limit = min_t(unsigned int, fc->max_pages_limit,
+						virtqueue_size - FUSE_HEADER_OVERHEAD);
+	}
 
 	fsc->s_fs_info = fm;
 	sb = sget_fc(fsc, virtio_fs_test_super, set_anon_super_fc);
-- 
2.32.0


             reply	other threads:[~2025-10-11  3:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-11  3:30 Wei Gong [this message]
2025-10-14 18:53 ` [PATCH] virtiofs: remove max_pages_limit in indirect descriptor mode Stefan Hajnoczi
2025-10-15 15:00   ` Michael S. Tsirkin

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=20251011033018.75985-1-gongwei833x@gmail.com \
    --to=gongwei833x@gmail.com \
    --cc=gongwei09@baidu.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=stefanha@redhat.com \
    --cc=vgoyal@redhat.com \
    --cc=virtualization@lists.linux.dev \
    /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).