Date: Sun, 17 Aug 2008 17:12:56 +0100
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
struct nfshack_readdir {
char *dirent;
size_t used;
+ int full;
};
unsigned int reclen;
reclen = ALIGN(sizeof(struct nfshack_dirent) + namlen, sizeof(u64));
- if (buf->used + reclen > PAGE_SIZE)
+ if (buf->used + reclen > PAGE_SIZE) {
+ buf->full = 1;
return -EINVAL;
+ }
de->namlen = namlen;
de->offset = offset;
offset = file->f_pos;
- while (1) {
+ do {
unsigned int reclen;
buf.used = 0;
-
+ buf.full = 0;
err = btrfs_real_readdir(file, &buf, btrfs_nfshack_filldir);
if (err)
break;
size -= reclen;
de = (struct nfshack_dirent *)((char *)de + reclen);
}
- }
+ } while (buf.full);
done:
free_page((unsigned long)buf.dirent);