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>
if (!size)
break;
-
de = (struct buffered_dirent *)buf.dirent;
while (size > 0) {
offset = de->offset;
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: