Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 May 2026 21:23:02 +0000
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 882181b1ae4c - main - p9fs: Implement msize mount option and bump default to 128 KiB
Message-ID:  <6a160f36.22e4e.1d353044@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=882181b1ae4c78b4f191fdb7cf6fe1b6ff83c9ff

commit 882181b1ae4c78b4f191fdb7cf6fe1b6ff83c9ff
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2026-05-26 19:38:18 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2026-05-26 19:38:18 +0000

    p9fs: Implement msize mount option and bump default to 128 KiB
    
    QEMU warns when msize is <= 8192 due to degraded performance.
    This change bumps our default msize to 128 KiB, matching the
    Linux Kernel v5.15 and newer default. Linux supports even larger values,
    but 128 KiB is a sensible default.
    
    We also add a new 'msize' mount option to allow users to override
    this value, and we validate it against our maximum supported MTU
    (currently fixed by the UMA zone size).
    
    Reviewed by:    markj
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D56496
---
 sys/fs/p9fs/p9_client.c   | 9 ++++++++-
 sys/fs/p9fs/p9_client.h   | 7 +++++--
 sys/fs/p9fs/p9fs_vfsops.c | 2 +-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/sys/fs/p9fs/p9_client.c b/sys/fs/p9fs/p9_client.c
index 27a6c1eb366d..d3be87ee1645 100644
--- a/sys/fs/p9fs/p9_client.c
+++ b/sys/fs/p9fs/p9_client.c
@@ -95,7 +95,14 @@ p9_parse_opts(struct mount  *mp, struct p9_client *clnt)
 
 	/* These are defaults for now */
 	clnt->proto_version = p9_proto_2000L;
-	clnt->msize = 8192;
+	clnt->msize = P9FS_MTU;
+
+	vfs_scanopt(mp->mnt_optnew, "msize", "%u", &clnt->msize);
+	if (clnt->msize > P9FS_MTU) {
+		vfs_mount_error(mp, "msize %u is greater than max allowed %u",
+		    clnt->msize, P9FS_MTU);
+		return (EINVAL);
+	}
 
 	/* Get the default trans callback */
 	clnt->ops = p9_get_trans_by_name(trans);
diff --git a/sys/fs/p9fs/p9_client.h b/sys/fs/p9fs/p9_client.h
index 5db46d97c704..e5167f9a0f58 100644
--- a/sys/fs/p9fs/p9_client.h
+++ b/sys/fs/p9fs/p9_client.h
@@ -65,8 +65,11 @@ enum transport_status {
 	P9FS_DISCONNECT,	/* transport has been dosconnected */
 };
 
-/* This is set by QEMU so we will oblige */
-#define P9FS_MTU 8192
+/*
+ * This matches the Linux 5.15 and newer default.
+ * Note: Linux allows larger msize values than this.
+ */
+#define P9FS_MTU 131072
 
 /*
  * Even though we have a 8k buffer, Qemu is typically doing 8168
diff --git a/sys/fs/p9fs/p9fs_vfsops.c b/sys/fs/p9fs/p9fs_vfsops.c
index a0f0a5a4e494..fe8c1b5ded31 100644
--- a/sys/fs/p9fs/p9fs_vfsops.c
+++ b/sys/fs/p9fs/p9fs_vfsops.c
@@ -59,7 +59,7 @@ extern struct vop_vector p9fs_vnops;
 
 /* option parsing */
 static const char *p9fs_opts[] = {
-        "from", "trans", "access", NULL
+        "from", "trans", "access", "msize", NULL
 };
 
 /* Dispose p9fs node, freeing it to the UMA zone */


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a160f36.22e4e.1d353044>