Skip to contentSkip to conversation

NFS: Allow very small rsize & wsize again

PATCH In review Anna Schumaker 2 participants 2 messages Nov 30, 2022 – Dec 1, 2022

Subsystems (2)
lore
Share & tools
lore

Anna Schumaker

author maintainer
#0 lore raw

PATCH 1/1 NFS: Allow very small rsize & wsize again

From: Anna Schumaker <[email protected]>

940261a19508 introduced nfs_io_size() to clamp the iosize to a multiple of PAGE_SIZE. This had the unintended side effect of no longer allowing iosizes less than a page, which could be useful in some situations.

UDP already has an exception that causes it to fall back on the power-of-two style sizes instead. This patch adds an additional exception for very small iosizes.

Fixes 940261a19508 ("NFS: Allow setting rsize / wsize to a multiple of PAGE_SIZE")
---
 fs/nfs/internal.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/nfs/internal.h +2 -4
index 647fc3f547cb..ae7d4a8c728c 100644
@@ -739,12 +739,10 @@ unsigned long nfs_io_size(unsigned long iosize, enum xprt_transports proto)
 		iosize = NFS_DEF_FILE_IO_SIZE;
 	else if (iosize >= NFS_MAX_FILE_IO_SIZE)
 		iosize = NFS_MAX_FILE_IO_SIZE;
-	else
-		iosize = iosize & PAGE_MASK;
 
-	if (proto == XPRT_TRANSPORT_UDP)
+	if (proto == XPRT_TRANSPORT_UDP || iosize < PAGE_SIZE)
 		return nfs_block_bits(iosize, NULL);
-	return iosize;
+	return iosize & PAGE_MASK;
 }
 
 /*
Signature · 1 line
2.38.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Anna Schumaker

From: Anna Schumaker <[email protected]>

940261a19508 introduced nfs_io_size() to clamp the iosize to a multiple of PAGE_SIZE. This had the unintended side effect of no longer allowing iosizes less than a page, which could be useful in some situations.

UDP already has an exception that causes it to fall back on the power-of-two style sizes instead. This patch adds an additional exception for very small iosizes.

Fixes 940261a19508 ("NFS: Allow setting rsize / wsize to a multiple of PAGE_SIZE")
---
 fs/nfs/internal.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/nfs/internal.h +0 -1
index 647fc3f547cb..ae7d4a8c728c 100644
@@ -739,12 +739,10 @@ unsigned long nfs_io_size(unsigned long iosize, enum xprt_transports proto)
 		iosize = NFS_DEF_FILE_IO_SIZE;
 	else if (iosize >= NFS_MAX_FILE_IO_SIZE)
 		iosize = NFS_MAX_FILE_IO_SIZE;
-	else

fs/nfs/internal.h unsigned long nfs_io_size(unsigned long iosize, enum xprt_transports proto) · line 748

Quoted 10 lines
fs/nfs/internal.h +2 -3
-		iosize = iosize & PAGE_MASK;
 
-	if (proto == XPRT_TRANSPORT_UDP)
+	if (proto == XPRT_TRANSPORT_UDP || iosize < PAGE_SIZE)
 		return nfs_block_bits(iosize, NULL);
-	return iosize;
+	return iosize & PAGE_MASK;
 }
 
 /*

Looks good. Thanks, Anna.