Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] Optimise NFS readdir hack slightly.

Avoid calling the underlying ->readdir() again when we reached the end
already; keep going round the loop only if we stopped due to our own
buffer being full.

[AV: tidy the things up a bit, while we are there]

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

David Woodhouse and committed by
Al Viro
c002a6c7 53c9c5c0

+3 -2
+3 -2
fs/nfsd/vfs.c
··· 1891 1891 if (!size) 1892 1892 break; 1893 1893 1894 - 1895 1894 de = (struct buffered_dirent *)buf.dirent; 1896 1895 while (size > 0) { 1897 1896 offset = de->offset; ··· 1907 1908 size -= reclen; 1908 1909 de = (struct buffered_dirent *)((char *)de + reclen); 1909 1910 } 1910 - offset = vfs_llseek(file, 0, 1); 1911 + offset = vfs_llseek(file, 0, SEEK_CUR); 1912 + if (!buf.full) 1913 + break; 1911 1914 } 1912 1915 1913 1916 done: