Skip to contentSkip to conversation

NFS: Don't overfill uncached readdir pages

PATCH New [email protected] 1 participant 1 message Jan 19, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 NFS: Don't overfill uncached readdir pages

From: Trond Myklebust <[email protected]>

If we're doing an uncached read of the directory, then we ideally want to read only the exact set of entries that will fit in the buffer supplied by the getdents() system call. So unlike the case where we're reading into the page cache, let's send only one READDIR call, before trying to fill up the buffer.

Fixes 35df59d3ef69 ("NFS: Reduce number of RPC calls when doing uncached readdir")
---
 fs/nfs/dir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/dir.c +2 -1
index 24ce5652d9be..cbf1a304ca18 100644
@@ -866,7 +866,8 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
 
 		status = nfs_readdir_page_filler(desc, entry, pages, pglen,
 						 arrays, narrays);
-	} while (!status && nfs_readdir_page_needs_filling(page));
+	} while (!status && nfs_readdir_page_needs_filling(page) &&
+		 page_mapping(page));
 
 	nfs_readdir_free_pages(pages, array_size);
 out:
Signature · 1 line
2.34.1