From: David Woodhouse Date: Sun, 17 Aug 2008 16:21:18 +0000 (+0100) Subject: [PATCH] Optimise NFS readdir hack slightly. X-Git-Tag: v2.6.28-rc1~24^2~19 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=c002a6c7977320f95b5edede5ce4e0eeecf291ff;p=linux-2.6-omap-h63xx.git [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 Signed-off-by: Al Viro --- diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index e3e37f7c847..49d4b8725ca 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1891,7 +1891,6 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, if (!size) break; - de = (struct buffered_dirent *)buf.dirent; while (size > 0) { offset = de->offset; @@ -1908,7 +1907,9 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, size -= reclen; de = (struct buffered_dirent *)((char *)de + reclen); } - offset = vfs_llseek(file, 0, 1); + offset = vfs_llseek(file, 0, SEEK_CUR); + if (!buf.full) + break; } done: