Commit 9ff89c25 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Simplify nfs_readdir_xdr_to_array()

Recent changes to readdir mean that we can cope with partially filled
page cache entries, so we no longer need to rely on looping in
nfs_readdir_xdr_to_array().
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 6c34f05b
...@@ -889,6 +889,7 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, ...@@ -889,6 +889,7 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
size_t array_size; size_t array_size;
struct inode *inode = file_inode(desc->file); struct inode *inode = file_inode(desc->file);
unsigned int dtsize = desc->dtsize; unsigned int dtsize = desc->dtsize;
unsigned int pglen;
int status = -ENOMEM; int status = -ENOMEM;
entry = kzalloc(sizeof(*entry), GFP_KERNEL); entry = kzalloc(sizeof(*entry), GFP_KERNEL);
...@@ -906,28 +907,20 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, ...@@ -906,28 +907,20 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
if (!pages) if (!pages)
goto out; goto out;
do { status = nfs_readdir_xdr_filler(desc, verf_arg, entry->cookie, pages,
unsigned int pglen; dtsize, verf_res);
status = nfs_readdir_xdr_filler(desc, verf_arg, entry->cookie, if (status < 0)
pages, dtsize, goto free_pages;
verf_res);
if (status < 0)
break;
pglen = status;
if (pglen == 0) {
nfs_readdir_page_set_eof(page);
break;
}
verf_arg = verf_res;
pglen = status;
if (pglen != 0)
status = nfs_readdir_page_filler(desc, entry, pages, pglen, status = nfs_readdir_page_filler(desc, entry, pages, pglen,
arrays, narrays); arrays, narrays);
desc->buffer_fills++; else
} while (!status && nfs_readdir_page_needs_filling(page) && nfs_readdir_page_set_eof(page);
page_mapping(page)); desc->buffer_fills++;
free_pages:
nfs_readdir_free_pages(pages, array_size); nfs_readdir_free_pages(pages, array_size);
out: out:
nfs_free_fattr(entry->fattr); nfs_free_fattr(entry->fattr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment