[PATCH v4 01/11] net/9p: Adjust maximum MSIZE to account for p9 header

Eric Van Hensbergen posted 11 patches 2 years, 6 months ago
[PATCH v4 01/11] net/9p: Adjust maximum MSIZE to account for p9 header
Posted by Eric Van Hensbergen 2 years, 6 months ago
Add maximum p9 header size to MSIZE to make sure we can
have page aligned data.

Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
---
 net/9p/client.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index 622ec6a586ee..6c2a768a6ab1 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -28,7 +28,11 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/9p.h>
 
-#define DEFAULT_MSIZE (128 * 1024)
+/* DEFAULT MSIZE = 32 pages worth of payload + P9_HDRSZ +
+ * room for write (16 extra) or read (11 extra) operands.
+ */
+
+#define DEFAULT_MSIZE ((128 * 1024) + P9_IOHDRSZ)
 
 /* Client Option Parsing (code inspired by NFS code)
  *  - a little lazy - parse all client options
-- 
2.37.2
Re: [PATCH v4 01/11] net/9p: Adjust maximum MSIZE to account for p9 header
Posted by asmadeus@codewreck.org 2 years, 6 months ago
Eric Van Hensbergen wrote on Sat, Feb 18, 2023 at 12:33:13AM +0000:
> Add maximum p9 header size to MSIZE to make sure we can
> have page aligned data.
> 
> Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>

I'd be tempted to round that up to the next PAGE_SIZE, but it likely
won't make any difference in practice if we want to round the actual
payload. Let's go for this.

Reviewed-by: Dominique Martinet <asmadeus@codewreck.org>

> ---
>  net/9p/client.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/net/9p/client.c b/net/9p/client.c
> index 622ec6a586ee..6c2a768a6ab1 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -28,7 +28,11 @@
>  #define CREATE_TRACE_POINTS
>  #include <trace/events/9p.h>
>  
> -#define DEFAULT_MSIZE (128 * 1024)
> +/* DEFAULT MSIZE = 32 pages worth of payload + P9_HDRSZ +
> + * room for write (16 extra) or read (11 extra) operands.
> + */
> +
> +#define DEFAULT_MSIZE ((128 * 1024) + P9_IOHDRSZ)
>  
>  /* Client Option Parsing (code inspired by NFS code)
>   *  - a little lazy - parse all client options