Skip to content

Commit 42e7c87

Browse files
sagigrimbergAnna Schumaker
authored andcommitted
fs/nfs: Fix readdir slow-start regression
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>
1 parent 5248d84 commit 42e7c87

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/nfs/dir.c

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

75-
#define NFS_INIT_DTSIZE PAGE_SIZE
75+
#define NFS_INIT_DTSIZE SZ_64K
7676

7777
static struct nfs_open_dir_context *
7878
alloc_nfs_open_dir_context(struct inode *dir)
@@ -83,7 +83,7 @@ alloc_nfs_open_dir_context(struct inode *dir)
8383
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL_ACCOUNT);
8484
if (ctx != NULL) {
8585
ctx->attr_gencount = nfsi->attr_gencount;
86-
ctx->dtsize = NFS_INIT_DTSIZE;
86+
ctx->dtsize = min(NFS_SERVER(dir)->dtsize, NFS_INIT_DTSIZE);
8787
spin_lock(&dir->i_lock);
8888
if (list_empty(&nfsi->open_files) &&
8989
(nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER))

0 commit comments

Comments
 (0)