Skip to content

Commit

Permalink
[PATCH] Optimise NFS readdir hack slightly.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Woodhouse authored and Al Viro committed Oct 23, 2008
1 parent 53c9c5c commit c002a6c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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:
Expand Down

0 comments on commit c002a6c

Please sign in to comment.