Skip to content
/ linux Public

Commit aa6e847

Browse files
sagigrimbergSasha Levin
authored andcommitted
fs/nfs: Fix readdir slow-start regression
[ Upstream commit 42e7c87 ] Commit 580f236 ("NFS: Adjust the amount of readahead performed by NFS readdir") reduces the amount of readahead names caching done by the client. The downside of this approach is READDIR now may suffer from a slow-start issue, where initially it will fetch names that fit in a single page, then in 2, 4, 8 until the maximum supported transfer size (usually 1M). This patch tries to take a balanced approach between mitigating the slow-start issue still maintaining some efficiency gains. Fixes: 580f236 ("NFS: Adjust the amount of readahead performed by NFS readdir") Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c1f244f commit aa6e847

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/nfs/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const struct address_space_operations nfs_dir_aops = {
7070
.free_folio = nfs_readdir_clear_array,
7171
};
7272

73-
#define NFS_INIT_DTSIZE PAGE_SIZE
73+
#define NFS_INIT_DTSIZE SZ_64K
7474

7575
static struct nfs_open_dir_context *
7676
alloc_nfs_open_dir_context(struct inode *dir)
@@ -81,7 +81,7 @@ alloc_nfs_open_dir_context(struct inode *dir)
8181
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL_ACCOUNT);
8282
if (ctx != NULL) {
8383
ctx->attr_gencount = nfsi->attr_gencount;
84-
ctx->dtsize = NFS_INIT_DTSIZE;
84+
ctx->dtsize = min(NFS_SERVER(dir)->dtsize, NFS_INIT_DTSIZE);
8585
spin_lock(&dir->i_lock);
8686
if (list_empty(&nfsi->open_files) &&
8787
(nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER))

0 commit comments

Comments
 (0)