summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorChuck Lever <cel@kernel.org>2026-09-16 12:28:56 -0400
committerChuck Lever <cel@kernel.org>2026-10-11 23:12:59 -0400
commit58e8a4dadb92cb6e393ace5a3dcec89b08136af9 (patch)
tree78423bbc6e35674af21a65ff7e0e3a1ffb9b0f53 /tools/lib/python
parentfdb474ac9609765394532b836a5cf04458233c8e (diff)
downloadlinux-next-58e8a4dadb92cb6e393ace5a3dcec89b08136af9.tar.gz
linux-next-58e8a4dadb92cb6e393ace5a3dcec89b08136af9.zip
NFSD: Add a streaming directory reader
nfsd_readdir() reads a whole directory in one call, invoking a filldir actor for every entry. A consumer that wants to read entries while it encodes the reply -- as NFSv4 READDIR does, and as NFSv2 READDIR wants to -- cannot pause the loop between entries; it can only stop by returning nonzero from the actor and reporting eof or a full reply back through readdir_cd. Factor the directory read into a pull iterator. nfsd_readdir_open() opens the directory and seeks to the start cookie, nfsd_readdir_next() yields one buffered entry at a time and refills from the filesystem as needed, and nfsd_readdir_close() releases the open file. The reader holds the file across calls, so a consumer can pull entries during reply encoding and stop whenever its reply buffer fills. The page-buffer-per-batch design is retained: iterate_dir() fills a page through the buffering actor, and entries are handed to the consumer outside that call, so a consumer that calls ->lookup() (v3 readdirplus) still never reenters iterate_dir(). Reimplement nfsd_readdir() as a thin wrapper over the iterator, so NFSv3 and NFSv4 keep their existing behavior; a new caller uses the open/next/close interface directly. Acked-by: Jeff Layton <jlayton@kernel.org> Link: https://patch.msgid.link/20260916162859.2051-28-cel@kernel.org Signed-off-by: Chuck Lever <cel@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions