提交 c002a6c7 编写于 作者: D David Woodhouse 提交者: Al Viro

[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: NDavid Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 53c9c5c0
...@@ -1891,7 +1891,6 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, ...@@ -1891,7 +1891,6 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func,
if (!size) if (!size)
break; break;
de = (struct buffered_dirent *)buf.dirent; de = (struct buffered_dirent *)buf.dirent;
while (size > 0) { while (size > 0) {
offset = de->offset; offset = de->offset;
...@@ -1908,7 +1907,9 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, ...@@ -1908,7 +1907,9 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func,
size -= reclen; size -= reclen;
de = (struct buffered_dirent *)((char *)de + 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: done:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册