Skip to content

Commit

Permalink
NFS: Don't overfill uncached readdir pages
Browse files Browse the repository at this point in the history
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: 35df59d ("NFS: Reduce number of RPC calls when doing uncached readdir")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
  • Loading branch information
trondmy@kernel.org authored and Anna Schumaker committed Feb 2, 2022
1 parent 26291c5 commit d9c4e39
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,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:
Expand Down

0 comments on commit d9c4e39

Please sign in to comment.